Skip to content

Commit

Permalink
[api-xml-adjuster] Fix rebuilds (#1300)
Browse files Browse the repository at this point in the history
Ideally, project rebuilds when nothing has changed should be *fast*.

`api-xml-adjuster` isn't:

	$ time (cd build-tools/api-xml-adjuster ; xbuild)
	real	2m1.084s
	user	1m55.916s
	sys	0m8.853s

	# and the rebuild!
	$ time (cd build-tools/api-xml-adjuster ; xbuild)
	real	2m0.824s
	user	1m56.140s
	sys	0m8.600s

A *minimum* two minute+ rebuild -- when *nothing* has changed -- is a
surefire way to get really annoyed.

With diagnostic logging, we start to see the culprit:

	Target _ClassParse needs to be built as input file '@(ApiFileDefinition -> /Volumes/Seagate4TB/work/xamarin-android/build-tools/api-xml-adjuster/../../src/Mono.Android/Profiles/api-27.params.txt)' does not exist.

This in turn causes `class-parse.exe` and `api-xml-adjuster.exe` to be
*re-executed* on *every* `android.jar` on *every* build.

Fix this by correcting the `//Target/@Inputs` and `//Target/@Outputs`
for the `_ClassParse` and `_AdjustApiXml` tasks. After which,
no-change rebuilds are *significantly* faster:

	$ time (cd build-tools/api-xml-adjuster ; xbuild)
	real	0m5.308s
	user	0m6.042s
	sys	0m1.237s
  • Loading branch information
jonpryor authored Feb 14, 2018
1 parent 20b4190 commit 5c46ee3
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions build-tools/api-xml-adjuster/api-xml-adjuster.targets
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@
<Target Name="_ClassParse"
BeforeTargets="_AdjustApiXml"
DependsOnTargets="_DefineApiFiles"
Inputs="@(ApiFileDefinition -&gt; %(ApiFileDefinition.ParameterDescription))"
Outputs="@(ApiFileDefinition -&gt; %(ApiFileDefinition.ClassParseXml))">
Inputs="%(ApiFileDefinition.ParameterDescription)"
Outputs="%(ApiFileDefinition.ClassParseXml)">
<PropertyGroup>
<ClassParse>$(_TopDir)\bin\$(Configuration)\lib\xamarin.android\xbuild\Xamarin\Android\class-parse.exe</ClassParse>
</PropertyGroup>
Expand All @@ -31,8 +31,8 @@
<Target Name="_AdjustApiXml"
AfterTargets="Build"
DependsOnTargets="_DefineApiFiles"
Inputs="@(ApiFileDefinition -&gt; %(ApiFileDefinition.ClassParseXml))"
Outputs="@(ApiFileDefinition -&gt; %(ApiFileDefinition.ApiAdjustedXml)">
Inputs="%(ApiFileDefinition.ClassParseXml)"
Outputs="%(ApiFileDefinition.ApiAdjustedXml)">
<PropertyGroup>
<ApiXmlAdjuster>$(_TopDir)\bin\Build$(Configuration)\api-xml-adjuster.exe</ApiXmlAdjuster>
</PropertyGroup>
Expand Down

0 comments on commit 5c46ee3

Please sign in to comment.