Skip to content

Commit 215bdc0

Browse files
committed
Merge pull request #4 from phausler/FoundationBuildScripts
install Foundation via the ninja script and add the test phase for Foundation
2 parents a553403 + 7d18161 commit 215bdc0

File tree

2 files changed

+23
-3
lines changed

2 files changed

+23
-3
lines changed

utils/build-script

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -349,6 +349,11 @@ build the Debug variant of the Swift standard library and SDK overlay""",
349349
action="store_const",
350350
const="Debug",
351351
dest="cmark_build_variant")
352+
build_variant_override_group.add_argument("--debug-foundation",
353+
help="build the Debug variant of Foundation",
354+
action="store_const",
355+
const="Debug",
356+
dest="foundation_build_variant")
352357

353358
assertions_group = parser.add_mutually_exclusive_group(required=False)
354359
assertions_group.add_argument("--assertions",
@@ -513,6 +518,9 @@ placed""",
513518
if args.lldb_build_variant is None:
514519
args.lldb_build_variant = args.build_variant
515520

521+
if args.foundation_build_variant is None:
522+
args.foundation_build_variant = args.build_variant
523+
516524
# Assertions are enabled by default.
517525
if args.assertions is None:
518526
args.assertions = True
@@ -692,6 +700,10 @@ placed""",
692700
"--cmake-generator", args.cmake_generator,
693701
"--workspace", SWIFT_SOURCE_ROOT
694702
]
703+
if args.build_foundation:
704+
build_script_impl_args += [
705+
"--foundation-build-type", args.foundation_build_variant
706+
]
695707
build_script_impl_args += build_script_impl_inferred_args
696708

697709
# If we have extra_swift_args, combine all of them together and then add

utils/build-script-impl

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,7 @@ KNOWN_SETTINGS=(
7272
swift-stdlib-enable-assertions "1" "enable assertions in Swift"
7373
lldb-build-type "Debug" "the CMake build variant for LLDB"
7474
llbuild-build-type "Debug" "the CMake build variant for llbuild"
75+
foundation-build-type "Debug" "the build variant for Foundation"
7576
llbuild-enable-assertions "1" "enable assertions in llbuild"
7677
enable-asan "" "enable AddressSanitizer"
7778
cmake "" "path to the cmake binary"
@@ -1679,6 +1680,8 @@ for deployment_target in "${NATIVE_TOOLS_DEPLOYMENT_TARGETS[@]}" "${CROSS_TOOLS_
16791680
continue
16801681
;;
16811682
foundation)
1683+
# the configuration script requires knowing about XCTest's location for building and running the tests
1684+
XCTEST_BUILD_DIR=$(build_directory $deployment_target xctest)
16821685
SWIFTC_BIN="$(build_directory_bin $deployment_target swift)/swiftc"
16831686
SWIFT_BIN="$(build_directory_bin $deployment_target swift)/swift"
16841687
SWIFT_BUILD_PATH="$(build_directory $deployment_target swift)"
@@ -1693,7 +1696,7 @@ for deployment_target in "${NATIVE_TOOLS_DEPLOYMENT_TARGETS[@]}" "${CROSS_TOOLS_
16931696
set -x
16941697
pushd "${FOUNDATION_SOURCE_DIR}"
16951698
SWIFTC="${SWIFTC_BIN}" CLANG="${LLVM_BIN}"/clang SWIFT="${SWIFT_BIN}" \
1696-
SDKROOT="${SWIFT_BUILD_PATH}" BUILD_DIR="${build_dir}" ./configure
1699+
SDKROOT="${SWIFT_BUILD_PATH}" BUILD_DIR="${build_dir}" DSTROOT="${INSTALL_DESTDIR}" PREFIX="${INSTALL_PREFIX}" SWIFTCFLAGS="-I${XCTEST_BUILD_DIR}" LDFLAGS="-L${XCTEST_BUILD_DIR}" ./configure "${FOUNDATION_BUILD_TYPE}"
16971700
$NINJA_BIN
16981701
popd
16991702
{ set +x; } 2>/dev/null
@@ -1870,7 +1873,12 @@ for deployment_target in "${STDLIB_DEPLOYMENT_TARGETS[@]}"; do
18701873
if [[ "$SKIP_TEST_FOUNDATION" ]]; then
18711874
continue
18721875
fi
1873-
# FIXME: We don't test foundation, yet...
1876+
build_dir=$(build_directory $deployment_target $product)
1877+
XCTEST_BUILD_DIR=$(build_directory $deployment_target xctest)
1878+
pushd "${FOUNDATION_SOURCE_DIR}"
1879+
$NINJA_BIN TestFoundation
1880+
LD_LIBRARY_PATH="${INSTALL_DESTDIR}"/"${INSTALL_PREFIX}"/lib/swift/:"${build_dir}/Foundation":"${XCTEST_BUILD_DIR}":$LD_LIBRARY_PATH "${build_dir}"/TestFoundation/TestFoundation
1881+
popd
18741882
continue
18751883
;;
18761884
*)
@@ -2005,7 +2013,7 @@ for deployment_target in "${NATIVE_TOOLS_DEPLOYMENT_TARGETS[@]}" "${CROSS_TOOLS_
20052013
build_dir=$(build_directory $deployment_target $product)
20062014
set -x
20072015
pushd "${FOUNDATION_SOURCE_DIR}"
2008-
DSTROOT="${INSTALL_DESTDIR}" BUILD_DIR="${build_dir}" ./install
2016+
$NINJA_BIN install
20092017
popd
20102018
{ set +x; } 2>/dev/null
20112019

0 commit comments

Comments
 (0)