Skip to content

Always build SwiftSyntax as a static library #323

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

Merged
merged 1 commit into from
Oct 13, 2021

Conversation

ahoppen
Copy link
Member

@ahoppen ahoppen commented Oct 6, 2021

Instead of including SwiftSyntax.dylib and SwiftSyntaxParser.dylib in the toolchain, make all tools that depend on SwiftSyntax link against it statically. This simplifies the way SwiftSyntax is built and slightly reduces the toolchain size, because we only include on copy of SwiftSyntax (statically linked into sk-stress-test) instead of two copies (SwiftSyntax.dylib and SwiftSyntaxParser.dylib).

rdar://83757810

@ahoppen ahoppen marked this pull request as draft October 7, 2021 09:51
@ahoppen ahoppen force-pushed the pr/build-swiftsyntax-statically branch from b465a05 to 200167a Compare October 7, 2021 09:52
@ahoppen
Copy link
Member Author

ahoppen commented Oct 7, 2021

Waiting for a toolchain build triggered in swiftlang/swift#37710 to check if/how much the toolchain size changes because of this change.

@ahoppen ahoppen force-pushed the pr/build-swiftsyntax-statically branch from 200167a to 9825393 Compare October 7, 2021 17:40
@ahoppen ahoppen changed the title WIP: Build SwiftSyntax statically for the toolchain Build SwiftSyntax statically for the toolchain Oct 11, 2021
@ahoppen
Copy link
Member Author

ahoppen commented Oct 11, 2021

The toolchain size seems to even decrease slightly with this change because before this PR we were essentially shipping two copies of SwiftSyntax as a dylib: Once as SwiftSyntax.dylib and once as SwiftSyntaxParser.dylib. The only user of the dylib in the toolchain appears to be sk-stress-test so if we are linking SwiftSyntax statically into that binary, we only need to include a single copy.

Instead of including `SwiftSyntax.dylib` and `SwiftSyntaxParser.dylib` in the toolchain, make all tools that depend on SwiftSyntax link against it statically. This simplifies the way SwiftSyntax is built and slightly reduces the toolchain size, because we only include on copy of SwiftSyntax (statically linked into `sk-stress-test`) instead of two copies (`SwiftSyntax.dylib` and `SwiftSyntaxParser.dylib`).

rdar://83757810
@ahoppen ahoppen force-pushed the pr/build-swiftsyntax-statically branch from 9825393 to 4dbd190 Compare October 11, 2021 15:30
@ahoppen ahoppen changed the title Build SwiftSyntax statically for the toolchain Always build SwiftSyntax statically Oct 11, 2021
@ahoppen
Copy link
Member Author

ahoppen commented Oct 11, 2021

swiftlang/swift#39682

@swift-ci Please test

@ahoppen ahoppen marked this pull request as ready for review October 11, 2021 15:32
@swift-ci
Copy link
Contributor

Build failed
Swift Test Linux Platform
Git Sha - 200167a

@swift-ci
Copy link
Contributor

Build failed
Swift Test OS X Platform
Git Sha - 200167a

@ahoppen ahoppen requested a review from akyrtzi October 11, 2021 18:51
@ahoppen ahoppen changed the title Always build SwiftSyntax statically Always build SwiftSyntax as a static library Oct 12, 2021
@ahoppen ahoppen merged commit 8bb2f8b into swiftlang:main Oct 13, 2021
@ahoppen ahoppen deleted the pr/build-swiftsyntax-statically branch October 13, 2021 19:24
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