Skip to content

Commit 8fb8178

Browse files
authored
Merge pull request #33639 from gottesmm/pr-4725a682654c47d1c8fb22263805d3bef3ff9535
[build-toolchain] Add an option to control if code built by the toolchain links by default to the OS runtime or the toolchain runtime.
2 parents c708785 + af4199e commit 8fb8178

File tree

3 files changed

+52
-3
lines changed

3 files changed

+52
-3
lines changed

utils/build-presets.ini

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1277,6 +1277,7 @@ darwin-toolchain-display-name-short=%(darwin_toolchain_display_name_short)s
12771277
darwin-toolchain-name=%(darwin_toolchain_xctoolchain_name)s
12781278
darwin-toolchain-version=%(darwin_toolchain_version)s
12791279
darwin-toolchain-alias=%(darwin_toolchain_alias)s
1280+
darwin-toolchain-require-use-os-runtime=0
12801281

12811282
[preset: mixin_osx_package_test]
12821283
build-subdir=buildbot_osx
@@ -1296,6 +1297,8 @@ lldb-test-swift-only
12961297
# Path to the .tar.gz package we would create.
12971298
installable-package=%(installable_package)s
12981299

1300+
[preset: mixin_osx_package,use_os_runtime]:
1301+
darwin-toolchain-require-use-os-runtime=1
12991302

13001303
[preset: buildbot_osx_package]
13011304
mixin-preset=
@@ -1306,6 +1309,11 @@ mixin-preset=
13061309
# SKIP LLDB TESTS (67923799)
13071310
skip-test-lldb
13081311

1312+
[preset: buildbot_osx_package,use_os_runtime]
1313+
mixin-preset=
1314+
buildbot_osx_package
1315+
mixin_osx_package,use_os_runtime
1316+
13091317
[preset: buildbot_osx_package,no_assertions]
13101318
mixin-preset=
13111319
mixin_osx_package_base
@@ -1315,12 +1323,20 @@ dash-dash
13151323

13161324
no-assertions
13171325

1326+
[preset: buildbot_osx_package,no_assertions,use_os_runtime]
1327+
mixin-preset=
1328+
buildbot_osx_package,no_assertions
1329+
mixin_osx_package,use_os_runtime
13181330

13191331
[preset: buildbot_osx_package,no_assertions,lto]
13201332
mixin-preset=buildbot_osx_package,no_assertions
13211333

13221334
lto
13231335

1336+
[preset: buildbot_osx_package,no_assertions,lto,use_os_runtime]
1337+
mixin-preset=
1338+
buildbot_osx_package,no_assertions,lto
1339+
mixin_osx_package,use_os_runtime
13241340

13251341
[preset: buildbot_osx_package,no_assertions,no_test]
13261342
mixin-preset=
@@ -1339,6 +1355,10 @@ skip-test-swiftsyntax
13391355
skip-test-skstresstester
13401356
skip-test-swiftevolve
13411357

1358+
[preset: buildbot_osx_package,no_assertions,no_test,use_os_runtime]
1359+
mixin-preset=
1360+
buildbot_osx_package,no_assertions,no_test
1361+
mixin_osx_package,use_os_runtime
13421362

13431363
# Debug version of the compilers, release version of the stdlib.
13441364
[preset: buildbot_osx_package,tools=DA,stdlib=R]
@@ -1352,6 +1372,11 @@ debug-llvm
13521372
debug-swift
13531373
no-swift-stdlib-assertions
13541374

1375+
[preset: buildbot_osx_package,tools=DA,stdlib=R,use_os_runtime]
1376+
mixin-preset=
1377+
buildbot_osx_package,tools=DA,stdlib=R
1378+
mixin_osx_package,use_os_runtime
1379+
13551380
[preset: mixin_buildbot_osx_package,no_test]
13561381
skip-test-swift
13571382
skip-test-swiftpm
@@ -1370,6 +1395,14 @@ mixin-preset=
13701395
buildbot_osx_package
13711396
mixin_buildbot_osx_package,no_test
13721397

1398+
# macOS package without test that when linked against uses the OS runtime
1399+
# instead of the toolchain runtime.
1400+
[preset: buildbot_osx_package,no_test,use_os_runtime]
1401+
mixin-preset=
1402+
buildbot_osx_package
1403+
mixin_buildbot_osx_package,no_test
1404+
mixin_osx_package,use_os_runtime
1405+
13731406
#===------------------------------------------------------------------------===#
13741407
# LLDB build configurations
13751408
#

utils/build-script-impl

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,7 @@ KNOWN_SETTINGS=(
114114
darwin-toolchain-installer-package "" "The path to installer pkg"
115115
darwin-toolchain-name "" "Directory name for xctoolchain"
116116
darwin-toolchain-version "" "Version for xctoolchain info plist and installer pkg"
117+
darwin-toolchain-require-use-os-runtime "0" "When setting up a plist for a toolchain, require the users of the toolchain to link against the OS instead of the packaged toolchain runtime. 0 for false, 1 for true"
117118
darwin-xcrun-toolchain "default" "the name of the toolchain to use on Darwin"
118119

119120
## Build Types for Components
@@ -3050,6 +3051,11 @@ function build_and_test_installable_package() {
30503051
COMPATIBILITY_VERSION_DISPLAY_STRING="Xcode 8.0"
30513052
DARWIN_TOOLCHAIN_CREATED_DATE="$(date -u +'%a %b %d %T GMT %Y')"
30523053

3054+
SWIFT_USE_DEVELOPMENT_TOOLCHAIN_RUNTIME="YES"
3055+
if [[ "${DARWIN_TOOLCHAIN_REQUIRE_USE_OS_RUNTIME}" -eq "1" ]]; then
3056+
SWIFT_USE_DEVELOPMENT_TOOLCHAIN_RUNTIME="NO"
3057+
fi
3058+
30533059
echo "-- Removing: ${DARWIN_TOOLCHAIN_INFO_PLIST}"
30543060
call rm -f ${DARWIN_TOOLCHAIN_INFO_PLIST}
30553061

@@ -3068,7 +3074,7 @@ function build_and_test_installable_package() {
30683074
call ${PLISTBUDDY_BIN} -c "Add OverrideBuildSettings:SWIFT_DISABLE_REQUIRED_ARCLITE string 'YES'" "${DARWIN_TOOLCHAIN_INFO_PLIST}"
30693075
call ${PLISTBUDDY_BIN} -c "Add OverrideBuildSettings:SWIFT_LINK_OBJC_RUNTIME string 'YES'" "${DARWIN_TOOLCHAIN_INFO_PLIST}"
30703076
call ${PLISTBUDDY_BIN} -c "Add OverrideBuildSettings:SWIFT_DEVELOPMENT_TOOLCHAIN string 'YES'" "${DARWIN_TOOLCHAIN_INFO_PLIST}"
3071-
call ${PLISTBUDDY_BIN} -c "Add OverrideBuildSettings:SWIFT_USE_DEVELOPMENT_TOOLCHAIN_RUNTIME string 'YES'" "${DARWIN_TOOLCHAIN_INFO_PLIST}"
3077+
call ${PLISTBUDDY_BIN} -c "Add OverrideBuildSettings:SWIFT_USE_DEVELOPMENT_TOOLCHAIN_RUNTIME string '${SWIFT_USE_DEVELOPMENT_TOOLCHAIN_RUNTIME}'" "${DARWIN_TOOLCHAIN_INFO_PLIST}"
30723078

30733079
call chmod a+r "${DARWIN_TOOLCHAIN_INFO_PLIST}"
30743080

utils/build-toolchain

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,9 @@ function usage() {
3535
echo "--preset-prefix"
3636
echo "Customize the preset invoked by prepending a prefix"
3737
echo ""
38+
echo "--use-os-runtime"
39+
echo "Require this toolchain to link against against the OS runtime rather than the toolchains packaged runtime"
40+
echo ""
3841
}
3942

4043
RESULT_DIR=$PWD
@@ -46,6 +49,8 @@ DRY_RUN=
4649
BUNDLE_PREFIX=
4750
PRESET_FILE_FLAGS=
4851
PRESET_PREFIX=
52+
PRESET_SUFFIX=
53+
4954
case $(uname -s) in
5055
Darwin)
5156
SWIFT_PACKAGE=buildbot_osx_package,no_test
@@ -85,6 +90,9 @@ while [ $# -ne 0 ]; do
8590
--preset-prefix)
8691
shift
8792
PRESET_PREFIX="$1"
93+
;;
94+
--use-os-runtime)
95+
PRESET_SUFFIX=",use_os_runtime"
8896
;;
8997
-h|--help)
9098
usage
@@ -133,7 +141,8 @@ DRY_RUN="${DRY_RUN}"
133141
DISTCC_FLAG="${DISTCC_FLAG}"
134142
PRESET_FILE_FLAGS="${PRESET_FILE_FLAGS}"
135143

136-
./utils/build-script ${DRY_RUN} ${DISTCC_FLAG} ${PRESET_FILE_FLAGS} --preset="${PRESET_PREFIX}${SWIFT_PACKAGE}" \
144+
./utils/build-script ${DRY_RUN} ${DISTCC_FLAG} ${PRESET_FILE_FLAGS} \
145+
--preset="${PRESET_PREFIX}${SWIFT_PACKAGE}${PRESET_SUFFIX}" \
137146
install_destdir="${SWIFT_INSTALL_DIR}" \
138147
installable_package="${SWIFT_INSTALLABLE_PACKAGE}" \
139148
install_toolchain_dir="${SWIFT_TOOLCHAIN_DIR}" \
@@ -144,4 +153,5 @@ PRESET_FILE_FLAGS="${PRESET_FILE_FLAGS}"
144153
darwin_toolchain_display_name_short="${DISPLAY_NAME_SHORT}" \
145154
darwin_toolchain_xctoolchain_name="${TOOLCHAIN_NAME}" \
146155
darwin_toolchain_version="${TOOLCHAIN_VERSION}" \
147-
darwin_toolchain_alias="Local"
156+
darwin_toolchain_alias="Local" \
157+
darwin_toolchain_require_use_os_runtime="${REQUIRE_USE_OS_RUNTIME}"

0 commit comments

Comments
 (0)