-
Notifications
You must be signed in to change notification settings - Fork 564
[Xamarin.Android.Build.Tasks] Rework Aapt log processing. #1153
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
| } | ||
|
|
||
| bool RunAapt (string commandLine) | ||
| bool RunAapt (string commandLine, IList<Tuple<string, bool>> output) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Philosophically... Tuple<string, bool>?! I wonder if we can use ValueTuple, and at least have (string message, bool stderr)?
Otherwise, really not a fan of tuples.
If we can't use (string message, bool stderr), perhaps a new struct would be better?
| var output = new List<Tuple<string, bool>> (); | ||
| var ret = RunAapt (cmd, output); | ||
| foreach (var line in output) { | ||
| if (line.Item2) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
...and this right here is why I'm not fond of Tuple<string, bool>. line.stderr would be so much more readable.
Not a chance I'm going to remember that Item2 is whether the message came from stdout vs. stderr.
|
Aside: I thought one of the related ideas was to "ignore" the |
Context dotnet#1134 Aapt is pretty inconsistent with how it reports errors and warnings. Warnings are written to stderr.. So we are reworking the output processing for aapt to hopefully handle errors are warnings in a more consistent way. Rather than process the output in realtime we will buffer it and process the output once aapt has completed. This will allow us to check to see if the required output file (R.java) was created. If it wasn't then we can assume that the process failed. We can then process the output knowing that we are expecting and error. In the case where R.java does exist, we can assume if we do find anything which looks like an error it is more than likely a warning.
|
Re-worked commit message for merging: |
Fixes: #1134 `aapt` is pretty inconsistent with how it reports errors and warnings; for example, warnings are written to stderr. This is a bit of a conundrum: * Messages *may* contain `error` or `warning`, but they might not (no level specified; 2135856). * Messages written to stderr may be warnings, *not* errors. * The `aapt` return value may be non-zero when warnings are written but output files are still generated. In particular, consider Issue #1134: `aapt` writes to stderr: max res 10, skipping values-sw720dp-land-v13 "max res 10, skipping values-sw720dp-land-v13". This was previously being reported as an error, "simply" because it was written to stderr, but the above is *not* an error. Rework `aapt` output processing to hopefully handle errors and warnings in a more consistent way. Instead of processing the output in realtime we will instead buffer it and process the output once `aapt` has completed. This will allow us to check to see if the required output file (`R.java`) was created. If `R.java` *is* created, messages written to stderr without an explicit level will be treated as warnings. If `R.java` is *not* created, messages written to stderr without an explicit level will be treated as *errors*.
Changes: xamarin/monodroid@ad19471...bafd139 * xamarin/monodroid@bafd13939: [tools/msbuild] Fix DateTimeOffset error (#1158) * xamarin/monodroid@b355593ab: [tools/msbuild] Use millisecond resoluton for Fast Deployment (#1157) * xamarin/monodroid@34ae2a311: [tools/msbuild] add %(TargetPath) metadata for <FastDeploy/> (#1156) * xamarin/monodroid@d9fcaa019: [tools/msbuild] Fix Time resoluton for Fast Deployment (#1154) * xamarin/monodroid@390c048ca: [msbuild] Use `$(LZ4PackageVersion)` (#1153)
Context #1134
Aapt is pretty inconsistent with how it reports errors and
warnings. Warnings are written to stderr..
So we are reworking the output processing for aapt to hopefully
handle errors are warnings in a more consistent way. Rather than
process the output in realtime we will buffer it and process the
output once aapt has completed. This will allow us to check to
see if the required output file (R.java) was created. If it
wasn't then we can assume that the process failed.
We can then process the output knowing that we are expecting
and error. In the case where R.java does exist, we can assume
if we do find anything which looks like an error it is more
than likely a warning.