-
Notifications
You must be signed in to change notification settings - Fork 10.5k
Move swiftpm to swift_build_support infra #27636
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
This means we can rip swiftpm out of build-script-impl but I need to wait until @ahoppen migrates SwiftPM build-script-impl dependents. |
@swift-ci smoke test |
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.
Thanks for tackling this.
Some comments based on an initial review inline.
|
||
release = '' if args.build_variant == 'Debug' else '--release' | ||
|
||
swiftc = os.path.join(toolchain_path, "usr", "bin", "swiftc") |
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.
IIUC the idea is that you only pass the toolchain directory to SwiftPM's build script and it will find swiftc
in there on its own. See #27580 (review)
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 agree but I'll do that later since SwiftPM's bootstrap script is a hot mess (which I am reworking with the new Swift support in CMake). It'll be much easier to do this in the new script vs try to fight the old one.
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.
Sounds good.
run_build_script_helper('build', host_target, self, self.args) | ||
|
||
def test(self, host_target): | ||
run_build_script_helper('test', host_target, self, self.args) |
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.
You should not run the tests unless your test flag is passed. See
https://github.com/apple/swift/pull/27580/files#diff-bac1aa9ca5d00ef87144461e6bc764edR77
(this should actually be changed that the driver takes care of checking the flag)
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.
huh, ok.
run_build_script_helper('test', host_target, self, self.args) | ||
|
||
def install(self, host_target): | ||
run_build_script_helper('install', host_target, self, self.args) |
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.
Same as above. Check that your install flag is set.
if platform.system() == 'Darwin': | ||
# The prefix is an absolute path, so concatenate without os.path. | ||
toolchain_path += \ | ||
product.targets.darwin_toolchain_prefix(args.install_prefix) |
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.
Not part of this PR but: We should factor this building of the toolchain path out to the driver and not copy it into every PR. I’ll take care of it
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.
yeah
product.targets.darwin_toolchain_prefix(args.install_prefix) | ||
|
||
swiftc = os.path.join(toolchain_path, "usr", "bin", "swiftc") | ||
sbt = os.path.join(toolchain_path, "usr", "bin", "swift-build-tool") |
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.
Same as above. SwiftPM’s build script should find the swift-build-tool
We should have done this ages ago. This will allow cleaning up most of the hacks in SwiftPM's build script.
@swift-ci smoke test |
Is this how we would integrate swift-driver into |
@DougGregor Yeah, it would be a good start to start building it after swiftpm. We'll need to think of an alternative ways once we actually want to build it before swiftpm. |
We should have done this ages ago. This will allow cleaning up most of
the hacks in SwiftPM's build script.
Dependencies: