Skip to content

Commit 3bad9a0

Browse files
authored
Merge pull request #39207 from d-ronnqvist/ronnqvist/reduce-toolchain-arg-parsing-duplication
Reduce duplication in toolchain argument parsing
2 parents 52e852a + 7548472 commit 3bad9a0

File tree

1 file changed

+7
-12
lines changed

1 file changed

+7
-12
lines changed

utils/build-toolchain

Lines changed: 7 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -50,16 +50,17 @@ DRY_RUN=
5050
BUNDLE_PREFIX=
5151
PRESET_FILE_FLAGS=
5252
PRESET_PREFIX=
53-
PRESET_SUFFIX=
53+
NO_TEST=",no_test"
54+
USE_OS_RUNTIME=
5455

5556
case $(uname -s) in
5657
Darwin)
57-
SWIFT_PACKAGE=buildbot_osx_package,no_test
58+
SWIFT_PACKAGE=buildbot_osx_package
5859
OS_SUFFIX=osx
5960
BUILD_SUBDIR=buildbot_osx
6061
;;
6162
Linux)
62-
SWIFT_PACKAGE=buildbot_linux,no_test
63+
SWIFT_PACKAGE=buildbot_linux
6364
OS_SUFFIX=linux
6465
BUILD_SUBDIR=buildbot_linux
6566
;;
@@ -77,13 +78,7 @@ while [ $# -ne 0 ]; do
7778
DRY_RUN="-n"
7879
;;
7980
-t|--test)
80-
if [ "$(uname -s)" == "Linux" ]; then
81-
SWIFT_PACKAGE=buildbot_linux
82-
BUILD_SUBDIR=buildbot_linux
83-
else
84-
SWIFT_PACKAGE=buildbot_osx_package
85-
BUILD_SUBDIR=buildbot_osx
86-
fi
81+
NO_TEST=
8782
;;
8883
--distcc)
8984
DISTCC_FLAG="--distcc"
@@ -100,7 +95,7 @@ while [ $# -ne 0 ]; do
10095
PRESET_PREFIX="$1"
10196
;;
10297
--use-os-runtime)
103-
PRESET_SUFFIX=",use_os_runtime"
98+
USE_OS_RUNTIME=",use_os_runtime"
10499
;;
105100
-h|--help)
106101
usage
@@ -152,7 +147,7 @@ SCCACHE_FLAG="${SCCACHE_FLAG}"
152147

153148
./utils/build-script ${DRY_RUN} ${DISTCC_FLAG} ${PRESET_FILE_FLAGS} \
154149
${SCCACHE_FLAG} \
155-
--preset="${PRESET_PREFIX}${SWIFT_PACKAGE}${PRESET_SUFFIX}" \
150+
--preset="${PRESET_PREFIX}${SWIFT_PACKAGE}${NO_TEST}${USE_OS_RUNTIME}" \
156151
install_destdir="${SWIFT_INSTALL_DIR}" \
157152
installable_package="${SWIFT_INSTALLABLE_PACKAGE}" \
158153
install_toolchain_dir="${SWIFT_TOOLCHAIN_DIR}" \

0 commit comments

Comments
 (0)