Skip to content

Commit 9d1736c

Browse files
committed
[build] Add flags to allow skipping rebuilding the corelibs
Add three new flags, '--skip-clean-libdispatch', '--skip-clean-foundation', and '--skip-clean-xctest', that leave the previous builds of those products in place.
1 parent a5ba086 commit 9d1736c

File tree

6 files changed

+83
-18
lines changed

6 files changed

+83
-18
lines changed

utils/build-script-impl

Lines changed: 27 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -152,6 +152,11 @@ KNOWN_SETTINGS=(
152152
build-swift-stdlib-unittest-extra "0" "set to 1 to build optional StdlibUnittest components"
153153
build-swift-tools "1" "set to 1 to build Swift host tools"
154154

155+
## Skip cleaning build directories ...
156+
skip-clean-libdispatch "0" "skip cleaning the libdispatch build"
157+
skip-clean-foundation "0" "skip cleaning the foundation build"
158+
skip-clean-xctest "0" "skip cleaning the xctest build"
159+
155160
## Test Options
156161
llvm-include-tests "1" "Set to true to generate testing targets for LLVM. Set to true by default."
157162
long-test "0" "set to run the long test suite"
@@ -2309,6 +2314,14 @@ for host in "${ALL_HOSTS[@]}"; do
23092314
FOUNDATION_BUILD_DIR=$(build_directory ${host} foundation)
23102315
SWIFT_BUILD_DIR=$(build_directory ${host} swift)
23112316

2317+
if [[ "${SKIP_CLEAN_XCTEST}" == "0" ]]
2318+
then
2319+
# The Swift project might have been changed, but CMake might
2320+
# not be aware and will not rebuild.
2321+
echo "Cleaning the XCTest build directory"
2322+
call rm -rf "${XCTEST_BUILD_DIR}"
2323+
fi
2324+
23122325
case "${host}" in
23132326
macosx-*)
23142327
# Staging: require opt-in for building with dispatch
@@ -2336,12 +2349,6 @@ for host in "${ALL_HOSTS[@]}"; do
23362349
continue
23372350
;;
23382351
*)
2339-
# FIXME: Always re-build XCTest on non-darwin platforms.
2340-
# The Swift project might have been changed, but CMake might
2341-
# not be aware and will not rebuild.
2342-
echo "Cleaning the XCTest build directory"
2343-
call rm -rf "${XCTEST_BUILD_DIR}"
2344-
23452352
cmake_options=(
23462353
${cmake_options[@]}
23472354
-DCMAKE_BUILD_TYPE:STRING="${XCTEST_BUILD_TYPE}"
@@ -2401,11 +2408,13 @@ for host in "${ALL_HOSTS[@]}"; do
24012408
LIBICU_BUILD_ARGS=()
24022409
fi
24032410

2404-
# FIXME: Always re-build XCTest on non-darwin platforms.
2405-
# The Swift project might have been changed, but CMake might
2406-
# not be aware and will not rebuild.
2407-
echo "Cleaning the Foundation build directory"
2408-
call rm -rf "${build_dir}"
2411+
if [[ "${SKIP_CLEAN_FOUNDATION}" == "0" ]]
2412+
then
2413+
# The Swift project might have been changed, but CMake might
2414+
# not be aware and will not rebuild.
2415+
echo "Cleaning the Foundation build directory"
2416+
call rm -rf "${build_dir}"
2417+
fi
24092418

24102419
# Set the PKG_CONFIG_PATH so that core-foundation can find the libraries and
24112420
# header files
@@ -2466,11 +2475,13 @@ for host in "${ALL_HOSTS[@]}"; do
24662475
exit 1
24672476
;;
24682477
*)
2469-
# FIXME: Always re-build XCTest on non-darwin platforms.
2470-
# The Swift project might have been changed, but CMake might
2471-
# not be aware and will not rebuild.
2472-
echo "Cleaning the libdispatch build directory"
2473-
call rm -rf "${LIBDISPATCH_BUILD_DIR}"
2478+
if [[ "${SKIP_CLEAN_LIBDISPATCH}" == "0" ]]
2479+
then
2480+
# The Swift project might have been changed, but CMake might
2481+
# not be aware and will not rebuild.
2482+
echo "Cleaning the libdispatch build directory"
2483+
call rm -rf "${LIBDISPATCH_BUILD_DIR}"
2484+
fi
24742485

24752486
cmake_options=(
24762487
-DENABLE_SWIFT=YES

utils/build_swift/build_swift/driver_arguments.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1059,6 +1059,12 @@ def create_argument_parser():
10591059
toggle_false('test_android_host'),
10601060
help='skip testing Android device targets on the host machine (the '
10611061
'phone itself)')
1062+
option('--skip-clean-libdispatch', toggle_false('clean_libdispatch'),
1063+
help='skip cleaning up libdispatch')
1064+
option('--skip-clean-foundation', toggle_false('clean_foundation'),
1065+
help='skip cleaning up foundation')
1066+
option('--skip-clean-xctest', toggle_false('clean_xctest'),
1067+
help='skip cleaning up xctest')
10621068
option('--skip-clean-llbuild', toggle_false('clean_llbuild'),
10631069
help='skip cleaning up llbuild')
10641070
option('--clean-early-swift-driver', toggle_true('clean_early_swift_driver'),

utils/build_swift/tests/expected_options.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -218,6 +218,9 @@
218218
defaults.SWIFT_MAX_PARALLEL_LTO_LINK_JOBS,
219219
'swift_user_visible_version': defaults.SWIFT_USER_VISIBLE_VERSION,
220220
'symbols_package': None,
221+
'clean_libdispatch': True,
222+
'clean_foundation': True,
223+
'clean_xctest': True,
221224
'clean_llbuild': True,
222225
'clean_swiftpm': True,
223226
'clean_swift_driver': True,
@@ -594,6 +597,9 @@ class BuildScriptImplOption(_BaseOption):
594597
dest='build_watchos_device'),
595598
DisableOption('--skip-build-watchos-simulator',
596599
dest='build_watchos_simulator'),
600+
DisableOption('--skip-clean-libdispatch', dest='clean_libdispatch'),
601+
DisableOption('--skip-clean-foundation', dest='clean_foundation'),
602+
DisableOption('--skip-clean-xctest', dest='clean_xctest'),
597603
DisableOption('--skip-clean-llbuild', dest='clean_llbuild'),
598604
DisableOption('--skip-early-swift-driver', dest='build_early_swift_driver'),
599605
DisableOption('--skip-clean-swiftpm', dest='clean_swiftpm'),

utils/swift_build_support/swift_build_support/build_script_invocation.py

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -420,6 +420,21 @@ def convert_to_impl_arguments(self):
420420
"--llvm-install-components=%s" % args.llvm_install_components
421421
]
422422

423+
if not args.clean_libdispatch:
424+
impl_args += [
425+
"--skip-clean-libdispatch"
426+
]
427+
428+
if not args.clean_foundation:
429+
impl_args += [
430+
"--skip-clean-foundation"
431+
]
432+
433+
if not args.clean_xctest:
434+
impl_args += [
435+
"--skip-clean-xctest"
436+
]
437+
423438
if not args.clean_llbuild:
424439
impl_args += [
425440
"--skip-clean-llbuild"
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
# REQUIRES: standalone_build
2+
# UNSUPPORTED: OS=macosx
3+
# UNSUPPORTED: OS=ios
4+
# UNSUPPORTED: OS=tvos
5+
# UNSUPPORTED: OS=watchos
6+
7+
# RUN: %empty-directory(%t)
8+
# RUN: mkdir -p %t
9+
# RUN: SWIFT_BUILD_ROOT=%t %swift_src_root/utils/build-script --dry-run --foundation --cmake %cmake 2>&1 | %FileCheck --check-prefix=CLEAN-CORELIBS-CHECK %s
10+
11+
# RUN: %empty-directory(%t)
12+
# RUN: mkdir -p %t
13+
# RUN: SWIFT_BUILD_ROOT=%t %swift_src_root/utils/build-script --dry-run --foundation --skip-clean-libdispatch --skip-clean-foundation --cmake %cmake 2>&1 | %FileCheck --check-prefix=SKIP-CLEAN-CORELIBS-CHECK %s
14+
15+
# CLEAN-CORELIBS-CHECK: Cleaning the libdispatch build directory
16+
# CLEAN-CORELIBS-CHECK-NEXT: rm -rf
17+
# CLEAN-CORELIBS-CHECK: Cleaning the Foundation build directory
18+
# CLEAN-CORELIBS-CHECK-NEXT: rm -rf
19+
20+
# SKIP-CLEAN-CORELIBS-CHECK-NOT: Cleaning the libdispatch build directory
21+
# SKIP-CLEAN-CORELIBS-CHECK-NOT: rm -rf {{.*/libdispatch-[^/]*}}
22+
# SKIP-CLEAN-CORELIBS-CHECK-NOT: Cleaning the Foundation build directory
23+
# SKIP-CLEAN-CORELIBS-CHECK-NOT: rm -rf {{.*/foundation-[^/]*}}

validation-test/BuildSystem/skip_clean_llbuild.test renamed to validation-test/BuildSystem/skip_clean_xctest_llbuild.test

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,18 @@
22

33
# RUN: %empty-directory(%t)
44
# RUN: mkdir -p %t
5-
# RUN: SWIFT_BUILD_ROOT=%t %swift_src_root/utils/build-script --dry-run --llbuild --cmake %cmake 2>&1 | %FileCheck --check-prefix=CLEAN-LLBUILD-CHECK %s
5+
# RUN: SWIFT_BUILD_ROOT=%t %swift_src_root/utils/build-script --dry-run --xctest --llbuild --cmake %cmake 2>&1 | %FileCheck --check-prefix=CLEAN-LLBUILD-CHECK %s
66

77
# RUN: %empty-directory(%t)
88
# RUN: mkdir -p %t
9-
# RUN: SWIFT_BUILD_ROOT=%t %swift_src_root/utils/build-script --dry-run --llbuild --skip-clean-llbuild --cmake %cmake 2>&1 | %FileCheck --check-prefix=SKIP-CLEAN-LLBUILD-CHECK %s
9+
# RUN: SWIFT_BUILD_ROOT=%t %swift_src_root/utils/build-script --dry-run --xctest --llbuild --skip-clean-xctest --skip-clean-llbuild --cmake %cmake 2>&1 | %FileCheck --check-prefix=SKIP-CLEAN-LLBUILD-CHECK %s
1010

11+
# CLEAN-LLBUILD-CHECK: Cleaning the XCTest build directory
12+
# CLEAN-LLBUILD-CHECK-NEXT: rm -rf
1113
# CLEAN-LLBUILD-CHECK: Cleaning the llbuild build directory
1214
# CLEAN-LLBUILD-CHECK-NEXT: rm -rf
1315

16+
# SKIP-CLEAN-LLBUILD-CHECK-NOT: Cleaning the XCTest build directory
17+
# SKIP-CLEAN-LLBUILD-CHECK-NOT: rm -rf {{.*/xctest-[^/]*}}
1418
# SKIP-CLEAN-LLBUILD-CHECK-NOT: Cleaning the llbuild build directory
1519
# SKIP-CLEAN-LLBUILD-CHECK-NOT: rm -rf {{.*/llbuild-[^/]*}}

0 commit comments

Comments
 (0)