@@ -837,6 +837,15 @@ function cmake_needs_to_specify_standard_computed_defaults() {
837
837
fi
838
838
}
839
839
840
+ function copy_swift_stdlib_tool_substitute() {
841
+ if [ ! -f " $1 " ] ; then
842
+ echo " --- Copy swift-stdlib-tool ---"
843
+ set -x
844
+ cp " ${SWIFT_SOURCE_DIR} /utils/swift-stdlib-tool-substitute" " $1 "
845
+ { set +x; } 2> /dev/null
846
+ fi
847
+ }
848
+
840
849
# A list of deployment targets to cross-compile the Swift host tools for.
841
850
# We can't run the resulting binaries on the build machine.
842
851
CROSS_TOOLS_DEPLOYMENT_TARGETS=()
@@ -1931,16 +1940,23 @@ for deployment_target in "${HOST_TARGET}" "${CROSS_TOOLS_DEPLOYMENT_TARGETS[@]}"
1931
1940
SWIFTC_BIN=" $( build_directory_bin ${deployment_target} swift) /swiftc"
1932
1941
XCTEST_BUILD_DIR=$( build_directory ${deployment_target} xctest)
1933
1942
if [[ " $( uname -s) " == " Darwin" ]] ; then
1943
+ # xcodebuild requires swift-stdlib-tool to build a Swift
1944
+ # framework. This is normally present when building XCTest
1945
+ # via a packaged .xctoolchain, but here we are using the
1946
+ # swiftc that was just built--no toolchain exists yet. As a
1947
+ # result, we must copy swift-stdlib-tool ourselves.
1948
+ copy_swift_stdlib_tool_substitute " $( build_directory_bin ${deployment_target} swift) /swift-stdlib-tool"
1949
+
1950
+ # The Linux build places build products in the
1951
+ # XCTEST_BUILD_DIR. This, and installation of XCTest in
1952
+ # general, is not supported on OS X.
1934
1953
set -x
1935
1954
xcodebuild \
1936
1955
-workspace " ${XCTEST_SOURCE_DIR} " /XCTest.xcworkspace \
1937
1956
-scheme SwiftXCTest \
1938
1957
SWIFT_EXEC=" ${SWIFTC_BIN} " \
1939
1958
SWIFT_LINK_OBJC_RUNTIME=YES \
1940
- SKIP_INSTALL=NO \
1941
- DEPLOYMENT_LOCATION=YES \
1942
- DSTROOT=" ${XCTEST_BUILD_DIR} " \
1943
- INSTALL_PATH=" /"
1959
+ DSTROOT=" ${XCTEST_BUILD_DIR} "
1944
1960
{ set +x; } 2> /dev/null
1945
1961
else
1946
1962
FOUNDATION_BUILD_DIR=$( build_directory ${deployment_target} foundation)
@@ -2529,10 +2545,7 @@ if [[ "${INSTALLABLE_PACKAGE}" ]] ; then
2529
2545
echo " --- Creating installable package ---"
2530
2546
echo " -- Package file: ${INSTALLABLE_PACKAGE} --"
2531
2547
if [[ " $( uname -s) " == " Darwin" ]] ; then
2532
- if [ ! -f " ${INSTALL_DESTDIR} /${INSTALL_PREFIX} /bin/swift-stdlib-tool" ] ; then
2533
- echo " --- Copy swift-stdlib-tool ---"
2534
- cp " ${SWIFT_SOURCE_DIR} /utils/swift-stdlib-tool-substitute" " ${INSTALL_DESTDIR} /${INSTALL_PREFIX} /bin/swift-stdlib-tool"
2535
- fi
2548
+ copy_swift_stdlib_tool_substitute " ${INSTALL_DESTDIR} /${INSTALL_PREFIX} /bin/swift-stdlib-tool"
2536
2549
2537
2550
# Create plist for xctoolchain.
2538
2551
echo " -- Create Info.plist --"
0 commit comments