Skip to content

Commit 269bd1d

Browse files
committed
[SwiftPM] Build with foundation
1 parent d2aee43 commit 269bd1d

File tree

2 files changed

+19
-12
lines changed

2 files changed

+19
-12
lines changed

utils/build-script

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -991,10 +991,10 @@ details of the setups of other systems or automated environments.""")
991991
if args.test_optimized:
992992
args.test = True
993993

994-
# XCTest has a dependency on Foundation.
994+
# SwiftPM and XCTest have a dependency on Foundation.
995995
# On OS X, Foundation is built automatically using xcodebuild.
996996
# On Linux, we must ensure that it is built manually.
997-
if args.build_xctest and platform.system() != "Darwin":
997+
if (args.build_swiftpm or args.build_xctest) and platform.system() != "Darwin":
998998
args.build_foundation = True
999999

10001000
# --skip-test-ios is merely a shorthand for host and simulator tests.

utils/build-script-impl

Lines changed: 17 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -990,20 +990,22 @@ fi
990990
if [[ ! "${SKIP_BUILD_LLBUILD}" ]] ; then
991991
PRODUCTS=("${PRODUCTS[@]}" llbuild)
992992
fi
993-
if [[ ! "${SKIP_BUILD_SWIFTPM}" ]] ; then
994-
PRODUCTS=("${PRODUCTS[@]}" swiftpm)
995-
fi
996993
if [[ ! "${SKIP_BUILD_LIBDISPATCH}" ]] ; then
997994
PRODUCTS=("${PRODUCTS[@]}" libdispatch)
998995
fi
999-
# XCTest has a dependency on Foundation, so Foundation must be added to the
1000-
# list of build products first.
996+
# SwiftPM and XCTest are dependent on Foundation, so Foundation must be
997+
# added to the list of build products first.
1001998
if [[ ! "${SKIP_BUILD_FOUNDATION}" ]] ; then
1002999
PRODUCTS=("${PRODUCTS[@]}" foundation)
10031000
fi
1001+
# SwiftPM is dependent on XCTest, so XCTest must be added to the list of
1002+
# build products first.
10041003
if [[ ! "${SKIP_BUILD_XCTEST}" ]] ; then
10051004
PRODUCTS=("${PRODUCTS[@]}" xctest)
10061005
fi
1006+
if [[ ! "${SKIP_BUILD_SWIFTPM}" ]] ; then
1007+
PRODUCTS=("${PRODUCTS[@]}" swiftpm)
1008+
fi
10071009

10081010
SWIFT_STDLIB_TARGETS=()
10091011
SWIFT_BENCHMARK_TARGETS=()
@@ -1309,9 +1311,11 @@ function cmake_config_opt() {
13091311
function set_swiftpm_bootstrap_command() {
13101312
SWIFTC_BIN="$(build_directory_bin ${deployment_target} swift)/swiftc"
13111313
LLBUILD_BIN="$(build_directory_bin ${deployment_target} llbuild)/swift-build-tool"
1312-
if [[ ! "${SKIP_BUILD_FOUNDATION}" && ! "${SKIP_BUILD_XCTEST}" ]] ; then
1314+
if [[ ! "${SKIP_BUILD_FOUNDATION}" ]] ; then
13131315
FOUNDATION_BUILD_DIR=$(build_directory ${deployment_target} foundation)
1314-
XCTEST_BUILD_DIR=$(build_directory ${deployment_target} xctest)
1316+
if [[ ! "${SKIP_BUILD_XCTEST}" ]] ; then
1317+
XCTEST_BUILD_DIR=$(build_directory ${deployment_target} xctest)
1318+
fi
13151319
fi
13161320
if [ ! -e "${LLBUILD_BIN}" ]; then
13171321
echo "Error: Cannot build swiftpm without llbuild (swift-build-tool)."
@@ -1325,10 +1329,13 @@ function set_swiftpm_bootstrap_command() {
13251329
--swiftc="${SWIFTC_BIN}"
13261330
--sbt="${LLBUILD_BIN}"
13271331
--build="${build_dir}")
1328-
if [[ ! "${SKIP_BUILD_FOUNDATION}" && ! "${SKIP_BUILD_XCTEST}" ]] ; then
1332+
if [[ ! "${SKIP_BUILD_FOUNDATION}" ]] ; then
13291333
swiftpm_bootstrap_command+=(
1330-
--foundation="${FOUNDATION_BUILD_DIR}/Foundation"
1331-
--xctest="${XCTEST_BUILD_DIR}")
1334+
--foundation="${FOUNDATION_BUILD_DIR}/Foundation")
1335+
if [[ ! "${SKIP_BUILD_XCTEST}" ]] ; then
1336+
swiftpm_bootstrap_command+=(
1337+
--xctest="${XCTEST_BUILD_DIR}")
1338+
fi
13321339
fi
13331340
}
13341341

0 commit comments

Comments
 (0)