Skip to content

Commit

Permalink
[Xamarin.Android.Build.Tasks]: Fix incremental builds (#10)
Browse files Browse the repository at this point in the history
The (poorly named) `_Foo` target didn't have any `//Target/@Inputs`
or `//Target/@Outputs` attribute values, and thus would constantly:

1. Re-execute on every build, which would
2. Create a "new" $(IntermediateOutputPath)Profile.g.cs, which would
3. Require that Mono.Android.dll be rebuilt, as a file had changed.

Rename the `_Foo` target to `_GenerateProfileClass`, and add `Inputs`
and `Outputs` attributes so that the target isn't constantly executed.
  • Loading branch information
radical authored and jonpryor committed May 4, 2016
1 parent 461cc83 commit a3dfd4c
Showing 1 changed file with 13 additions and 11 deletions.
24 changes: 13 additions & 11 deletions src/Xamarin.Android.Build.Tasks/Xamarin.Android.Build.Tasks.targets
Original file line number Diff line number Diff line change
@@ -1,16 +1,18 @@
<?xml version="1.0" encoding="UTF-8" ?>
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<UsingTask TaskName="Xamarin.Android.Tools.BootstrapTasks.GenerateProfile" AssemblyFile="..\..\bin\Build$(Configuration)\Xamarin.Android.Tools.BootstrapTasks.dll" />
<Target Name="_Foo" BeforeTargets="CoreCompile">
<PropertyGroup>
<_GeneratedProfileClass>$(IntermediateOutputPath)Profile.g.cs</_GeneratedProfileClass>
</PropertyGroup>
<ItemGroup>
<SharedRuntimeBuildPath Include="..\..\bin\$(Configuration)\lib\xbuild-frameworks\MonoAndroid\" />
</ItemGroup>
<CreateItem Include="@(SharedRuntimeBuildPath->'%(Identity)\\v1.0\*.dll');@(SharedRuntimeBuildPath->'%(Identity)\\v6.0\*.dll')">
<Output TaskParameter="Include" ItemName="_SharedRuntimeAssemblies" />
</CreateItem>
<PropertyGroup>
<_SharedRuntimeBuildPath>..\..\bin\$(Configuration)\lib\xbuild-frameworks\MonoAndroid\</_SharedRuntimeBuildPath>
<_GeneratedProfileClass>$(IntermediateOutputPath)Profile.g.cs</_GeneratedProfileClass>
</PropertyGroup>
<ItemGroup>
<_SharedRuntimeAssemblies Include="$(_SharedRuntimeBuildPath)v1.0\*.dll;$(_SharedRuntimeBuildPath)$(AndroidFrameworkVersion)\*.dll"/>
</ItemGroup>

<Target Name="_GenerateProfileClass" BeforeTargets="CoreCompile"
Inputs="@(_SharedRuntimeAssemblies)"
Outputs="$(_GeneratedProfileClass)"
>
<GenerateProfile Files="@(_SharedRuntimeAssemblies)" OutputFile="$(_GeneratedProfileClass)" />
<ItemGroup>
<Compile Include="$(_GeneratedProfileClass)" />
Expand All @@ -20,4 +22,4 @@
Lines="$(_GeneratedProfileClass)"
Overwrite="false"/>
</Target>
</Project>
</Project>

0 comments on commit a3dfd4c

Please sign in to comment.