-
Notifications
You must be signed in to change notification settings - Fork 526
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] <GenerateJavaStubs/> improvements (#2956)
I went through the `_GenerateJavaStubs` MSBuild target and the `<GenerateJavaStubs/>` MSBuild task. There was an "easy" win to improve incremental build performance. I also made a few other general improvements to `<GenerateJavaStubs/>`. ~~ Inputs & Outputs ~~ `_GenerateJavaStubs` has `Inputs` of: Inputs="$(MSBuildAllProjects);@(_ResolvedAssemblies);$(_AndroidManifestAbs);$(_AndroidBuildPropertiesCache);@(_AndroidResourceDest)" Lets say a NetStandard assembly changes, such as a XAML change in a Xamarin.Forms app. In this case `_GenerateJavaStubs` does not actually need to run again. We can use `@(_ResolvedUserMonoAndroidAssemblies)` as an input instead of `@(_ResolvedAssemblies)`. This is the biggest win--to skip this target completely. ~~ selectedWhitelistAssemblies ~~ `ManifestDocument` had the concept of a "whitelist" assembly, which currently consisted of a single assembly: internal static readonly string [] FrameworkAttributeLookupTargets = {"Mono.Android.GoogleMaps.dll"}; `Mono.Android.GoogleMaps.dll` no longer exists, so I was able to remove a bit of code that still used that dead codepath. ~~ Typemaps ~~ Just a couple minor improvements here: * Fixed the usage of the `[Obsolete]` constructor for `TypeNameMapGenerator`. Using a `(TaskLevel level, string value)` callback instead. * I reused the `MemoryStream` and got rid of the `UpdateWhenChanged` method. ~~ Tests ~~ I updated the `IncrementalBuildTest.ProduceReferenceAssembly` test quite a bit: * The library project using `$(ProduceReferenceAssembly)` is now a NetStandard library. * I check all the targets that should be skipped from now on. I made a few changes in `Xamarin.ProjectTools` to clean things up: * The `DotNetStandard` class should just define `Language=XamarinAndroidProjectLanguage.CSharp` by default. * Added a `ShouldRestorePackageReferences` property for deciding if we pass `/restore` or not. * The `DotNetStandard` class always needs to use `/restore`, even if there are no `PackageReferences`. * I moved a couple methods from `DotNetXamarinProject` to `XamarinProject` so the `DotNetStandard` has them. ~~ Results ~~ Testing the Xamarin.Forms project in this repo. A fresh build I wasn't able to see a noticeable improvement. *However*, an incremental build with XAML-change: Before: 861 ms _GenerateJavaStubs 1 calls After: n/a The target is skipped now: _GenerateJavaStubs: Skipping target "_GenerateJavaStubs" because all output files are up-to-date with respect to the input files. Overall this seems to be ~800ms better for incremental builds with XAML changes.
- Loading branch information
1 parent
5a9d1a6
commit 9b99cce
Showing
11 changed files
with
66 additions
and
86 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
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
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