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

On Darwin, allow XCTest to be missing if we're only building swift-testing tests. #7426

Merged
merged 3 commits into from Mar 26, 2024

Commits on Mar 25, 2024

  1. On Darwin, allow XCTest to be missing if we're only building swift-te…

    …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 committed Mar 25, 2024
    Copy the full SHA
    a335fa6 View commit details
    Browse the repository at this point in the history

Commits on Mar 26, 2024

  1. Apply suggestions from code review

    Co-authored-by: Max Desiatov <[email protected]>
    grynspan and MaxDesiatov committed Mar 26, 2024
    Copy the full SHA
    0cdf034 View commit details
    Browse the repository at this point in the history
  2. Copy the full SHA
    158562f View commit details
    Browse the repository at this point in the history