-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
Add question flag to "question" the build if it is incremental #8012
Conversation
I am very skeptical of this approach. In general, incremental build problems are hard to debug because so many things are out-of-date--if there's only one thing that's broken, searching for the incremental build key phrases ( Can you give an example of a concrete real-world incremental build problem where this would help investigate? That might help understand the value. |
The analogy is maintaining code in hard without tests. Once tests are in place and reliable, then confidence grows and the product is more manageable. The goal of this feature is to 1) provide a fast way to investigate the issue by stopping on first incremental issue. This will shorten investigation time and more fixing time. 2) is to establish a way to validate incremental (aka testing). At the moment, there is too existing issues for 2 to be in place, but hopefully, this will lay the foundation going forward. Here is an example of an issue fixed in this PR. With the target "GenerateBindingRedirects" can hit an state where the IO will run indefinitely. Touch the project file without changing anything. This will trigger $(MSBuildAllProjects) on the input. The GenerateBindingRedirects task will run but won't write a new file because the content are same. The output wasn't modified and the target will repeat. While this task won't lead to disk write, it causes "noise" in the ( |
src/Build/BackEnd/Components/RequestBuilder/TargetUpToDateChecker.cs
Outdated
Show resolved
Hide resolved
@rainersigwald Ping. |
This is on my to-do list, hopefully early this week. |
Ping. |
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.
Left some comments, but I think this generally looks good. It'd also be good to add some documentation on how to use this properly, but that can wait. I can easily imagine people trying to use it on their first build and getting confused by all the errors...then being confused that they still happen if you build again...and again...
Ping @rainersigwald |
@rainersigwald, looks like resource files are unhappy; may need to build + push again |
I think I screwed up 😢 |
I have a meeting but will try to fix afterwards |
`src/MSBuild/Properties/launchSettings.json` was added to the repo as part of #8012 by mistake.
Fixes #7348
This PR adds "question" switch to msbuild.exe that will error out if a target or a task fails incremental check. Targets will fail if both Inputs and Outputs are present and not skip. Tasks changes are individually modified to support the interface IIncrementalTask, which sets the question boolean. Each task will need to be updated this interface take part.
I have started with the following tasks and fixed some of the issues within MSBuild enlistment. And there are more, see the notes below. Tasks updated: ToolTask, Copy, MakeDir, Touch, WriteLinesTofile, RemoveDir, DownloadFile, Move, ZipDirectory, Unzip, GenerateResource, GenerateBindingRedirects.
Using question investigate incremental issues is orders of magnitude easier. Reading the logs is simpler and repros are more consistent. In this PR, it includes a few fixes to the common targets which address some issues.
Example of a Target I/O error.
External Packages Incremental Notes
dotnet\sdk\7.0.100-rc.1.22431.12\Sdks\Microsoft.NET.Sdk\targets\Microsoft.NET.Publish.targets Target Name="_IncrementalCleanPublishDirectory" DependsOnTargets="_GetCurrentAndPriorPublishFileWrites" WriteLinesToFile File="$(IntermediateOutputPath)$(_PublishCleanFile)" Lines="@(_CurrentPublishFileWrites)" Overwrite="true" WriteOnlyWhenDifferent="true".nuget\packages\microsoft.dotnet.arcade.sdk\6.0.0-beta.22458.2\tools\VisualStudio.VsixBuild.targets
Some Copy task are missing SkipUnchangedFiles="true"
BootStrapMSBuild.targets, copy is overwriting files, thus it would never be incremental. A small refactor is required.
RAR sometimes touches the cache and cause GenerateBindingRedirects to run.
The FileState .dependencies are missing from the cache so it dirty the cache to fetched again.
See SystemState.GetAssemblyMetadata().
microsoft.sourcelink.github\1.0.0\build\Microsoft.SourceLink.GitHub.targets
Target Name="_InitializeAzureReposGitSourceLinkUrl" Inputs="@(SourceRoot)" Outputs="|%(Identity)|"