Skip to content
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

swift test builds dependencies with -enable-testing #8344

Open
ahoppen opened this issue Mar 8, 2025 · 3 comments
Open

swift test builds dependencies with -enable-testing #8344

ahoppen opened this issue Mar 8, 2025 · 3 comments

Comments

@ahoppen
Copy link
Member

ahoppen commented Mar 8, 2025

When running swift test without -disable-testable-imports, we need to build the modules in the current package with -enable-testing but there is no need to build dependencies with -enable-testing because they won’t be tested.

Because of this, we can’t add swift-foundation to the unified build (--multiroot-data-file) on Swift CI. swift-foundation requires @testable imports but the other packages in the multi root do no. We should still be able to share the build of eg. swift-syntax though.

ahoppen added a commit to ahoppen/swift that referenced this issue Mar 8, 2025
We can’t add the tests to the general unified build because they use testable imports and building a package with testable imports also re-builds all of its dependencies with testable imports (swiftlang/swift-package-manager#8344) and is thus incompatible with the other package’s unified build. But we should still be able to share build products between corelibs-foundation tests and swift-foundation-tests.
@rauhul
Copy link
Member

rauhul commented Mar 8, 2025

IMO we should change swiftpm to never build any dependencies with "-enable-testing". It does not make sense to be able to @testable import a module from a different package.

@ahoppen
Copy link
Member Author

ahoppen commented Mar 8, 2025

I absolutely agree. Just wanted to give context why I care.

ahoppen added a commit to ahoppen/swift that referenced this issue Mar 8, 2025
We can’t add the tests to the general unified build because they use testable imports and building a package with testable imports also re-builds all of its dependencies with testable imports (swiftlang/swift-package-manager#8344) and is thus incompatible with the other package’s unified build. But we should still be able to share build products between corelibs-foundation tests and swift-foundation-tests.
ahoppen added a commit to ahoppen/swift that referenced this issue Mar 9, 2025
We can’t add the tests to the general unified build because they use testable imports and building a package with testable imports also re-builds all of its dependencies with testable imports (swiftlang/swift-package-manager#8344) and is thus incompatible with the other package’s unified build. But we should still be able to share build products between corelibs-foundation tests and swift-foundation-tests.
ahoppen added a commit to ahoppen/swift that referenced this issue Mar 9, 2025
We can’t add the tests to the general unified build because they use testable imports and building a package with testable imports also re-builds all of its dependencies with testable imports (swiftlang/swift-package-manager#8344) and is thus incompatible with the other package’s unified build. But we should still be able to share build products between corelibs-foundation tests and swift-foundation-tests.
ahoppen added a commit to ahoppen/swift that referenced this issue Mar 9, 2025
We can’t add the tests to the general unified build because they use testable imports and building a package with testable imports also re-builds all of its dependencies with testable imports (swiftlang/swift-package-manager#8344) and is thus incompatible with the other package’s unified build. But we should still be able to share build products between corelibs-foundation tests and swift-foundation-tests.
@jakepetroules
Copy link
Contributor

Might be able to roll this into the SE-0455 implementation.

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

No branches or pull requests

3 participants