Skip to content
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

Populate unproxied targets to avoid dropping requested targets #9130

Merged
merged 3 commits into from
Oct 17, 2023

Conversation

dfederm
Copy link
Contributor

@dfederm dfederm commented Aug 15, 2023

Fixes #9117

For project cache plugins to only partially handle a build request, it makes sense for it to only proxy some targets and not others. For example, in VS the build request has:

"Build"
"BuiltProjectOutputGroup"
"BuiltProjectOutputGroupDependencies"
"DebugSymbolsProjectOutputGroup"
"DebugSymbolsProjectOutputGroupDependencies"
"DocumentationProjectOutputGroup"
"DocumentationProjectOutputGroupDependencies"
"SatelliteDllsProjectOutputGroup"
"SatelliteDllsProjectOutputGroupDependencies"
"SGenFilesOutputGroup"
"SGenFilesOutputGroupDependencies"

"Build" is the only relevant one that a plugin would want to handle, and would likely redirect to "GetTargetPath", while the rest are "information gathering" targets which should just be "passed through" and allowed to execute as-is.

Today if the plugin does this, the targets it does not proxy are dropped entire, which would make the caller confused about not getting results for a target they specifically requested. This change instead just fills in the remaining targets which were not proxied.

Example:
Original request: Build, BuiltProjectOutputGroup, BuiltProjectOutputGroupDependencies, ...
Cache plugin returns proxy targets Build -> GetTargetPath, and nothing more.
New request: GetTargetPath, BuiltProjectOutputGroup, BuiltProjectOutputGroupDependencies, ...

This fixes #9117 indirectly by not requiring a plugin to handle targets it wants to pass through at all, allowing it to just ignore them.

Copy link
Member

@JanKrivanek JanKrivanek left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Overall looks good!
I have one minor comment for consideration

@rainersigwald rainersigwald added this to the VS 17.9 milestone Sep 19, 2023
@AR-May AR-May merged commit 4256aed into dotnet:main Oct 17, 2023
@dfederm dfederm deleted the proxy-targets-fill-missing branch October 20, 2023 22:30
maridematte added a commit to maridematte/msbuild that referenced this pull request Oct 24, 2023
@maridematte maridematte mentioned this pull request Oct 24, 2023
rainersigwald pushed a commit that referenced this pull request Oct 24, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Bug]: Msbuild crashes when using cache extension with proxy targets pointing to original targets
5 participants