Skip to content

[build-script] XCTest CI builds on OS X #2036

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

Merged
merged 1 commit into from
Apr 7, 2016
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 21 additions & 8 deletions utils/build-script-impl
Original file line number Diff line number Diff line change
Expand Up @@ -837,6 +837,15 @@ function cmake_needs_to_specify_standard_computed_defaults() {
fi
}

function copy_swift_stdlib_tool_substitute() {
if [ ! -f "$1" ] ; then
echo "--- Copy swift-stdlib-tool ---"
set -x
cp "${SWIFT_SOURCE_DIR}/utils/swift-stdlib-tool-substitute" "$1"
{ set +x; } 2>/dev/null
fi
}

# A list of deployment targets to cross-compile the Swift host tools for.
# We can't run the resulting binaries on the build machine.
CROSS_TOOLS_DEPLOYMENT_TARGETS=()
Expand Down Expand Up @@ -1931,16 +1940,23 @@ for deployment_target in "${HOST_TARGET}" "${CROSS_TOOLS_DEPLOYMENT_TARGETS[@]}"
SWIFTC_BIN="$(build_directory_bin ${deployment_target} swift)/swiftc"
XCTEST_BUILD_DIR=$(build_directory ${deployment_target} xctest)
if [[ "$(uname -s)" == "Darwin" ]] ; then
# xcodebuild requires swift-stdlib-tool to build a Swift
# framework. This is normally present when building XCTest
# via a packaged .xctoolchain, but here we are using the
# swiftc that was just built--no toolchain exists yet. As a
# result, we must copy swift-stdlib-tool ourselves.
copy_swift_stdlib_tool_substitute "$(build_directory_bin ${deployment_target} swift)/swift-stdlib-tool"

# The Linux build places build products in the
# XCTEST_BUILD_DIR. This, and installation of XCTest in
# general, is not supported on OS X.
set -x
xcodebuild \
-workspace "${XCTEST_SOURCE_DIR}"/XCTest.xcworkspace \
-scheme SwiftXCTest \
SWIFT_EXEC="${SWIFTC_BIN}" \
SWIFT_LINK_OBJC_RUNTIME=YES \
SKIP_INSTALL=NO \
DEPLOYMENT_LOCATION=YES \
DSTROOT="${XCTEST_BUILD_DIR}" \
INSTALL_PATH="/"
DSTROOT="${XCTEST_BUILD_DIR}"
{ set +x; } 2>/dev/null
else
FOUNDATION_BUILD_DIR=$(build_directory ${deployment_target} foundation)
Expand Down Expand Up @@ -2529,10 +2545,7 @@ if [[ "${INSTALLABLE_PACKAGE}" ]] ; then
echo "--- Creating installable package ---"
echo "-- Package file: ${INSTALLABLE_PACKAGE} --"
if [[ "$(uname -s)" == "Darwin" ]] ; then
if [ ! -f "${INSTALL_DESTDIR}/${INSTALL_PREFIX}/bin/swift-stdlib-tool" ] ; then
echo "--- Copy swift-stdlib-tool ---"
cp "${SWIFT_SOURCE_DIR}/utils/swift-stdlib-tool-substitute" "${INSTALL_DESTDIR}/${INSTALL_PREFIX}/bin/swift-stdlib-tool"
fi
copy_swift_stdlib_tool_substitute "${INSTALL_DESTDIR}/${INSTALL_PREFIX}/bin/swift-stdlib-tool"

# Create plist for xctoolchain.
echo "-- Create Info.plist --"
Expand Down