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
On Darwin, allow XCTest to be missing if we're only building swift-testing tests. #7426
Merged
Conversation
This file contains 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
grynspan
added
bug
swift test
Changes impacting `swift test` tool
swift 6.0
Related to Swift 6.0 release branch
labels
Mar 25, 2024
…sting tests. 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.
grynspan
force-pushed
the
jgrynspan/125372431-remove-xctest-requirement
branch
from
March 25, 2024 23:32
4e0699f
to
a335fa6
Compare
@swift-ci please test |
briancroom
approved these changes
Mar 25, 2024
grynspan
added a commit
to apple/swift-testing
that referenced
this pull request
Mar 25, 2024
This PR removes some stray dependencies on XCTest that prevent building the testing library and its test target when XCTest is not available on Darwin. This can occur if the Xcode Command Line Tools are installed instead of the full IDE. 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. For more information about this change, see apple/swift-package-manager#7426 Resolves rdar://125371899.
2 tasks
MaxDesiatov
reviewed
Mar 26, 2024
MaxDesiatov
reviewed
Mar 26, 2024
MaxDesiatov
reviewed
Mar 26, 2024
MaxDesiatov
reviewed
Mar 26, 2024
Co-authored-by: Max Desiatov <[email protected]>
@swift-ci please test |
@swift-ci please test Windows |
MaxDesiatov
approved these changes
Mar 26, 2024
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks!
grynspan
added a commit
to apple/swift-testing
that referenced
this pull request
Mar 26, 2024
…316) This PR removes some stray dependencies on XCTest that prevent building the testing library and its test target when XCTest is not available on Darwin. This can occur if the Xcode Command Line Tools are installed instead of the full IDE. 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. For more information about this change, see apple/swift-package-manager#7426. That PR affects the Swift main-branch toolchain (Swift 6), not Swift 5.10 or earlier. Resolves rdar://125371899. ### Checklist: - [x] Code and documentation should follow the style of the [Style Guide](https://github.com/apple/swift-testing/blob/main/Documentation/StyleGuide.md). - [x] If public symbols are renamed or modified, DocC references should be updated.
grynspan
added a commit
that referenced
this pull request
Mar 28, 2024
…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.
grynspan
added a commit
that referenced
this pull request
Mar 28, 2024
…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.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
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.
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:
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.