Skip to content

Enable cross-import overlays in test targets. #8158

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 3 commits into from
Dec 10, 2024

Conversation

grynspan
Copy link
Contributor

@grynspan grynspan commented Dec 5, 2024

This PR enables cross-import overlays when building test targets. Swift Testing cannot link to most modules because it would/could introduce circular dependencies that prevent those modules from being tested using Swift Testing. However, we need to introduce some API that uses types from Foundation and other modules, which means we need to use the cross-import overlays feature supported by the compiler.

Cross-import overlays haven't been through Swift Evolution, so we don't want to enable the feature in the general case. We talked with @beccadax who agreed that because our use case is relatively unique, enabling these overlays just for test targets was probably the right approach until/unless the feature can be fully reviewed and supported.

We're also looking at consulting available information (the dependency scanner) to determine if there is any dependency on Swift Testing. If there isn't one, we don't need this flag. That's a "future direction" for this PR at any rate.

@grynspan grynspan added the swift test Changes impacting `swift test` tool label Dec 5, 2024
@grynspan grynspan self-assigned this Dec 5, 2024
@grynspan
Copy link
Contributor Author

grynspan commented Dec 5, 2024

@swift-ci test

@grynspan
Copy link
Contributor Author

grynspan commented Dec 5, 2024

@swift-ci test

@grynspan
Copy link
Contributor Author

grynspan commented Dec 6, 2024

@swift-ci test

@grynspan
Copy link
Contributor Author

grynspan commented Dec 6, 2024

@swift-ci test Windows

@grynspan grynspan marked this pull request as ready for review December 6, 2024 18:21
@grynspan grynspan added enhancement swift build Changes impacting `swift build` labels Dec 6, 2024
@grynspan
Copy link
Contributor Author

grynspan commented Dec 6, 2024

Need to do a full toolchain build before merging.

@grynspan grynspan merged commit d2a9630 into main Dec 10, 2024
5 checks passed
@grynspan grynspan deleted the jgrynspan/enable-cross-import-overlays-in-test-targets branch December 10, 2024 15:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement swift build Changes impacting `swift build` swift test Changes impacting `swift test` tool
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants