-
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
Traversal targets for cross-targeting #1018
Conversation
caceff2
to
e136e0a
Compare
|
||
<!-- | ||
============================================================ | ||
PrepareProjectReferences |
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.
This is a nice improvement 👍
e136e0a
to
3fd00a2
Compare
--> | ||
|
||
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> | ||
<Import Project="$(CoreTraversalTargetsPath)" |
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.
What defines this?
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.
I will define it in our after-props hook. We are only redirecting targets, not props so it will work. We need to discuss the outer build extensibility and how nuget packages participate, etc. This is just enough to (1) unblock my follow up work (2) smoke test that the common targets hijacking doesn't interfere with existing projects.
Ready for review, @AndyGerlicher @cdmihai @srivatsn @davkean. |
FYI, @dotnet/project-system |
3fd00a2
to
e5dcceb
Compare
I'm not a fan of calling this "traversal". Inside Microsoft, there's a long tradition of "traversal projects" (traditionally That said, I'm not sure what the right name for this concept is. "Inner" and "outer" as we've been casually calling it isn't very descriptive. Maybe something like |
I'm happy to rename but we need a quick decision if this is really going in tonight. Traversal was what we had said in Friday's design meeting and I reiterated in my notes sent immediately after that. |
I'll defer to the MSBuild folks wrt naming here. |
@@ -17,6 +17,15 @@ Copyright (C) Microsoft Corporation. All rights reserved. | |||
|
|||
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> | |||
<!-- | |||
We are doing a cross-targeting traversal build if there is no list of target frameworks specified |
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.
If there's a design doc on some github SDK page about what a cross-tagetting traversal build is, this comment would be a good spot to reference it in case users want to understand the bigger picture. :)
e5dcceb
to
867523f
Compare
When we run during clean phase, we would skip on this condition and then not rerun during build phase.
How about |
OK. |
And IsCrossTargetingBuild to mean that we're in the outer build. Inner build is non cross-targeting since it is one TFM. I think this is a fine way to go. |
LGTM once |
@AndyGerlicher Thanks and done. |
@AndyGerlicher @cdmihai @rainersigwald Thanks again! Can you also help me get this ported to xplat and published to a package that the cli can consume? |
I think this is how you get into xplat:
@jeffkl, does that look alright? |
For posterity: this change caused an error in an internal project that had a custom target defined as: <Target Name="ValidateReferences"
DependsOnTargets="
$(ResolveReferencesDependsOn);
ValidateExportsFilesExist;
ValidatePackageReferences;
ValidateBinplace"
AfterTargets="$(ResolveReferencesDependsOn)"> Note that it hooks after (any of) Clean depends on CleanReferencedProjects depends on PrepareProjectReferences depends on AssignProjectConfiguration. ValidateReferences has an AfterTargets for AssignProjectConfiguration, so ValidateReferences attempts to run, but first we have to run its DependsOnTargets, so we try to add them to the target stack, but when we consider PrepareProjectReferences, it’s already on the stack, so trying to add it would create a cycle, and we fail. The error was
This can be fixed by changing the custom target's hook: ValidateExportsFilesExist;
ValidatePackageReferences;
ValidateBinplace"
- AfterTargets="$(ResolveReferencesDependsOn)">
+ BeforeTargets="ResolveReferences">
<Error Text="@(ValidationError->'
%(Identity): %(Text)','')"
Condition="@(ValidationError) != '' and $(ValidateProjectSettings) == 'true'"/> |
This implements the portion of cross-targeting that we agreed must happen first in msbuild proper and as soon as possible to uncover any unforseen breaking impact on existing projects.