diff --git a/src/Xamarin.Android.Build.Tasks/Tasks/Aapt.cs b/src/Xamarin.Android.Build.Tasks/Tasks/Aapt.cs index 0fc1f9ce810..282537c7fac 100644 --- a/src/Xamarin.Android.Build.Tasks/Tasks/Aapt.cs +++ b/src/Xamarin.Android.Build.Tasks/Tasks/Aapt.cs @@ -371,7 +371,7 @@ protected void LogEventsFromTextOutput (string singleLine, MessageImportance mes line = int.Parse (match.Groups["line"].Value) + 1; var level = match.Groups["level"].Value.ToLowerInvariant (); var message = match.Groups ["message"].Value; - if (message.Contains ("fakeLogOpen") || level.Contains ("warning")) { + if (message.Contains ("fakeLogOpen") || level.Contains ("warning") || string.IsNullOrEmpty (level)) { LogWarning (singleLine); return; } diff --git a/src/Xamarin.Android.Build.Tasks/Tests/Xamarin.Android.Build.Tests/AndroidRegExTests.cs b/src/Xamarin.Android.Build.Tasks/Tests/Xamarin.Android.Build.Tests/AndroidRegExTests.cs index d47a3e0ccc0..60f270368b2 100644 --- a/src/Xamarin.Android.Build.Tasks/Tests/Xamarin.Android.Build.Tests/AndroidRegExTests.cs +++ b/src/Xamarin.Android.Build.Tasks/Tests/Xamarin.Android.Build.Tests/AndroidRegExTests.cs @@ -74,6 +74,14 @@ public IEnumerator GetEnumerator () /*expectedLevel*/ "", /*expectedMessage*/ "max res 10, skipping values-sw600dp-land" }; + yield return new object [] { + /*message*/ "max res 10, skipping values-sw720dp-land-v13", + /*expectedToMatch*/ true, + /*expectedFile*/ "", + /*expectedLine*/ "", + /*expectedLevel*/ "", + /*expectedMessage*/ "max res 10, skipping values-sw720dp-land-v13" + }; yield return new object [] { /*message*/ "Error: unable to generate entry for resource data", /*expectedToMatch*/ true, diff --git a/src/Xamarin.Android.Build.Tasks/Tests/Xamarin.Android.Build.Tests/AndroidUpdateResourcesTest.cs b/src/Xamarin.Android.Build.Tasks/Tests/Xamarin.Android.Build.Tests/AndroidUpdateResourcesTest.cs index 0af1190c1be..11bb458e228 100644 --- a/src/Xamarin.Android.Build.Tasks/Tests/Xamarin.Android.Build.Tests/AndroidUpdateResourcesTest.cs +++ b/src/Xamarin.Android.Build.Tasks/Tests/Xamarin.Android.Build.Tests/AndroidUpdateResourcesTest.cs @@ -183,6 +183,21 @@ public void ReportAaptErrorsInOriginalFileName () } } + [Test] + public void ReportAaptWarningsForBlankLevel () + { + //This test should get the warning `Invalid file name: must contain only [a-z0-9_.]` + // However, still fails due to aapt failing, Resource.designer.cs is not generated + var proj = new XamarinAndroidApplicationProject (); + proj.AndroidResources.Add (new AndroidItem.AndroidResource ("Resources\\drawable\\Image (1).png") { BinaryContent = () => XamarinAndroidCommonProject.icon_binary_mdpi }); + using (var b = CreateApkBuilder ("temp/ReportAaptWarningsForBlankLevel")) { + b.ThrowOnBuildFailure = false; + Assert.IsFalse (b.Build (proj), "Build should have failed."); + StringAssertEx.DoesNotContain ("APT0000", b.LastBuildOutput, "An error message with a blank \"level\", should only report a warning!"); + Assert.IsTrue (b.Clean (proj), "Clean should have succeeded."); + } + } + [Test] public void RepetiviteBuildUpdateSingleResource () {