Skip to content

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

Closed
wants to merge 1 commit into from

Conversation

aciidgh
Copy link
Contributor

@aciidgh aciidgh commented Oct 12, 2019

We should have done this ages ago. This will allow cleaning up most of
the hacks in SwiftPM's build script.

Dependencies:

@aciidgh
Copy link
Contributor Author

aciidgh commented Oct 12, 2019

This means we can rip swiftpm out of build-script-impl but I need to wait until @ahoppen migrates SwiftPM build-script-impl dependents.

@aciidgh
Copy link
Contributor Author

aciidgh commented Oct 12, 2019

@swift-ci smoke test

Copy link
Member

@ahoppen ahoppen left a 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")
Copy link
Member

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)

Copy link
Contributor Author

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.

Copy link
Member

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)
Copy link
Member

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)

Copy link
Contributor Author

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)
Copy link
Member

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)
Copy link
Member

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

Copy link
Contributor Author

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")
Copy link
Member

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.
@aciidgh
Copy link
Contributor Author

aciidgh commented Oct 12, 2019

@swift-ci smoke test

@DougGregor
Copy link
Member

Is this how we would integrate swift-driver into build-script?

@aciidgh
Copy link
Contributor Author

aciidgh commented Oct 12, 2019

@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.

@aciidgh aciidgh closed this Nov 2, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants