Skip to content
Merged
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
18 changes: 7 additions & 11 deletions src/Xamarin.Android.Build.Tasks/Tasks/Aapt.cs
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ bool RunAapt (string commandLine)
using (var proc = new Process ()) {
proc.OutputDataReceived += (sender, e) => {
if (e.Data != null)
LogEventsFromTextOutput (e.Data, MessageImportance.Normal);
LogMessage (e.Data, MessageImportance.Normal);
else
stdout_completed.Set ();
};
Expand Down Expand Up @@ -369,7 +369,7 @@ protected void LogEventsFromTextOutput (string singleLine, MessageImportance mes
int line = 0;
if (!string.IsNullOrEmpty (match.Groups["line"]?.Value))
line = int.Parse (match.Groups["line"].Value) + 1;
var level = match.Groups["level"].Value;
var level = match.Groups["level"].Value.ToLowerInvariant ();
var message = match.Groups ["message"].Value;
if (message.Contains ("fakeLogOpen") || level.Contains ("warning")) {
LogWarning (singleLine);
Expand All @@ -388,17 +388,13 @@ protected void LogEventsFromTextOutput (string singleLine, MessageImportance mes
if (message.StartsWith ("error: ", StringComparison.InvariantCultureIgnoreCase))
message = message.Substring ("error: ".Length);

LogError ("APT0000", message, file, line);
return;
}

// Handle additional error that doesn't match the regex
if (singleLine.Trim ().StartsWith ("invalid resource directory name:")) {
LogError ("APT0000", string.Format ("Invalid resource directory name: \"{0}\".", singleLine.Substring (singleLine.LastIndexOfAny (new char[] { '\\', '/' }) + 1)), ToolName);
return;
if (level.Contains ("error") || (line != 0 && !string.IsNullOrEmpty (file))) {
LogError ("APT0000", message, file, line);
return;
}
}

LogMessage (singleLine, messageImportance);
LogError ("APT0000", string.Format("{0} \"{1}\".", singleLine.Trim(), singleLine.Substring(singleLine.LastIndexOfAny(new char[] { '\\', '/' }) + 1)), ToolName);
}
}
}
2 changes: 1 addition & 1 deletion src/Xamarin.Android.Build.Tasks/Tasks/AndroidToolTask.cs
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ public static Regex AndroidErrorRegex {
\s*
(?<message>.*)
$
", RegexOptions.Compiled | RegexOptions.ExplicitCapture | RegexOptions.IgnorePatternWhitespace);
", RegexOptions.Compiled | RegexOptions.ExplicitCapture | RegexOptions.IgnorePatternWhitespace | RegexOptions.IgnoreCase);
return androidErrorRegex;
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,70 @@ public IEnumerator GetEnumerator ()
/*expectedLevel*/ "",
/*expectedMessage*/ "Invalid file name: must contain only [a-z0-9_.]"
};

yield return new object [] {
/*message*/ "max res 10, skipping values-sw600dp",
/*expectedToMatch*/ true,
/*expectedFile*/ "",
/*expectedLine*/ "",
/*expectedLevel*/ "",
/*expectedMessage*/ "max res 10, skipping values-sw600dp"
};
yield return new object [] {
/*message*/ "max res 10, skipping values-sw600dp-land",
/*expectedToMatch*/ true,
/*expectedFile*/ "",
/*expectedLine*/ "",
/*expectedLevel*/ "",
/*expectedMessage*/ "max res 10, skipping values-sw600dp-land"
};
yield return new object [] {
/*message*/ "Error: unable to generate entry for resource data",
/*expectedToMatch*/ true,
/*expectedFile*/ "",
/*expectedLine*/ "",
/*expectedLevel*/ "Error",
/*expectedMessage*/ "unable to generate entry for resource data"
};
yield return new object [] {
/*message*/ "Error: malformed resource filename",
/*expectedToMatch*/ true,
/*expectedFile*/ "",
/*expectedLine*/ "",
/*expectedLevel*/ "Error",
/*expectedMessage*/ "malformed resource filename"
};
yield return new object [] {
/*message*/ "warning: Multiple AndroidManifest.xml files found, using foo\\AndroidManifest.xml",
/*expectedToMatch*/ true,
/*expectedFile*/ "",
/*expectedLine*/ "",
/*expectedLevel*/ "warning",
/*expectedMessage*/ "Multiple AndroidManifest.xml files found, using foo\\AndroidManifest.xml"
};
yield return new object [] {
/*message*/ "Resources/values/theme.xml:55: No start tag found",
/*expectedToMatch*/ true,
/*expectedFile*/ "Resources/values/theme.xml",
/*expectedLine*/ "55",
/*expectedLevel*/ "",
/*expectedMessage*/ "No start tag found"
};
yield return new object [] {
/*message*/ "package name is required with --rename-manifest-package.",
/*expectedToMatch*/ true,
/*expectedFile*/ "",
/*expectedLine*/ "",
/*expectedLevel*/ "",
/*expectedMessage*/ "package name is required with --rename-manifest-package."
};
yield return new object [] {
/*message*/ "invalid resource directory name: bar-55",
/*expectedToMatch*/ true,
/*expectedFile*/ "",
/*expectedLine*/ "",
/*expectedLevel*/ "",
/*expectedMessage*/ "invalid resource directory name: bar-55"
};
}
}

Expand Down