Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/Xamarin.Android.Build.Tasks/Tasks/Aapt.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -183,6 +183,21 @@ public void ReportAaptErrorsInOriginalFileName ()
}
}

[Test]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This test should be redundant with the addition to AndroidRegExTests.cs. The only things this will do is slow down the tests (MSBuild-based tests are slow), and trigger a warning if/when aapt changes the error message it generates.

@dellis1972: agreed?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should extend the AndroidRegExTests.cs test cases rather than adding new tests which do a full build I think.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

actually. I take that back.. the AndroidRegExTests.cs only tests the regex.. it doesn't test the logic of what happens after we get the regex.. So we need this test.

public void ReportAaptWarningsForBlankLevel ()
{
//This test should get the warning `Invalid file name: must contain only [a-z0-9_.]`
// However, <Aapt /> 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 ()
{
Expand Down