Skip to content

Commit 0c122a5

Browse files
authored
Merge pull request #38673 from buttaface/skip-clean
2 parents 4336084 + 9d1736c commit 0c122a5

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"
@@ -2319,6 +2324,14 @@ for host in "${ALL_HOSTS[@]}"; do
23192324
FOUNDATION_BUILD_DIR=$(build_directory ${host} foundation)
23202325
SWIFT_BUILD_DIR=$(build_directory ${host} swift)
23212326

2327+
if [[ "${SKIP_CLEAN_XCTEST}" == "0" ]]
2328+
then
2329+
# The Swift project might have been changed, but CMake might
2330+
# not be aware and will not rebuild.
2331+
echo "Cleaning the XCTest build directory"
2332+
call rm -rf "${XCTEST_BUILD_DIR}"
2333+
fi
2334+
23222335
case "${host}" in
23232336
macosx-*)
23242337
# Staging: require opt-in for building with dispatch
@@ -2346,12 +2359,6 @@ for host in "${ALL_HOSTS[@]}"; do
23462359
continue
23472360
;;
23482361
*)
2349-
# FIXME: Always re-build XCTest on non-darwin platforms.
2350-
# The Swift project might have been changed, but CMake might
2351-
# not be aware and will not rebuild.
2352-
echo "Cleaning the XCTest build directory"
2353-
call rm -rf "${XCTEST_BUILD_DIR}"
2354-
23552362
cmake_options=(
23562363
${cmake_options[@]}
23572364
-DCMAKE_BUILD_TYPE:STRING="${XCTEST_BUILD_TYPE}"
@@ -2411,11 +2418,13 @@ for host in "${ALL_HOSTS[@]}"; do
24112418
LIBICU_BUILD_ARGS=()
24122419
fi
24132420

2414-
# FIXME: Always re-build XCTest on non-darwin platforms.
2415-
# The Swift project might have been changed, but CMake might
2416-
# not be aware and will not rebuild.
2417-
echo "Cleaning the Foundation build directory"
2418-
call rm -rf "${build_dir}"
2421+
if [[ "${SKIP_CLEAN_FOUNDATION}" == "0" ]]
2422+
then
2423+
# The Swift project might have been changed, but CMake might
2424+
# not be aware and will not rebuild.
2425+
echo "Cleaning the Foundation build directory"
2426+
call rm -rf "${build_dir}"
2427+
fi
24192428

24202429
# Set the PKG_CONFIG_PATH so that core-foundation can find the libraries and
24212430
# header files
@@ -2476,11 +2485,13 @@ for host in "${ALL_HOSTS[@]}"; do
24762485
exit 1
24772486
;;
24782487
*)
2479-
# FIXME: Always re-build XCTest on non-darwin platforms.
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}"
2488+
if [[ "${SKIP_CLEAN_LIBDISPATCH}" == "0" ]]
2489+
then
2490+
# The Swift project might have been changed, but CMake might
2491+
# not be aware and will not rebuild.
2492+
echo "Cleaning the libdispatch build directory"
2493+
call rm -rf "${LIBDISPATCH_BUILD_DIR}"
2494+
fi
24842495

24852496
cmake_options=(
24862497
-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
@@ -1066,6 +1066,12 @@ def create_argument_parser():
10661066
toggle_false('test_android_host'),
10671067
help='skip testing Android device targets on the host machine (the '
10681068
'phone itself)')
1069+
option('--skip-clean-libdispatch', toggle_false('clean_libdispatch'),
1070+
help='skip cleaning up libdispatch')
1071+
option('--skip-clean-foundation', toggle_false('clean_foundation'),
1072+
help='skip cleaning up foundation')
1073+
option('--skip-clean-xctest', toggle_false('clean_xctest'),
1074+
help='skip cleaning up xctest')
10691075
option('--skip-clean-llbuild', toggle_false('clean_llbuild'),
10701076
help='skip cleaning up llbuild')
10711077
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
@@ -220,6 +220,9 @@
220220
defaults.SWIFT_MAX_PARALLEL_LTO_LINK_JOBS,
221221
'swift_user_visible_version': defaults.SWIFT_USER_VISIBLE_VERSION,
222222
'symbols_package': None,
223+
'clean_libdispatch': True,
224+
'clean_foundation': True,
225+
'clean_xctest': True,
223226
'clean_llbuild': True,
224227
'clean_swiftpm': True,
225228
'clean_swift_driver': True,
@@ -599,6 +602,9 @@ class BuildScriptImplOption(_BaseOption):
599602
dest='build_watchos_device'),
600603
DisableOption('--skip-build-watchos-simulator',
601604
dest='build_watchos_simulator'),
605+
DisableOption('--skip-clean-libdispatch', dest='clean_libdispatch'),
606+
DisableOption('--skip-clean-foundation', dest='clean_foundation'),
607+
DisableOption('--skip-clean-xctest', dest='clean_xctest'),
602608
DisableOption('--skip-clean-llbuild', dest='clean_llbuild'),
603609
DisableOption('--skip-early-swift-driver', dest='build_early_swift_driver'),
604610
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
@@ -424,6 +424,21 @@ def convert_to_impl_arguments(self):
424424
"--llvm-install-components=%s" % args.llvm_install_components
425425
]
426426

427+
if not args.clean_libdispatch:
428+
impl_args += [
429+
"--skip-clean-libdispatch"
430+
]
431+
432+
if not args.clean_foundation:
433+
impl_args += [
434+
"--skip-clean-foundation"
435+
]
436+
437+
if not args.clean_xctest:
438+
impl_args += [
439+
"--skip-clean-xctest"
440+
]
441+
427442
if not args.clean_llbuild:
428443
impl_args += [
429444
"--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)