[6.0] On Darwin, allow XCTest to be missing if we're only building swift-testing tests.#7430
Merged
grynspan merged 1 commit intorelease/6.0from Mar 28, 2024
Conversation
…sting tests. (#7426) This PR removes the constraint on Darwin that XCTest.framework must be present in order to build tests using swift-testing. On Darwin, XCTest is included as a framework inside Xcode, but if a developer installs the Xcode Command Line Tools instead of the full IDE, XCTest is not included. They then get a diagnostic of the form: > error: XCTest not available: terminated(1): /usr/bin/xcrun --sdk macosx --show-sdk-platform-path output: > xcrun: error: unable to lookup item 'PlatformPath' from command line tools installation > xcrun: error: unable to lookup item 'PlatformPath' in SDK '/Library/Developer/CommandLineTools/SDKs/MacOSX14.0.sdk' Which is a poor experience if they aren't even using XCTest. This change, as a (positive) side effect, suppresses the same diagnostic when running commands that are not usually dependent on the presence of XCTest such as `swift build`. Note that swift-corelibs-xctest is not supported on Darwin, so installing the Xcode Command Line Tools and adding an explicit dependency on swift-corelibs-xctest will not produce a functional test target bundle. Supporting swift-corelibs-xctest on Darwin is a potential future direction. Automated testing for this change is difficult because it relies on a build environment that is not supported in CI (namely the presence of the CL tools but not Xcode nor XCTest.framework.) I have manually tested the change against swift-testing's own test target. A separate PR will be necessary in swift-testing to remove some remaining XCTest dependencies. Those changes are not covered by this PR. Resolves rdar://125372431.
Contributor
Author
|
@swift-ci please test |
bnbarham
approved these changes
Mar 28, 2024
Contributor
Author
|
@swift-ci please test Windows |
briancroom
approved these changes
Mar 28, 2024
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Explanation: This PR removes the constraint on Darwin that XCTest.framework must be present in order to build tests using swift-testing. On Darwin, XCTest is included as a framework inside Xcode, but if a developer installs the Xcode Command Line Tools instead of the full IDE, XCTest is not included.
Scope: Improves swift-testing functionality by allowing developers to build test targets that use swift-testing without an implicit XCTest dependency. No source- or language-breaking changes.
Issue: N/A
Original PR: #7426
Risk: Low; only impacts developers using Xcode CLTools on Darwin.
Testing: At-desk testing as well as CI runs. It is not possible to test the environment where the issue manifests in our CI because it would need to be configured with CLTools but no IDE.
Reviewer: @briancroom @MaxDesiatov