dotnet / dotnet/msbuild

Incremental builds: Respect inputs closure changes as well as timestamps

Open
#2,470 6 comments 1 reaction 0 assignees View on GitHub
needs-design triaged
Dominant language
C#
Stars
5.5k
Forks
1.5k
Avg merge
1d 8h
Merged PRs (30d)
141

Description

Currently targets are skipped based on the timestamps of files defined as inputs and outputs for the target. This is good and fast, yet maybe incorrect for what the target author intended.

Especially with the increased popularity of globbing to add items to projects, these items alone cannot be used as only inputs for incremental builds in some situations which may be unexpected for target authors. For example, when items are deleted or renamed, there is no newer modification timestamp, so a target may be skipped. Previously, the main project was modified when new items were added to the project so all targets using `$(MSBuildAllProjects)` as input would be rebuilt, but with globbing and an `@(Compile)` or `@(Content)` input, a target may be skipped unexpectedly.

Proposal: Add a new attribute to targets to allow target authors to opt into a new tracking of the input closure, so that given `File1`, `File2` and `File3` existed on disk with equal timestamps, a change of inputs from `File1;File2` to `File2;File3` will cause the target to be rebuilt.

I don't have a good idea how to name it though (`TrackClosureForIncrementalBuilds="true"`?).

The only workaround tat the moment would be to have an additional target write a file with all the inputs using MSBuild 15's `` feature and using the resulting file as input for incremental builds.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.