947947if [[ ! " ${SKIP_BUILD_SWIFTPM} " ]] ; then
948948 PRODUCTS=(" ${PRODUCTS[@]} " swiftpm)
949949fi
950- if [[ ! " ${SKIP_BUILD_XCTEST} " ]] ; then
951- PRODUCTS=(" ${PRODUCTS[@]} " xctest)
952- fi
953950if [[ ! " ${SKIP_BUILD_LIBDISPATCH} " ]] ; then
954951 PRODUCTS=(" ${PRODUCTS[@]} " libdispatch)
955952fi
953+ # XCTest has a dependency on Foundation, so Foundation must be added to the
954+ # list of build products first.
956955if [[ ! " ${SKIP_BUILD_FOUNDATION} " ]] ; then
957956 PRODUCTS=(" ${PRODUCTS[@]} " foundation)
958957fi
958+ if [[ ! " ${SKIP_BUILD_XCTEST} " ]] ; then
959+ PRODUCTS=(" ${PRODUCTS[@]} " xctest)
960+ fi
959961
960962SWIFT_STDLIB_TARGETS=()
961963SWIFT_BENCHMARK_TARGETS=()
@@ -1343,7 +1345,8 @@ function set_swiftpm_bootstrap_command() {
13431345
13441346 SWIFTC_BIN=" $( build_directory_bin ${deployment_target} swift) /swiftc"
13451347 LLBUILD_BIN=" $( build_directory_bin ${deployment_target} llbuild) /swift-build-tool"
1346- if [[ ! " ${SKIP_BUILD_XCTEST} " ]] ; then
1348+ if [[ ! " ${SKIP_BUILD_FOUNDATION} " && ! " ${SKIP_BUILD_XCTEST} " ]] ; then
1349+ FOUNDATION_BUILD_DIR=$( build_directory ${deployment_target} foundation)
13471350 XCTEST_BUILD_DIR=$( build_directory ${deployment_target} xctest)
13481351 fi
13491352 if [ ! -e " ${LLBUILD_BIN} " ]; then
@@ -1357,8 +1360,8 @@ function set_swiftpm_bootstrap_command() {
13571360 swiftpm_bootstrap_command=(" ${swiftpm_bootstrap_command[@]} " --swiftc=" ${SWIFTC_BIN} " )
13581361 swiftpm_bootstrap_command=(" ${swiftpm_bootstrap_command[@]} " --sbt=" ${LLBUILD_BIN} " )
13591362 swiftpm_bootstrap_command=(" ${swiftpm_bootstrap_command[@]} " --build=" ${build_dir} " )
1360- if [[ ! " ${SKIP_BUILD_XCTEST} " ]] ; then
1361- swiftpm_bootstrap_command=(" ${swiftpm_bootstrap_command[@]} " --xctest=" ${XCTEST_BUILD_DIR} " )
1363+ if [[ ! " ${SKIP_BUILD_FOUNDATION} " && ! " ${ SKIP_BUILD_XCTEST}" ]] ; then
1364+ swiftpm_bootstrap_command=(" ${swiftpm_bootstrap_command[@]} " --foundation= " ${FOUNDATION_BUILD_DIR} /Foundation " -- xctest=" ${XCTEST_BUILD_DIR} " )
13621365 fi
13631366}
13641367
@@ -1859,7 +1862,7 @@ for deployment_target in "${HOST_TARGET}" "${CROSS_TOOLS_DEPLOYMENT_TARGETS[@]}"
18591862 if [[ " $( uname -s) " == " Darwin" ]] ; then
18601863 set -x
18611864 xcodebuild \
1862- -project " ${XCTEST_SOURCE_DIR} " /XCTest.xcodeproj \
1865+ -workspace " ${XCTEST_SOURCE_DIR} " /XCTest.xcworkspace \
18631866 -scheme SwiftXCTest \
18641867 SKIP_INSTALL=NO \
18651868 DEPLOYMENT_LOCATION=YES \
@@ -1868,20 +1871,24 @@ for deployment_target in "${HOST_TARGET}" "${CROSS_TOOLS_DEPLOYMENT_TARGETS[@]}"
18681871 { set +x; } 2> /dev/null
18691872 else
18701873 SWIFTC_BIN=" $( build_directory_bin ${deployment_target} swift) /swiftc"
1874+ FOUNDATION_BUILD_DIR=$( build_directory ${deployment_target} foundation)
18711875 set -x
18721876 # FIXME: Use XCTEST_BUILD_TYPE (which is never properly
18731877 # set) to build either --debug or --release.
18741878 " ${XCTEST_SOURCE_DIR} " /build_script.py \
18751879 --swiftc=" ${SWIFTC_BIN} " \
1876- --build-dir=" ${XCTEST_BUILD_DIR} "
1880+ --build-dir=" ${XCTEST_BUILD_DIR} " \
1881+ --foundation-build-dir=" ${FOUNDATION_BUILD_DIR} /Foundation"
18771882 { set +x; } 2> /dev/null
18781883 fi
18791884
18801885 # XCTest builds itself and doesn't rely on cmake
18811886 continue
18821887 ;;
18831888 foundation)
1884- # the configuration script requires knowing about XCTest's location for building and running the tests
1889+ # The configuration script requires knowing about XCTest's
1890+ # location for building and running the tests. Note that XCTest
1891+ # is not yet built at this point.
18851892 XCTEST_BUILD_DIR=$( build_directory ${deployment_target} xctest)
18861893 SWIFTC_BIN=" $( build_directory_bin ${deployment_target} swift) /swiftc"
18871894 SWIFT_BIN=" $( build_directory_bin ${deployment_target} swift) /swift"
@@ -2122,15 +2129,17 @@ for deployment_target in "${STDLIB_DEPLOYMENT_TARGETS[@]}"; do
21222129 if [[ " $( uname -s) " == " Darwin" ]] ; then
21232130 set -x
21242131 xcodebuild \
2125- -project " ${XCTEST_SOURCE_DIR} " /XCTest.xcodeproj \
2132+ -workspace " ${XCTEST_SOURCE_DIR} " /XCTest.xcworkspace \
21262133 -scheme SwiftXCTestFunctionalTests
21272134 { set +x; } 2> /dev/null
21282135 else
21292136 SWIFTC_BIN=" $( build_directory_bin ${deployment_target} swift) /swiftc"
2137+ FOUNDATION_BUILD_DIR=$( build_directory ${deployment_target} foundation)
21302138 XCTEST_BUILD_DIR=$( build_directory ${deployment_target} xctest)
21312139 set -x
21322140 " ${XCTEST_SOURCE_DIR} " /build_script.py test \
21332141 --swiftc=" ${SWIFTC_BIN} " \
2142+ --foundation-build-dir=" ${FOUNDATION_BUILD_DIR} /Foundation" \
21342143 " ${XCTEST_BUILD_DIR} "
21352144 { set +x; } 2> /dev/null
21362145 fi
0 commit comments