Skip to content

Add option to build a single dynamic library containing all swift-syntax modules #2879

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 12, 2024

Conversation

ahoppen
Copy link
Member

@ahoppen ahoppen commented Oct 10, 2024

My previous approach of building each product as a dynamic library did not work because SwiftPM includes symbols from all dependencies in each .dll. Because of this, we ended up with duplicate symbols for each type in eg. SwiftSyntax at runtime.

Build a single .dll with all required products instead to avoid that issue.

To enforce that this is an internal target that should not be relied upon, only enable it when an environment variable is set.

@ahoppen ahoppen requested a review from rintaro October 10, 2024 16:45
@ahoppen ahoppen requested a review from bnbarham as a code owner October 10, 2024 16:45
@ahoppen
Copy link
Member Author

ahoppen commented Oct 10, 2024

@swift-ci Please test

@rintaro
Copy link
Member

rintaro commented Oct 10, 2024

I wonder how autolink works in this case. I.e. I assume SwiftParser.swiftmodule has a single module link name. But for example, SwiftParser belongs to 2 products. Does import SwiftParser causes -lSwiftParser or -l_SwiftSyntaxDynamic?

…tax modules

My previous approach of building each product as a dynamic library did not work because SwiftPM includes symbols from all dependencies in each `.dll`. Because of this, we ended up with duplicate symbols for each type in eg. SwiftSyntax at runtime.

Build a single `.dll` with all required products instead to avoid that issue.

To enforce that this is an internal target that should not be relied upon, only enable it when an environment variable is set.
@ahoppen
Copy link
Member Author

ahoppen commented Oct 10, 2024

@swift-ci Please test

1 similar comment
@ahoppen
Copy link
Member Author

ahoppen commented Oct 11, 2024

@swift-ci Please test

@ahoppen ahoppen merged commit 27e74a2 into swiftlang:main Oct 12, 2024
3 checks passed
ahoppen added a commit to ahoppen/swift-package-manager that referenced this pull request Oct 14, 2024
When `SWIFTSYNTAX_BUILD_DYNAMIC_LIBRARY` is specified, change swift-syntax dependencies to depend on a single `_SwiftSyntaxDynamic` product instead of separate products for each module.

This allows us to build SourceKit-LSP on Windows using SwiftPM without exceeding the maximum symbol limit and thus run SourceKit-LSP tests on Windows.

See swiftlang/sourcekit-lsp#1754 and swiftlang/swift-syntax#2879.
ahoppen added a commit to ahoppen/swift-format that referenced this pull request Oct 14, 2024
When `SWIFTSYNTAX_BUILD_DYNAMIC_LIBRARY` is specified, change swift-syntax dependencies to depend on a single `_SwiftSyntaxDynamic` product instead of separate products for each module.

This allows us to build SourceKit-LSP on Windows using SwiftPM without exceeding the maximum symbol limit and thus run SourceKit-LSP tests on Windows.

See swiftlang/sourcekit-lsp#1754 and swiftlang/swift-syntax#2879.
ahoppen added a commit to ahoppen/swift-format that referenced this pull request Oct 14, 2024
When `SWIFTSYNTAX_BUILD_DYNAMIC_LIBRARY` is specified, change swift-syntax dependencies to depend on a single `_SwiftSyntaxDynamic` product instead of separate products for each module.

This allows us to build SourceKit-LSP on Windows using SwiftPM without exceeding the maximum symbol limit and thus run SourceKit-LSP tests on Windows.

See swiftlang/sourcekit-lsp#1754 and swiftlang/swift-syntax#2879.
ahoppen added a commit to ahoppen/swift-format that referenced this pull request Oct 14, 2024
When `SWIFTSYNTAX_BUILD_DYNAMIC_LIBRARY` is specified, change swift-syntax dependencies to depend on a single `_SwiftSyntaxDynamic` product instead of separate products for each module.

This allows us to build SourceKit-LSP on Windows using SwiftPM without exceeding the maximum symbol limit and thus run SourceKit-LSP tests on Windows.

See swiftlang/sourcekit-lsp#1754 and swiftlang/swift-syntax#2879.
ahoppen added a commit to ahoppen/swift-package-manager that referenced this pull request Oct 14, 2024
When `SWIFTSYNTAX_BUILD_DYNAMIC_LIBRARY` is specified, change swift-syntax dependencies to depend on a single `_SwiftSyntaxDynamic` product instead of separate products for each module.

This allows us to build SourceKit-LSP on Windows using SwiftPM without exceeding the maximum symbol limit and thus run SourceKit-LSP tests on Windows.

See swiftlang/sourcekit-lsp#1754 and swiftlang/swift-syntax#2879.
ahoppen added a commit to ahoppen/swift-package-manager that referenced this pull request Oct 14, 2024
When `SWIFTSYNTAX_BUILD_DYNAMIC_LIBRARY` is specified, change swift-syntax dependencies to depend on a single `_SwiftSyntaxDynamic` product instead of separate products for each module.

This allows us to build SourceKit-LSP on Windows using SwiftPM without exceeding the maximum symbol limit and thus run SourceKit-LSP tests on Windows.

See swiftlang/sourcekit-lsp#1754 and swiftlang/swift-syntax#2879.
ahoppen added a commit to swiftlang/swift-package-manager that referenced this pull request Oct 15, 2024
When `SWIFTSYNTAX_BUILD_DYNAMIC_LIBRARY` is specified, change
swift-syntax dependencies to depend on a single `_SwiftSyntaxDynamic`
product instead of separate products for each module.

This allows us to build SourceKit-LSP on Windows using SwiftPM without
exceeding the maximum symbol limit and thus run SourceKit-LSP tests on
Windows.

See swiftlang/sourcekit-lsp#1754 and
swiftlang/swift-syntax#2879.
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.

2 participants