Skip to content

Commit 06860a4

Browse files
committed
Initial integration of libdispatch into build-script
Extend build-script, build-script-impl, and update-checkout to include libdispatch. For now, libdispatch is not built by default (user must enable via command line argument). Integration of testing is functional, but should be improved in a later pull request. The basic autotools based test harness does not give the nice high-level progress output as the rest of the test suite. A related pull request to libdispatch (#34) has some fixes to the autotools build that are needed to enable the test target to succeed when run in an external directory.
1 parent 679ee11 commit 06860a4

File tree

3 files changed

+95
-5
lines changed

3 files changed

+95
-5
lines changed

utils/build-script

Lines changed: 24 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -154,11 +154,12 @@ SWIFT_SOURCE_ROOT: a directory containing the source for LLVM, Clang, Swift.
154154
$SWIFT_SOURCE_ROOT/llvm
155155
/clang
156156
/swift
157-
/lldb (optional)
158-
/llbuild (optional)
159-
/swiftpm (optional, requires llbuild)
160-
/swift-corelibs-xctest (optional)
161-
/swift-corelibs-foundation (optional)
157+
/lldb (optional)
158+
/llbuild (optional)
159+
/swiftpm (optional, requires llbuild)
160+
/swift-corelibs-xctest (optional)
161+
/swift-corelibs-foundation (optional)
162+
/swift-corelibs-libdispatch (optional)
162163
163164
SWIFT_BUILD_ROOT: a directory in which to create out-of-tree builds.
164165
Defaults to "$SWIFT_SOURCE_ROOT/build/".
@@ -309,6 +310,10 @@ details of the setups of other systems or automated environments.""")
309310
help="build foundation",
310311
action="store_true",
311312
dest="build_foundation")
313+
projects_group.add_argument("--libdispatch",
314+
help="build libdispatch",
315+
action="store_true",
316+
dest="build_libdispatch")
312317

313318
extra_actions_group = parser.add_argument_group(
314319
title="Extra actions to perform before or in addition to building")
@@ -373,6 +378,11 @@ build the Debug variant of the Swift standard library and SDK overlay""",
373378
action="store_const",
374379
const="Debug",
375380
dest="foundation_build_variant")
381+
build_variant_override_group.add_argument("--debug-libdispatch",
382+
help="build the Debug variant of libdispatch",
383+
action="store_const",
384+
const="Debug",
385+
dest="libdispatch_build_variant")
376386

377387
assertions_group = parser.add_mutually_exclusive_group(required=False)
378388
assertions_group.add_argument("--assertions",
@@ -564,6 +574,9 @@ the number of parallel build jobs to use""",
564574
if args.foundation_build_variant is None:
565575
args.foundation_build_variant = args.build_variant
566576

577+
if args.libdispatch_build_variant is None:
578+
args.libdispatch_build_variant = args.build_variant
579+
567580
# Assertions are enabled by default.
568581
if args.assertions is None:
569582
args.assertions = True
@@ -615,6 +628,7 @@ the number of parallel build jobs to use""",
615628
"--skip-test-swiftpm",
616629
"--skip-test-xctest",
617630
"--skip-test-foundation",
631+
"--skip-test-libdispatch",
618632
"--skip-test-ios",
619633
"--skip-test-tvos",
620634
"--skip-test-watchos",
@@ -673,6 +687,11 @@ the number of parallel build jobs to use""",
673687
"--skip-build-foundation"
674688
]
675689

690+
if not args.build_libdispatch:
691+
build_script_impl_inferred_args += [
692+
"--skip-build-libdispatch"
693+
]
694+
676695
if args.skip_build:
677696
build_script_impl_inferred_args += [
678697
"--skip-build"

utils/build-script-impl

Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -119,13 +119,15 @@ KNOWN_SETTINGS=(
119119
skip-build-swiftpm "" "set to skip building swiftpm"
120120
skip-build-xctest "" "set to skip building xctest"
121121
skip-build-foundation "" "set to skip building foundation"
122+
skip-build-libdispatch "" "set to skip building libdispatch"
122123
skip-test-cmark "" "set to skip testing CommonMark"
123124
skip-test-lldb "" "set to skip testing lldb"
124125
skip-test-swift "" "set to skip testing Swift"
125126
skip-test-llbuild "" "set to skip testing llbuild"
126127
skip-test-swiftpm "" "set to skip testing swiftpm"
127128
skip-test-xctest "" "set to skip testing xctest"
128129
skip-test-foundation "" "set to skip testing foundation"
130+
skip-test-libdispatch "" "set to skip testing libdispatch"
129131
skip-test-osx "" "set to skip testing Swift stdlibs for OSX"
130132
skip-test-ios "" "set to skip testing Swift stdlibs for iOS"
131133
skip-test-ios-simulator "" "set to skip testing Swift stdlibs for iOS simulators (i.e. test devices only)"
@@ -165,6 +167,7 @@ KNOWN_SETTINGS=(
165167
install-swiftpm "" "whether to install swiftpm"
166168
install-xctest "" "whether to install xctest"
167169
install-foundation "" "whether to install foundation"
170+
install-libdispatch "" "whether to install libdispatch"
168171
darwin-install-extract-symbols "" "whether to extract symbols with dsymutil during installations"
169172
cross-compile-tools-deployment-targets "" "space-separated list of targets to cross-compile host Swift tools for"
170173
skip-merge-lipo-cross-compile-tools "" "set to skip running merge-lipo after installing cross-compiled host Swift tools"
@@ -542,6 +545,7 @@ if [[ "${SKIP_BUILD}" ]]; then
542545
SKIP_BUILD_SWIFTPM=1
543546
SKIP_BUILD_XCTEST=1
544547
SKIP_BUILD_FOUNDATION=1
548+
SKIP_BUILD_LIBDISPATCH=1
545549
fi
546550

547551
if [[ "${SKIP_IOS}" ]] ; then
@@ -886,6 +890,7 @@ LLBUILD_SOURCE_DIR="${WORKSPACE}/llbuild"
886890
SWIFTPM_SOURCE_DIR="${WORKSPACE}/swiftpm"
887891
XCTEST_SOURCE_DIR="${WORKSPACE}/swift-corelibs-xctest"
888892
FOUNDATION_SOURCE_DIR="${WORKSPACE}/swift-corelibs-foundation"
893+
LIBDISPATCH_SOURCE_DIR="${WORKSPACE}/swift-corelibs-libdispatch"
889894

890895
if [[ ! -d ${CMARK_SOURCE_DIR} ]]; then
891896
echo "Couldn't find cmark source directory."
@@ -926,6 +931,11 @@ if [[ ! "${SKIP_BUILD_FOUNDATION}" && ! -d ${FOUNDATION_SOURCE_DIR} ]]; then
926931
exit 1
927932
fi
928933

934+
if [[ ! "${SKIP_BUILD_LIBDISPATCH}" && ! -d ${LIBDISPATCH_SOURCE_DIR} ]]; then
935+
echo "Couldn't find libdispatch source directory."
936+
exit 1
937+
fi
938+
929939
# Symlink clang into the llvm tree.
930940
CLANG_SOURCE_DIR="${LLVM_SOURCE_DIR}/tools/clang"
931941
if [ ! -e "${WORKSPACE}/clang" ] ; then
@@ -955,6 +965,9 @@ fi
955965
if [[ ! "${SKIP_BUILD_FOUNDATION}" ]] ; then
956966
PRODUCTS=("${PRODUCTS[@]}" foundation)
957967
fi
968+
if [[ ! "${SKIP_BUILD_LIBDISPATCH}" ]] ; then
969+
PRODUCTS=("${PRODUCTS[@]}" libdispatch)
970+
fi
958971

959972
SWIFT_STDLIB_TARGETS=()
960973
SWIFT_PERFTEST_TARGETS=()
@@ -1184,6 +1197,9 @@ function build_directory_bin() {
11841197
foundation)
11851198
echo "${root}/${FOUNDATION_BUILD_TYPE}/bin"
11861199
;;
1200+
libdispatch)
1201+
echo "${root}/bin"
1202+
;;
11871203
*)
11881204
echo "error: unknown product: ${product}"
11891205
exit 1
@@ -1284,6 +1300,8 @@ function cmake_config_opt() {
12841300
foundation)
12851301
echo "--config ${FOUNDATION_BUILD_TYPE}"
12861302
;;
1303+
libdispatch)
1304+
;;
12871305
*)
12881306
echo "error: unknown product: ${product}"
12891307
exit 1
@@ -1826,6 +1844,28 @@ for deployment_target in "${NATIVE_TOOLS_DEPLOYMENT_TARGETS[@]}" "${CROSS_TOOLS_
18261844
# Foundation builds itself and doesn't use cmake
18271845
continue
18281846
;;
1847+
libdispatch)
1848+
LIBDISPATCH_BUILD_DIR=$(build_directory ${deployment_target} ${product})
1849+
1850+
set -x
1851+
if [[ ! -f "${LIBDISPATCH_BUILD_DIR}"/config.status ]]; then
1852+
# First time building; need to run autotools and configure
1853+
mkdir -p "${LIBDISPATCH_BUILD_DIR}"
1854+
pushd "${LIBDISPATCH_SOURCE_DIR}"
1855+
autoreconf -fvi
1856+
popd
1857+
pushd "${LIBDISPATCH_BUILD_DIR}"
1858+
"${LIBDISPATCH_SOURCE_DIR}"/configure --prefix="${INSTALL_DESTDIR}"/"${INSTALL_PREFIX}"
1859+
popd
1860+
fi
1861+
pushd "${LIBDISPATCH_BUILD_DIR}"
1862+
make
1863+
popd
1864+
{ set +x; } 2>/dev/null
1865+
1866+
# libdispatch builds itself and doesn't use cmake
1867+
continue
1868+
;;
18291869
*)
18301870
echo "error: unknown product: ${product}"
18311871
exit 1
@@ -2013,6 +2053,20 @@ for deployment_target in "${STDLIB_DEPLOYMENT_TARGETS[@]}"; do
20132053
echo "--- Finished tests for ${product} ---"
20142054
continue
20152055
;;
2056+
libdispatch)
2057+
if [[ "${SKIP_TEST_LIBDISPATCH}" ]]; then
2058+
continue
2059+
fi
2060+
LIBDISPATCH_BUILD_DIR=$(build_directory ${deployment_target} ${product})
2061+
echo "--- Running tests for ${product} ---"
2062+
set -x
2063+
pushd "${LIBDISPATCH_BUILD_DIR}"
2064+
make check
2065+
popd
2066+
{ set +x; } 2>/dev/null
2067+
echo "--- Finished tests for ${product} ---"
2068+
continue
2069+
;;
20162070
*)
20172071
echo "error: unknown product: ${product}"
20182072
exit 1
@@ -2158,6 +2212,21 @@ for deployment_target in "${NATIVE_TOOLS_DEPLOYMENT_TARGETS[@]}" "${CROSS_TOOLS_
21582212
# As foundation installation is self-contained, we break early here.
21592213
continue
21602214
;;
2215+
libdispatch)
2216+
if [[ -z "${INSTALL_LIBDISPATCH}" ]] ; then
2217+
continue
2218+
fi
2219+
echo "--- Installing ${product} ---"
2220+
LIBDISPATCH_BUILD_DIR=$(build_directory ${deployment_target} ${product})
2221+
set -x
2222+
pushd "${LIBDISPATCH_BUILD_DIR}"
2223+
make install
2224+
popd
2225+
{ set +x; } 2>/dev/null
2226+
2227+
# As libdispatch installation is self-contained, we break early here.
2228+
continue
2229+
;;
21612230
*)
21622231
echo "error: unknown product: ${product}"
21632232
exit 1

utils/update-checkout

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ def obtain_additional_swift_sources(opts = {'with_ssh': False}):
4545
'swiftpm': 'apple/swift-package-manager',
4646
'swift-corelibs-xctest': 'apple/swift-corelibs-xctest',
4747
'swift-corelibs-foundation': 'apple/swift-corelibs-foundation',
48+
'swift-corelibs-libdispatch': 'apple/swift-corelibs-libdispatch',
4849
'swift-integration-tests': 'apple/swift-integration-tests',
4950
}
5051
for dir_name, repo in additional_repos.items():
@@ -95,6 +96,7 @@ By default, updates your checkouts of Swift, SourceKit, LLDB, and SwiftPM.""")
9596
update_working_copy(os.path.join(SWIFT_SOURCE_ROOT, "cmark"))
9697
update_working_copy(os.path.join(SWIFT_SOURCE_ROOT, "lldb"))
9798
update_working_copy(os.path.join(SWIFT_SOURCE_ROOT, "swiftpm"))
99+
update_working_copy(os.path.join(SWIFT_SOURCE_ROOT, "swift-corelibs-libdispatch"))
98100
update_working_copy(os.path.join(SWIFT_SOURCE_ROOT, "swift-corelibs-foundation"))
99101
update_working_copy(os.path.join(SWIFT_SOURCE_ROOT, "swift-corelibs-xctest"))
100102
update_working_copy(os.path.join(SWIFT_SOURCE_ROOT, "swift-integration-tests"))

0 commit comments

Comments
 (0)