-
Notifications
You must be signed in to change notification settings - Fork 533
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] Install should skip Build when inside t…
…he IDE Context: https://github.com/xamarin/xamarin-android/wiki/IDE-Performance-Results Context: https://github.com/jonathanpeppers/HelloWorld When doing some performance measurements *inside* of Visual Studio, I noticed we seem to have significant overhead in a build with no changes. In a "Hello World" Xamarin.Forms app: Preparation Time: 00:03.9 Launch Time: 00:02.5 Where `Preparation Time` is everything MSBuild, and `Launch Time` is the time it takes to start the Android application and attach the debugger. `Preparation Time` is effectively: msbuild Foo.Android.csproj /p:BuildingInsideVisualStudio=True /t:Build msbuild Foo.Android.csproj /p:BuildingInsideVisualStudio=True /t:Install One concern here is that `Install` depends on `SignAndroidPackage`, which depends on `Build`. We are doing a lot of MSBuild work here twice, since MSBuild needs to run through certain targets twice and decide they can be skipped. This work is "not free" and mostly involved MSBuild evaluating properties and time stamps on files. What I found we could do here is skip `Build` on the `Install` target when `$(BuildingInsideVisualStudio)` is `True`. Due to the dependency chain, this also affects `SignAndroidPackage`. The minimal list of targets for `SignAndroidPackage` that still work: - `_CreatePropertiesCache` - `ResolveReferences` - `_CopyPackage` - `_Sign` Initial results from the IDE show: Preparation Time: 00:02.06s This is a ~2 second saving on the inner dev loop! ~~ MSBuild Tests ~~ Since our MSBuild tests set `$(BuildingInsideVisualStudio)`, a lot of our tests might break. We might have to add an additional call to `Build` in each failing test. The way I worked around this was to make the `CreateApkBuilder` method run `Build,SignAndroidPackage` by default. Originally there were 248 test failures. I also did some other cleanup: - Added a `ProjectBuilder.RunTarget` method, so tests can more easily run custom targets and not modify the `Target` property: `builder.RunTarget ("Foo")`. - Added `ProjectBuilder.DesignTimeBuild`. - `Builder` now has a `BuildingInsideVisualStudio` property to toggle the value as a command-line global property. We were putting this in the `csproj`, which seems a bit different than what IDEs are actually doing... Also added a `BuildOutsideVisualStudio` test to verify the `SignAndroidPackage` target works by itself *outside* of IDEs.
- Loading branch information
1 parent
7c9dea8
commit 6f3a6ee
Showing
8 changed files
with
76 additions
and
50 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