-
Notifications
You must be signed in to change notification settings - Fork 10.5k
[build-script] Add support for using isolated -impl actions. #2988
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] Add support for using isolated -impl actions. #2988
Conversation
1fda5b2
to
ea99469
Compare
@swift-ci please python lint |
@swift-ci please smoke test |
/cc @gribozavr @rintaro @karwa |
call_without_sleeping( | ||
[build_script_impl] + impl_args + [ | ||
"--only-execute", action_name], | ||
env=impl_env, echo=self.args.verbose_build) |
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.
Note that this mode drops echoing subcommands by default, it is too verbose until we finish killing the -impl
script.
- This change moves the top-level invocation driver loop into `build-script` and uses the `-impl` script to perform each individual action. Once landed and enabled, this will enable us to migrate the individual pieces of the `-impl` script into Python code in an incremental fashion. - This also introduces stub product definitions for each of the different projects we manage. - This works, but is disabled by default (`--no-legacy-impl`) because it severely impacts the performance of null builds (4x slower, currently) due to the `build-script-impl` parsing overhead. If only we had a JITing bash implementation...
ea99469
to
b1d56ea
Compare
@swift-ci please smoke test |
Continued from: #2988 (comment)
According to my own experience, difficult part for that is "dependency": FYI, Here's my outdated attempt from #2190: From an object-oriented perspective, I think, only @karwa As for
I agree with your concern. But, for example, swift_obj = products.Swift(
target=target,
# args
native_llvm_tools_path=args.native_llvm_tools_path,
native_clang_tools_path=args.native_clang_tools_path,
native_swift_tools_path=args.native_tools_swift_path,
build_type=args.swift_build_type,
enable_assertions=args.swift_enable_assertions,
...
... ) Do you have ideas? |
One possible way to manage that, and I'm not familiar enough with argparse to know how easy this is, but if we could get the highly product dependent arguments to simply be parsed into a more structured product-specific object (SwiftProductArgs, e.g.) that would at least be an improvement. Is it possible to get an argparse argument |
Like this? parser = argparse.ArgumentParser()
parser.add_argument('--swift-opt', dest="swift.opt")
args = parser.parse_args(['--swift-opt', 'foobar'])
assert args.swift.opt == 'foobar' It's possible if we use custom |
I don't think it's such a big problem. It's only the Swift project that really takes a lot of parameters. Many of them can be given reasonable defaults for the purpose of keeping the initialiser manageable. The build script would then parse the args and set the appropriate properties. Many of those arguments could also be folded - e.g. the native_{project}_tools_path arguments could be derived from a native HostSpecificConfiguration argument. Actually, in this case the native toolchain is only required for cross-compile builds, so we can leave it out of the initialiser and default the properties to None. In general, any build settings Swift gets from, e.g, LLVM, should come from an already-parsed LLVM object. Thats also easier to reason about and makes semantic sense. |
@swift-ci please test |
@swift-ci please smoke test |
I am going to go ahead and land this change, in the interest of continuing the SR-237 conversion. I'll continue to iterate on the feedback to simplify and cleanup the build-script, but I want to split that into separate PRs. |
I think the relationships between the products are simple enough that this is a good pragmatic approach, we have one structured object to hold all the product objects, and pass that to each product so that it can get connection information from that. |
I would say the opposite: our dependencies are so simple they can be passed manually. Especially if we split the build step in to tools/target libraries steps as was proposed for the 'toolchain-based build' thingy. |
By manually, I mean initialising the Swift product object with a configured LLVM object. (Sorry, GitHub doesn't have an edit button on mobile) |
I agree, I think the tradeoff just depends on how generic we can make the build-script in terms of products. I'm hoping that we can get rid of a lot of the per-product duplication, and if have a single config object helps that I think it would be a win. |
[pull] swiftwasm from main
What's in this pull request?
This adopts the feature in #2880 in
build-script
, and is part of SR-237.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.
build-script
and uses the
-impl
script to perform each individual action. Once landedand enabled, this will enable us to migrate the individual pieces of the
-impl
script into Python code in an incremental fashion.we manage.
--no-legacy-impl
) because itseverely impacts the performance of null builds (4x slower, currently) due to
the
build-script-impl
parsing overhead. If only we had a JITing bashimplementation...