Skip to content

Commit b2a1e1c

Browse files
author
Davide Italiano
committed
[build-script] Introduce an option to skip local build.
This is useful for cross-compiling. <rdar://problem/55916729>
1 parent 33770fa commit b2a1e1c

File tree

3 files changed

+12
-1
lines changed

3 files changed

+12
-1
lines changed

utils/build-script-impl

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -138,6 +138,7 @@ KNOWN_SETTINGS=(
138138
skip-build-benchmarks "" "set to skip building Swift Benchmark Suite"
139139
skip-build-external-benchmarks "1" "set to skip building the external Swift Benchmark Suite. (skipped by default)"
140140
skip-build-playgroundsupport "" "set to skip building PlaygroundSupport"
141+
skip-local-build "" "set to skip building for the current host (useful when crosscompiling)"
141142
skip-test-cmark "" "set to skip testing CommonMark"
142143
skip-test-lldb "" "set to skip testing lldb"
143144
skip-test-swift "" "set to skip testing Swift"
@@ -1049,7 +1050,11 @@ for t in "${CROSS_COMPILE_HOSTS[@]}"; do
10491050
esac
10501051
done
10511052

1052-
ALL_HOSTS=("${LOCAL_HOST}" "${CROSS_COMPILE_HOSTS[@]}")
1053+
ALL_HOSTS=()
1054+
if [[ ! "${SKIP_LOCAL_BUILD}" ]] ; then
1055+
ALL_HOSTS=("${ALL_HOSTS[@]}" "${LOCAL_HOST}")
1056+
fi
1057+
ALL_HOSTS=("${ALL_HOSTS[@]}" "${CROSS_COMPILE_HOSTS[@]}")
10531058

10541059
function has_cross_compile_hosts() {
10551060
if [[ ${#ALL_HOSTS[@]} -gt 1 ]]; then

utils/build_swift/driver_arguments.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -303,6 +303,10 @@ def create_argument_parser():
303303
'device')
304304
option(['-I', '--ios-all'], store_true('ios_all'),
305305
help='also build for iOS, and allow all iOS tests')
306+
307+
option(['--skip-local-build'], toggle_true('skip_local_build'),
308+
help='set to skip building for the local platform')
309+
306310
option('--skip-ios', store_false('ios'),
307311
help='set to skip everything iOS-related')
308312

utils/build_swift/tests/expected_options.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -166,6 +166,7 @@
166166
'dump_config': False,
167167
'show_sdks': False,
168168
'skip_build': False,
169+
'skip_local_build': False,
169170
'stdlib_deployment_targets': None,
170171
'stress_test': False,
171172
'swift_analyze_code_coverage': defaults.SWIFT_ANALYZE_CODE_COVERAGE,
@@ -465,6 +466,7 @@ class IgnoreOption(_BaseOption):
465466
EnableOption('--tsan-libdispatch-test'),
466467
EnableOption('--long-test'),
467468
EnableOption('--show-sdks'),
469+
EnableOption('--skip-local-build'),
468470
EnableOption('--stress-test'),
469471
EnableOption('--test'),
470472
EnableOption('--test-optimize-for-size'),

0 commit comments

Comments
 (0)