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]
_CompileJava
shouldn't always run (do…
…tnet#2598) Commit b90d3ab altered where we generate the Guid for `$XAMARIN_BUILD_ID`. This change resulted in the `_CompileJava` target running on every build, because the Guid and the resulting `AndroidEnvironment.java` file changed on every build. `$XAMARIN_BUILD_ID` should only change when an apk is built. This is so the same id can be written to both the apk and the msym archive. There was also a problem on windows where the design time build would trigger the `_GeneratePackageManagerJava` target to run. This was down to the the following file being updated <Project>.csproj.CoreCompileInputs.cache This would cause a cascade because once `_GeneratePackageManagerJava` ran, this would then trigger `_CompileJava` and then other targets. Looking at the `<GeneratePackageManagerJava/>` task we don't actually use the assemblies directly within the tast. We just need a list of the assembly names. A lot of the time we are running this task if an assembly changes when we don't really need to. What we actually need to do is run the task when assemblies are either added or removed from the list. To that end we now store a hash of the `@(ResolvedAssemblies)` ItemGroup in `$(IntermediateOutputPath)resolvedassemblies.hash`. This hash is updated when the `ResolveAssemblies` target is run. We can then use that hash file as an input to the `_GeneratePackageManagerJava` target to ensure that we only run `_GeneratePackageManagerJava` when the list changes. An additional change was to write the `$XAMARIN_BUILD_ID` to a file so that it can be stored between builds. This is needed because if the `_GeneratePackageManagerJava` target is skipped (due to an up to date build) during the package creation, the `$(_XamarinBuildId)` property would be empty. The `$(_XamarinBuildId)` value is required for the `<CreateMsymManifest/>` task, so we need to be able to store this value between builds and read it in when required. Reading directly from a `txt` file is quicker than pulling the information from the `XamarinAndroidEnvironmentVariables.java` file which `_GeneratePackageManagerJava` produces.
- Loading branch information