Skip to content

Default interop mode to "complete" for swift-tools-version >= 6.4#9857

Merged
jerryjrchen merged 4 commits intoswiftlang:mainfrom
jerryjrchen:interop-swift-tools-version
Apr 4, 2026
Merged

Default interop mode to "complete" for swift-tools-version >= 6.4#9857
jerryjrchen merged 4 commits intoswiftlang:mainfrom
jerryjrchen:interop-swift-tools-version

Conversation

@jerryjrchen
Copy link
Copy Markdown
Contributor

@jerryjrchen jerryjrchen commented Mar 26, 2026

Set environment variable SWIFT_TESTING_XCTEST_INTEROP_MODE=complete at runtime if the user has not already provided an override.

More details in the evolution proposal: https://github.com/swiftlang/swift-evolution/blob/main/proposals/testing/0021-targeted-interoperability-swift-testing-and-xctest.md

Motivation:

This opts in new projects (and existing projects that bump tools version) to the complete interop mode.

Modifications:

  • Update constructTestEnvironment to take in a desired interop mode

  • Only set interop mode if the user hasn't already provided an override

  • Tools version prior to 6.4 doesn't modify default interop mode

  • Testing: e2e testing for the different scenarios

Result:

Note we don't bother retrieving interop mode for getTestSuites since it's not relevant there.

Resolves rdar://173410320

@jerryjrchen jerryjrchen force-pushed the interop-swift-tools-version branch from 61a5c3a to 48110a4 Compare March 26, 2026 21:51
packages: root.packages,
observabilityScope: self.observabilityScope
)
return rootManifests.values.first.map { $0.toolsVersion }
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What if there is more than one root package?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm, it seems to me that constructTestEnvironment gets all the test products without grouping by package. Ideally (?) we could go group those together by package and figure out the tools version for each so we run each package with the appropriate default interop mode. Seems like a lot of effort and code restructuring for like not that much reward to me though.

If the multiple root packages case is rare, I think a "good enough" fallback behaviour would just take the lowest toolsVersion out of all the packages. Does that sound reasonable?

@jerryjrchen jerryjrchen requested a review from dschaefer2 March 27, 2026 20:18
@jerryjrchen
Copy link
Copy Markdown
Contributor Author

@swift-ci Please test

@jerryjrchen jerryjrchen enabled auto-merge (squash) April 1, 2026 00:11
@jerryjrchen
Copy link
Copy Markdown
Contributor Author

@swift-ci Please test

@jerryjrchen
Copy link
Copy Markdown
Contributor Author

@swift-ci Please test Windows

Set environment variable SWIFT_TESTING_XCTEST_INTEROP_MODE=complete at
runtime if the user has not already provided an override.

Note we don't bother retrieving interop mode for getTestSuites since
it's not relevant there.

* Only set interop mode if the user hasn't already provided an override

* Tools version prior to 6.4 doesn't modify default interop mode

* Testing: e2e testing for the different scenarios

Resolves rdar://173410320
@jerryjrchen jerryjrchen force-pushed the interop-swift-tools-version branch from c49bb55 to c992621 Compare April 2, 2026 22:50
@jerryjrchen
Copy link
Copy Markdown
Contributor Author

@swift-ci Please test

@jerryjrchen jerryjrchen disabled auto-merge April 2, 2026 23:19
@jerryjrchen
Copy link
Copy Markdown
Contributor Author

@swift-ci Please test

@jerryjrchen
Copy link
Copy Markdown
Contributor Author

@swift-ci Please test Windows

@jerryjrchen jerryjrchen merged commit b47a2a5 into swiftlang:main Apr 4, 2026
114 of 115 checks passed
@jerryjrchen jerryjrchen deleted the interop-swift-tools-version branch April 4, 2026 00:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement swift test Changes impacting `swift test` tool

Projects

Development

Successfully merging this pull request may close these issues.

4 participants