-
Notifications
You must be signed in to change notification settings - Fork 534
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Xamarin.Android.Build.Tasks] Run
aapt2 compile
incrementally.
The `aapt2 compile` command runs in two modes. The one we currently use is the `archive` mode. We calling `aapt2 compile` with the `--dir` argument you end up generating one `flata` archive for all the files. The side effect of this is that even if you only change one file, it will need to regenerate the entire `flata` archive. But it has a second mode. Rather than using `--dir` you just send in a single file. This then writes a single `.flat` file to the output directory. While this does mean you have to call `aapt2 compile` for EVERY file, it does mean we can leverage MSbuilds support for partial targets. This means MSbuild will detect ONLY the files which changed and allow us to call `aapt2 compile` with just THOSE files. One exception to this new system are references which use the `AndroidSkipResourceProcessing` metadata. In those cases the chance of those libraries being updated on a regular basis is quite low. So in that case using a `flata` archive will be better since the files won't be changing much. While this may impact on initial build times, the goal is to make incremental builds quicker. This is especially true for users to use ALLOT of `AndroidResource` items. A note regarding the `aapt2 daemon` mode. In order to write accented characters we need to set the `StandardInput` encoding to UTF8. This is not possible directly in netstandard 2.0. So we have to use `Console.InputEncoding` instead. Also not that we MUST not include a BOM when writting the commands. This is because `aapt2` will try to parse the BOM as command characters. Also the `aapt2 link` command sometimes reports it is "Done" before it has even written the archive for the file. So we can get into a position where we think we are done but the file is not on disk. So we have had to include a nasty wait which will poll for the existence of the expected output file and only return when it exists. The good news is we know at this point if the command failed or not, so we can bypass the check on failure.
- Loading branch information
1 parent
b6eba4e
commit 802f0d3
Showing
27 changed files
with
1,238 additions
and
303 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.