-
Notifications
You must be signed in to change notification settings - Fork 82
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 support to stop on first failure to traversal SDK #186
Conversation
cc: @jeffkl |
I'm still wrapping my head around this, here's a question I have:
I'm mainly looking for a simpler implementation. |
Yeah, I wanted to give the option for customers to set Does that make sense? |
src/Traversal/Sdk/Sdk.targets
Outdated
@@ -114,11 +114,23 @@ | |||
DependsOnTargets="$(BuildDependsOn)" | |||
Condition=" '$(IsGraphBuild)' != 'true' " | |||
Returns="@(CollectedBuildOutput)"> | |||
|
|||
<ItemGroup> |
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.
Is this necessary, can't you just call AnyHaveMetadataValue
on @(ProjectReference) on line 125?
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.
We could, but then we wouldn't be honoring BuildInParallel
fallback property. Because we could do AnyHaveMetadataValue('BuildInParallel', 'true')
but then I realized that would be a more complicated implementation because if a project doesn't have metadata value then we need to honor BuildInParallel
.
Then for the other cases where we have more properties like CleanInParallel
... it gets more complicated, so I figured this was the simplest, to basically do the same as we do when dispatching to the MSBuild task.
@rainersigwald Can you have a look at this and see if you know a way to simplify the logic? |
Friendly ping 😃 -- this would be really helpful for dotnet/runtime repo. |
I agree that this feels very complicated for the benefit.
I'm not sure I understand the scenario here. If |
What I was trying to say was to not force customers to have to configure For example if I have:
I would like the SDK to just build the right nodes for me with StopOnFirstFailure when it makes sense because I set it in a global shared location to true. If we do it for each project evaluation or metadata then I will have to endup doing something like this:
and then that complexity will kick back on the users where they will need to calculate were can they StopOnFirstFailure without loosing build parallelism. Does that make sense? |
@rainersigwald does that make sense? |
Consider this issue as a concrete example: dotnet/runtime#38342 This morning I tried building runtime on a new WSL2 enlistment and I forgot to install the right version of cmake. The runtime build even correctly identified that cmake wasn't installed and bailed out of the native portion of our build early. Yet the build continued on to other sections of the build, those predictably failed because the first project failed. I ended up scratching my head for 15 minutes because the errors were non-sensical. Eventually @safern pointed out that the build had failed much earlier due to cmake missing and that was the root cause. If we don't take a feature like this how do we structure runtime to have sensible behavior here? |
I spoke with @rainersigwald and we decided that indeed the complex implementation of batching on all the metadata was not worth it as MSBuild already handles the case where We decided to just default @jeffkl @rainersigwald PTAL |
9a3b577
to
a9a99d9
Compare
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 think this is a lot cleaner and still covers the main goals:
- If you were building things sequentially, presumably that's because of implicit dependencies. So the new behavior is better.
- The only negative to setting StopOnFirstFailure + BuildInParallel is a message.
- No confusion about batching and ordering between projects that have/don't have the StopOnFirstFailure/BuildInParallel metadata.
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.
Looks good, thanks for the contribution!
And thanks to @rainersigwald for consulting on this.
Thank you guys for reviewing and the discussion! |
@jeffkl would you mind sharing the produced SDK version with this change whenever available, so I can update it in dotnet/runtime? |
Fresh out of the oven: https://www.nuget.org/packages/Microsoft.Build.Traversal/2.0.52 |
Thanks 😄 |
If you have 2 projects, let's say
A
andB
, whereB
depends fromA
and you build them sequentially (not in parallel), ifA
fails, thenB
shouldn't be built.We have cases like this in dotnet/runtime, where we have different partitions of the repo, like the runtime and libraries. Libraries build depends on the runtime build. For each partition we have a project that drives the build of that partition, and we have a "Driver" project which adds whatever partitions you're trying to build as projects to build using the Traversal SDK and we don't build them in parallel because they're dependent, so we need the ability of failing if any partition failed and stopping to get reasonable errors instead of errors due to the previous partition failing.
I still need to add tests for this, but wanted to get early feedback
cc: @rainersigwald
FYI: @ViktorHofer