-
Notifications
You must be signed in to change notification settings - Fork 1.4k
refactor how plugins call the build system when using the CLI #4185
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
Conversation
motivation: consolidate use of build operation construction which is important for cancellation support changes: * use the general purpose function to create a build operation * small refactoring of how build plan is extracted after the build is complete
@abertelrud this is a breakout PR for a cleanup required by #4173 |
observabilityScope: self.swiftTool.observabilityScope | ||
customBuildParameters: buildParameters, | ||
customOutputStream: outputStream, | ||
customLogLevel: logLevel |
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 the key change - basically use the generic swiftTool.createBuildOperation which will record things with the cancellation utility which is less error prone than doing it manually
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 great.
|
||
// Get the build plan used | ||
guard let buildPlan = buildOperation.buildPlan else { | ||
throw InternalError("invalid state, buildPlan is undefined") |
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.
the above is just a small cleanup
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 better than the !
. Thanks for cleaning it up! In practice, should never happen but still.
return false | ||
} | ||
} | ||
} |
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 can also use observabilityScope.trap instead of this, but this preserved the previous behavior exactly
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 like there was only one call site for this. Do you think there will be more, or would it be better to keep this do/catch at the one callsite?
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.
normally you want to do something with the error, but in this case the code only seems to care about the end result.
@swift-ci please smoke test |
motivation: consolidate use of build operation construction which is important for cancellation support
changes: