Skip to content

Commit ade04a7

Browse files
authored
Merge pull request #73417 from eeckstein/force-bootstrapping
Force enabling SwiftCompilerSources in the build
2 parents 6a3e18d + eac23ed commit ade04a7

File tree

8 files changed

+20
-59
lines changed

8 files changed

+20
-59
lines changed

CMakeLists.txt

Lines changed: 6 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -341,9 +341,8 @@ option(SWIFT_TOOLS_LD64_LTO_CODEGEN_ONLY_FOR_SUPPORTING_TARGETS
341341
debugging Swift)"
342342
FALSE)
343343

344-
option(BOOTSTRAPPING_MODE [=[
344+
set(BOOTSTRAPPING_MODE HOSTTOOLS CACHE STRING [=[
345345
How to build the swift compiler modules. Possible values are
346-
OFF: build without swift modules
347346
HOSTTOOLS: build with a pre-installed toolchain
348347
BOOTSTRAPPING: build with a 2-stage bootstrapping process
349348
BOOTSTRAPPING-WITH-HOSTLIBS: build with a 2-stage bootstrapping process,
@@ -352,7 +351,7 @@ How to build the swift compiler modules. Possible values are
352351
`SWIFT_NATIVE_SWIFT_TOOLS_PATH` (non-Darwin only)
353352
CROSSCOMPILE-WITH-HOSTLIBS: build with a bootstrapping-with-hostlibs compiled
354353
compiler, provided in `SWIFT_NATIVE_SWIFT_TOOLS_PATH`
355-
]=] OFF)
354+
]=])
356355

357356
option(BRIDGING_MODE [=[
358357
How swift-C++ bridging code is compiled:
@@ -751,18 +750,6 @@ option(SWIFT_ENABLE_BACKTRACING
751750
set(SWIFT_DARWIN_DEPLOYMENT_VERSION_MACCATALYST "14.5" CACHE STRING
752751
"Minimum deployment target version for macCatalyst")
753752

754-
# A tempoarary hack: force enabling HOSTTOOLS mode on Windows.
755-
# Right now, SwiftCompilerSources cannot be enabled for lldb because on Windows
756-
# swift and lldb are built in a unified build and there is a missing dependency
757-
# on swiftrt.
758-
# Swift and lldb are configured with the same cmake invocation and therefore
759-
# enabling bootstrapping for swift and disabling it for lldb only works by
760-
# hardcoding the bootstrapping mode in the cmake file.
761-
# https://github.com/apple/swift/issues/73322
762-
if(CMAKE_SYSTEM_NAME STREQUAL "Windows")
763-
set(BOOTSTRAPPING_MODE "HOSTTOOLS")
764-
endif()
765-
766753
#
767754
# End of user-configurable options.
768755
#
@@ -925,6 +912,10 @@ set(SWIFT_MAIN_INCLUDE_DIR "${SWIFT_SOURCE_DIR}/include")
925912
set(SWIFT_SHIMS_INCLUDE_DIR "${SWIFT_SOURCE_DIR}/stdlib/public/SwiftShims")
926913
set(SWIFT_INCLUDE_DIR "${CMAKE_CURRENT_BINARY_DIR}/include")
927914

915+
if (NOT BOOTSTRAPPING_MODE)
916+
message(FATAL_ERROR "turning off bootstrapping is not supported anymore")
917+
endif()
918+
928919
set(SWIFT_RUNTIME_OUTPUT_INTDIR "${CMAKE_BINARY_DIR}/${CMAKE_CFG_INTDIR}/bin")
929920
set(SWIFT_LIBRARY_OUTPUT_INTDIR "${CMAKE_BINARY_DIR}/${CMAKE_CFG_INTDIR}/lib")
930921
if("${SWIFT_NATIVE_SWIFT_TOOLS_PATH}" STREQUAL "")

test/lit.cfg

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -905,6 +905,10 @@ if 'swift_evolve' in lit_config.params:
905905
if not 'swift_driver' in lit_config.params:
906906
config.available_features.add("cplusplus_driver")
907907

908+
# SwiftCompilerSources are now always enabled:
909+
# TODO: remove all the `REQUIRES: swift_in_compiler` in tests
910+
config.available_features.add('swift_in_compiler')
911+
908912
# Check if we need to run lit tests using the legacy driver or the new driver
909913
# The default for existing test runs is to use the legacy driver.
910914
# The new driver is tested separately.

test/lit.site.cfg.in

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -166,16 +166,6 @@ config.swift_stdlib_enable_objc_interop = "@SWIFT_STDLIB_ENABLE_OBJC_INTEROP@" =
166166
# Configured in DarwinSDKs.cmake
167167
config.freestanding_sdk_name = "@SWIFT_SDK_FREESTANDING_LIB_SUBDIR@"
168168

169-
if "@BOOTSTRAPPING_MODE@" != "OFF":
170-
config.available_features.add('swift_in_compiler')
171-
172-
if "@BOOTSTRAPPING_MODE@" == 'HOSTTOOLS':
173-
config.available_features.add('hosttools_mode')
174-
elif "@BOOTSTRAPPING_MODE@" == 'BOOTSTRAPPING':
175-
config.available_features.add('bootstrapping_mode')
176-
elif "@BOOTSTRAPPING_MODE@" == 'BOOTSTRAPPING-WITH-HOSTLIBS':
177-
config.available_features.add('bootstrapping_with_hostlibs_mode')
178-
179169
if '@SWIFT_BUILD_SWIFT_SYNTAX@' == 'TRUE':
180170
config.available_features.add('swift_swift_parser')
181171

utils/build-presets.ini

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -952,15 +952,6 @@ mixin-preset=
952952
buildbot_linux
953953
mixin_buildbot_linux,no_test
954954

955-
[preset: buildbot_linux,no_test,bootstrapping_off]
956-
mixin-preset=
957-
buildbot_linux,no_test
958-
959-
skip-early-swift-driver
960-
skip-early-swiftsyntax
961-
962-
bootstrapping=off
963-
964955
[preset: buildbot_linux,no_assertions,no_test]
965956
mixin-preset=
966957
buildbot_linux,no_assertions

utils/build-script-impl

Lines changed: 7 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -386,24 +386,6 @@ function true_false() {
386386
esac
387387
}
388388

389-
function to_bootstrapping_mode() {
390-
case "$1" in
391-
false | FALSE | 0)
392-
echo "OFF"
393-
;;
394-
true | TRUE | 1 | "")
395-
if [[ "$(uname -s)" == "Darwin" ]] ; then
396-
echo "BOOTSTRAPPING-WITH-HOSTLIBS"
397-
else
398-
echo "BOOTSTRAPPING"
399-
fi
400-
;;
401-
*)
402-
echo `toupper $1`
403-
;;
404-
esac
405-
}
406-
407389
function to_varname() {
408390
# Uses `tr` because it is orders of magnitude faster than ${1//-/_} on long
409391
# strings, which happens when translating KNOWN_SETTINGS.
@@ -1655,6 +1637,13 @@ for host in "${ALL_HOSTS[@]}"; do
16551637
)
16561638
fi
16571639

1640+
if [[ "${BOOTSTRAPPING}" ]] ; then
1641+
swift_cmake_options=(
1642+
"${swift_cmake_options[@]}"
1643+
-DBOOTSTRAPPING_MODE:STRING=`toupper ${BOOTSTRAPPING}`
1644+
)
1645+
fi
1646+
16581647
if [[ "${NATIVE_CLANG_TOOLS_PATH}" ]] ; then
16591648
CLANG_BIN="${NATIVE_CLANG_TOOLS_PATH}"
16601649
if [[ ! -f "${CLANG_BIN}/clang" ]] ; then
@@ -1827,7 +1816,6 @@ for host in "${ALL_HOSTS[@]}"; do
18271816
-DCMAKE_CXX_FLAGS_RELWITHDEBINFO="-O2 -DNDEBUG"
18281817
-DCMAKE_BUILD_TYPE:STRING="${SWIFT_BUILD_TYPE}"
18291818
-DLLVM_ENABLE_ASSERTIONS:BOOL=$(true_false "${SWIFT_ENABLE_ASSERTIONS}")
1830-
-DBOOTSTRAPPING_MODE:STRING=$(to_bootstrapping_mode "${BOOTSTRAPPING}")
18311819
-DSWIFT_ANALYZE_CODE_COVERAGE:STRING=$(toupper "${SWIFT_ANALYZE_CODE_COVERAGE}")
18321820
-DSWIFT_STDLIB_BUILD_TYPE:STRING="${SWIFT_STDLIB_BUILD_TYPE}"
18331821
-DSWIFT_STDLIB_ASSERTIONS:BOOL=$(true_false "${SWIFT_STDLIB_ENABLE_ASSERTIONS}")

utils/build_swift/build_swift/driver_arguments.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -627,9 +627,9 @@ def create_argument_parser():
627627
help='A semi-colon split list of llvm components to install')
628628

629629
option('--bootstrapping', store('bootstrapping_mode'),
630-
choices=['off', 'hosttools', 'bootstrapping', 'bootstrapping-with-hostlibs'],
630+
choices=['hosttools', 'bootstrapping', 'bootstrapping-with-hostlibs'],
631631
help='The bootstrapping build mode for swift compiler modules. '
632-
'Available modes: `off`, `hosttools`, `bootstrapping`, '
632+
'Available modes: `hosttools`, `bootstrapping`, '
633633
'`bootstrapping-with-hostlibs`, `crosscompile`, and '
634634
'`crosscompile-with-hostlibs`')
635635

utils/build_swift/tests/expected_options.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -849,7 +849,7 @@ class BuildScriptImplOption(_BaseOption):
849849

850850
SetOption('--bootstrapping', dest='bootstrapping_mode'),
851851
ChoicesOption('--bootstrapping', dest='bootstrapping_mode',
852-
choices=['off', 'hosttools', 'bootstrapping',
852+
choices=['hosttools', 'bootstrapping',
853853
'bootstrapping-with-hostlibs']),
854854

855855
# NOTE: We'll need to manually test the behavior of these since they

validation-test/lit.site.cfg.in

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -145,9 +145,6 @@ config.swift_stdlib_enable_objc_interop = "@SWIFT_STDLIB_ENABLE_OBJC_INTEROP@" =
145145
# Configured in DarwinSDKs.cmake
146146
config.freestanding_sdk_name = "@SWIFT_SDK_FREESTANDING_LIB_SUBDIR@"
147147

148-
if "@BOOTSTRAPPING_MODE@" != "OFF":
149-
config.available_features.add('swift_in_compiler')
150-
151148
# Let the main config do the real work.
152149
config.test_exec_root = os.path.dirname(os.path.realpath(__file__))
153150
lit_config.load_config(config, "@SWIFT_SOURCE_DIR@/validation-test/lit.cfg")

0 commit comments

Comments
 (0)