[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. |
utils/build-script-impl
Outdated
There was a problem hiding this comment.
Why not? This information is very useful in build logs.
There was a problem hiding this comment.
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.
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.
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.
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-implfor 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-implscript 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-scriptto invoke thebuild-script-implto perform each differentaction, while moving the high-level operation loop into the
build-scriptitself. This should make incremental refactoring of the individual actions
into
build-scripteasier.