-
Notifications
You must be signed in to change notification settings - Fork 19
Make CollectDeclaredReferences target incremental #136
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -9,7 +9,11 @@ | |||||
| <CompilerVisibleProperty Include="EnableReferenceTrimmerDiagnostics"/> | ||||||
| </ItemGroup> | ||||||
|
|
||||||
| <Target Name="CollectDeclaredReferences" DependsOnTargets="ResolveAssemblyReferences;PrepareProjectReferences" Condition="'$(EnableReferenceTrimmer)' != 'false'"> | ||||||
| <Target Name="CollectDeclaredReferences" | ||||||
| DependsOnTargets="ResolveAssemblyReferences;PrepareProjectReferences" | ||||||
| Condition="'$(EnableReferenceTrimmer)' != 'false'" | ||||||
| Inputs="$(MSBuildProjectFullPath);$(ProjectAssetsFile)" | ||||||
| Outputs="$(MSBuildProjectDirectory)\$(IntermediateOutputPath)_ReferenceTrimmer_DeclaredReferences.tsv"> | ||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
| <PropertyGroup> | ||||||
| <_ReferenceTrimmerDeclaredReferencesFile>$([System.IO.Path]::GetFullPath('$(IntermediateOutputPath)_ReferenceTrimmer_DeclaredReferences.tsv'))</_ReferenceTrimmerDeclaredReferencesFile> | ||||||
| <_ReferenceTrimmerUsedReferencesFile>$([System.IO.Path]::GetFullPath('$(IntermediateOutputPath)_ReferenceTrimmer_UsedReferences.log'))</_ReferenceTrimmerUsedReferencesFile> | ||||||
|
|
||||||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -506,6 +506,9 @@ private static void SaveDeclaredReferences(IReadOnlyList<DeclaredReference> decl | |
| string existing = File.ReadAllText(filePath); | ||
| if (string.Equals(existing, newContent, StringComparison.OrdinalIgnoreCase)) | ||
| { | ||
| // Touch the file so that MSBuild's Inputs/Outputs incrementality check | ||
| // sees a fresh timestamp and can skip the target on subsequent builds. | ||
| File.SetLastWriteTimeUtc(filePath, DateTime.UtcNow); | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. the whole point of the if check is not to touch the timestamp if the file is identical, so this line should be reverted.
Owner
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. But then incrementality never works for this target
Owner
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ah, but with the touch then the compiler's inputs changed and it triggers a recompile.... |
||
| return; | ||
| } | ||
| } | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There are many more inputs than this