-
Notifications
You must be signed in to change notification settings - Fork 532
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] merge two targets to fix AndroidX.Migra…
…tion Context: https://github.com/xamarin/XamarinAndroidXMigration Fixes: #4068 Developers have been reporting an error when using AndroidX.Migration: The "CopyGeneratedJavaResourceClasses" task was not given a value for the required parameter "SourceTopDirectory". It is reported another build fixes the issue, and it "randomly" happens on incremental builds. The error seems to indicate either `$(AaptTemporaryDirectory)` or `$(ResgenTemporaryDirectory)` are blank? But it only happens when using the AndroidX.Migration NuGet package. From a user's build log: Skipping target "_PrepareCreateBaseApk" because all output files are up-to-date with respect to the input files. Which would indicate in the case of AndroidX.Migration: * `_PrepareCreateBaseApk` was skipped. * `_AndroidXJetifyManifest` was injected, it came along and modified `$(IntermediateOutputPath)android\AndroidManifest.xml`. * `_CreateBaseApk` ran (with updated inputs), and `$(AaptTemporaryDirectory)` is blank! I could reproduce the problem in a test: * Build a project with AndroidX.Migration * Change C# code (a non-Java.Lang.Object class) * Build the project again Reviewing the MSBuild targets: `_PrepareCreateBaseApk` and `_CreateBaseApk`. They define a property that is passed between two targets. The following sets of targets have nearly identical `Input`/`Output`: * `_PrepareCreateBaseApk` and `_CreateBaseApk` * `_PrepareUpdateAndroidResgen` and `_UpdateAndroidResgen` This was done to workaround a long-lived bug in MSBuild: dotnet/msbuild#1006 A fix that doesn't seem break anything is to just run `_PrepareCreateBaseApk` *after* `$(AfterGenerateAndroidManifest)`. So if something triggers `_CreateBaseApk`, `_PrepareCreateBaseApk` will always run as well. I wrote a test for this scenario, and updated the AndroidX NuGets in our tests to use the RC now.
- Loading branch information
1 parent
0153c2c
commit 9fe854e
Showing
4 changed files
with
42 additions
and
8 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
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