-
Notifications
You must be signed in to change notification settings - Fork 10.5k
[build-script-impl] Add support for performing isolated actions. #2844
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
[build-script-impl] Add support for performing isolated actions. #2844
Conversation
/cc @gribozavr @rintaro @modocache By itself this doesn't make a lot of sense, but I think it is a decent approach to allow SR-237 to proceed more incrementally. I went with this approach because it avoids doing a massive refactor on the I have more work in flight to allow |
@swift-ci please smoke test |
👍 Yeah. Presumably, the very rough pseudo control flow would be:
Based on that, some products may call |
Yeah, exactly. Here is a hunk from - call_without_sleeping([build_script_impl] + build_script_impl_args)
+
+ # Perform the build process.
+ if True:
+ base_args = [build_script_impl] + build_script_impl_args
+ hosts = [args.host_target]
+ all_available_projects = [
+ 'cmark', 'llvm', 'swift', 'lldb', 'llbuild',
+ 'libdispatch', 'foundation', 'xctest', 'swiftpm']
+ for stage in ('build', 'test', 'install', 'package', 'lipo'):
+ # Stages where we enumerate each project.
+ if stage in ('build', 'test', 'install'):
+ for host in hosts:
+ for project in all_available_projects:
+ print("Performing {} for host {} and project {}".format(
+ stage, host, project))
+ call_without_sleeping(
+ base_args + ["--only-execute", "{}-{}-{}".format(
+ host, project, stage)])
+ continue
+ elif stage == 'package':
+ call_without_sleeping(
+ base_args + ["--only-execute", "{}-{}".format(
+ host, stage)])
+ else:
+ assert stage == 'lipo'
+ call_without_sleeping(
+ base_args + ["--only-execute", "{}-{}".format(
+ 'merged-hosts', stage)])
+ else:
+ call_without_sleeping([build_script_impl] + build_script_impl_args) It appears to work, but it's a significant performance regression in null build times (which is what lead to #2847) -- I am still working to see how much I can bring that down. Obviously we would want a cleaner actual implementation, and one thing we need to do first is over the options required to compute the full hosts list correctly. |
[[ "${SWIFT_RUN_BENCHMARK_TARGETS[@]}" ]] && | ||
! [[ "${SKIP_TEST_BENCHMARK}" ]]; then | ||
echo "Running Swift benchmarks for: ${SWIFT_RUN_BENCHMARK_TARGETS[@]}" | ||
# Don't echo anything if only executing an individual action. |
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.
Why not? This information is very useful in build logs.
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.
Indeed, but if left here it would be printed multiple times. My plan was to make the build-script
print this information when it switched over to --only-execute
.
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'm afraid the build-script does not have this information yet, it does not know the specific targets that will be executed. (It is important to know whether we will be doing short vs. validation vs. long tests for example, or which platforms the tests will be run for.) Did you plan to move this computation over as well?
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 have to eventually, so it seems like we might as well do that as part of switching the top-level loop over than come up with another mechanism to get this printed at the right time (I have a strong preference for not have unnecessary extra output).
This is a great approach to incrementally port the shell script! LGTM! |
@swift-ci Please test |
- This adds a new argument `--only-execute <name>` which can be used by `build-script` to invoke the `build-script-impl` to perform each different action, while moving the high-level operation loop into the `build-script` itself. This should make incremental refactoring of the individual actions into `build-script` easier. - This is part of SR-237.
fb50bba
to
1a694dc
Compare
Pushed updated version with review feedback. @swift-ci please test and merge |
# | ||
# Check if the there are any actions to execute for this host and phase (i.e., | ||
# "build", "test", or "install") | ||
function should_execute_host_actions_for_phase() { |
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.
Thank you for moving this into a function! The old logic seemed simple, but it turned out to be somehow confusing for me. With a function it is much more clear what is happening.
What's in this pull request?
This adds support to
build-script-impl
for allowing individual "actions" to be performed. This allows for increased testing of the script, and for the controlling script (build-script
) to manage the top-level loop for what actions need to be performed (by executing the-impl
script multiple times).This is intended to help with the refactoring work in SR-237, because it allows for the script to be in a more piecemeal fashion without requiring everything be migrated out to the Python code first.
Before merging this pull request to apple/swift repository:
Triggering Swift CI
The swift-ci is triggered by writing a comment on this PR addressed to the GitHub user @swift-ci. Different tests will run depending on the specific comment that you use. The currently available comments are:
Smoke Testing
Validation Testing
Lint Testing
Note: Only members of the Apple organization can trigger swift-ci.
--only-execute <name>
which can be used bybuild-script
to invoke thebuild-script-impl
to perform each differentaction, while moving the high-level operation loop into the
build-script
itself. This should make incremental refactoring of the individual actions
into
build-script
easier.