Skip to content

Commit

Permalink
Fix issue with incremental build with globs.
Browse files Browse the repository at this point in the history
Add a target that runs before CoreCompile that will record and store the
state of the Compile ItemGroup. This file is added to the
CustomAdditionalCompileInputs which is an input to CoreCompile. When this
file changes, CoreCompile will run again. This fixes the issue of deleting
a file or adding a file with an old timestamp to a glob (e.g. *.cs).

Fixes #1327
  • Loading branch information
AndyGerlicher committed Nov 11, 2016
1 parent a0b12f1 commit c0d02df
Showing 1 changed file with 26 additions and 0 deletions.
26 changes: 26 additions & 0 deletions src/XMakeTasks/Microsoft.Common.CurrentVersion.targets
Original file line number Diff line number Diff line change
Expand Up @@ -3010,6 +3010,7 @@ Copyright (C) Microsoft Corporation. All rights reserved.
_GenerateCompileInputs;
BeforeCompile;
_TimeStampBeforeCompile;
_GenerateCompilerDependencyCache;
CoreCompile;
_TimeStampAfterCompile;
AfterCompile;
Expand Down Expand Up @@ -3164,6 +3165,31 @@ Copyright (C) Microsoft Corporation. All rights reserved.

</Target>

<!--
============================================================
_GenerateCompilerDependencyCache
Generate a file used to track compiler dependencies between incremental build
executions. This handles cases where items are added or removed from a glob (e.g.
<Compile Include="**\*.cs" />) and can't otherwise be detected with timestamp
comparisons. The file contains a hash of compiler inputs that are known to
contribute to incremental build inconsistencies.
============================================================
-->
<Target Name="_GenerateCompilerDependencyCache" DependsOnTargets="ResolveAssemblyReferences">
<ItemGroup>
<CustomAdditionalCompileInputs Include="$(IntermediateOutputPath)CoreCompileInputs.cache" />
<CoreCompileCache Include="@(Compile->'%(FullPath)')" />
<CoreCompileCache Include="@(ReferencePath->'%(FullPath)')" />
</ItemGroup>

<Hash ItemsToHash="@(CoreCompileCache)">
<Output TaskParameter="HashResult" PropertyName="CoreCompileDependencyHash" />
</Hash>

<WriteLinesToFile Lines="$(CoreCompileDependencyHash)" File="$(IntermediateOutputPath)CoreCompileInputs.cache" Overwrite="True" WriteOnlyWhenDifferent="True" />
</Target>

<!--
============================================================
_TimeStampAfterCompile
Expand Down

0 comments on commit c0d02df

Please sign in to comment.