Skip to content

Commit e30688d

Browse files
committed
libswift: fix dependencies in the bootstrapping build mode
swiftDarwin and swiftOnoneSupport didn't depend on building the Swift core library. This was a subtle bug, because the compiler just picked up the module from the SDK instead of the (still building) Swift module. It only resulted in compiler errors if the SDK swiftinterface was too new to be parsable by the compiler.
1 parent 09552ab commit e30688d

File tree

4 files changed

+14
-4
lines changed

4 files changed

+14
-4
lines changed

cmake/modules/SwiftUtils.cmake

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,12 @@ function(add_bootstrapping_target bootstrapping)
117117
set(target "bootstrapping${bootstrapping}-all")
118118
add_custom_target(${target})
119119

120+
if(${LIBSWIFT_BUILD_MODE} STREQUAL "BOOTSTRAPPING")
121+
set(lib_target "bootstrapping${bootstrapping}-corelib")
122+
add_custom_target(${lib_target})
123+
add_dependencies(${target} ${lib_target})
124+
endif()
125+
120126
if(SWIFT_PATH_TO_LIBICU_BUILD)
121127
# Need to symlink the libicu libraries to be able to run
122128
# the bootstrapping compiler with a custom library path.

stdlib/public/Platform/CMakeLists.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,10 +55,12 @@ if(${LIBSWIFT_BUILD_MODE} STREQUAL "BOOTSTRAPPING" AND
5555

5656
add_swift_target_library_single(swiftDarwin-bootstrapping0 swiftDarwin
5757
${swiftDarwin_common_bootstrapping_options}
58+
FILE_DEPENDS bootstrapping0-corelib
5859
BOOTSTRAPPING 0)
5960

6061
add_swift_target_library_single(swiftDarwin-bootstrapping1 swiftDarwin
6162
${swiftDarwin_common_bootstrapping_options}
63+
FILE_DEPENDS bootstrapping1-corelib
6264
BOOTSTRAPPING 1)
6365

6466
add_dependencies(bootstrapping1-all swiftDarwin-bootstrapping1)

stdlib/public/SwiftOnoneSupport/CMakeLists.txt

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,17 +24,19 @@ if(CMAKE_BUILD_TYPE STREQUAL "Debug" AND ${LIBSWIFT_BUILD_MODE} STREQUAL "BOOTST
2424

2525
add_swift_target_library_single(swiftSwiftOnoneSupport-bootstrapping0 swiftSwiftOnoneSupport
2626
${swiftOnoneSupport_common_bootstrapping_options}
27+
FILE_DEPENDS swiftCore-bootstrapping0
2728
BOOTSTRAPPING 0)
2829

29-
add_dependencies(bootstrapping0-all swiftSwiftOnoneSupport-bootstrapping0)
30+
add_dependencies(bootstrapping0-corelib swiftSwiftOnoneSupport-bootstrapping0)
3031

3132
# Bootstrapping - stage 1
3233

3334
add_swift_target_library_single(swiftSwiftOnoneSupport-bootstrapping1 swiftSwiftOnoneSupport
3435
${swiftOnoneSupport_common_bootstrapping_options}
36+
FILE_DEPENDS swiftCore-bootstrapping1
3537
BOOTSTRAPPING 1)
3638

37-
add_dependencies(bootstrapping1-all swiftSwiftOnoneSupport-bootstrapping1)
39+
add_dependencies(bootstrapping1-corelib swiftSwiftOnoneSupport-bootstrapping1)
3840

3941
endif()
4042

stdlib/public/core/CMakeLists.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -368,8 +368,8 @@ if(${LIBSWIFT_BUILD_MODE} STREQUAL "BOOTSTRAPPING")
368368
symlink-headers-bootstrapping1 ${swiftCore_common_dependencies}
369369
BOOTSTRAPPING 1)
370370

371-
add_dependencies(bootstrapping1-all swiftCore-bootstrapping1)
372-
add_dependencies(bootstrapping0-all swiftCore-bootstrapping0)
371+
add_dependencies(bootstrapping1-corelib swiftCore-bootstrapping1)
372+
add_dependencies(bootstrapping0-corelib swiftCore-bootstrapping0)
373373
endif()
374374

375375
add_swift_target_library(swiftCore

0 commit comments

Comments
 (0)