From c6b5bac1bdb03c4086e5d044c0857d4b2f0dc1ba Mon Sep 17 00:00:00 2001 From: Eric Miotto Date: Tue, 21 Oct 2025 09:38:57 -0700 Subject: [PATCH 1/3] Runtimes: in macOS smoke test point to module cache from compiler build This will ensure we are not racing with other runs running on the same builders. Addresses rdar://163122836 --- CMakeLists.txt | 9 ++++++--- Runtimes/Core/CMakeLists.txt | 3 ++- Runtimes/Overlay/CMakeLists.txt | 3 ++- Runtimes/Supplemental/CMakeLists.txt | 18 ++++++++++++------ .../Differentiation/CMakeLists.txt | 3 ++- .../Supplemental/Distributed/CMakeLists.txt | 3 ++- .../Supplemental/Observation/CMakeLists.txt | 3 ++- Runtimes/Supplemental/Runtime/CMakeLists.txt | 3 ++- .../StringProcessing/CMakeLists.txt | 3 ++- .../Synchronization/CMakeLists.txt | 3 ++- Runtimes/Supplemental/Volatile/CMakeLists.txt | 3 ++- 11 files changed, 36 insertions(+), 18 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 9eb5c044bf96f..ed8c2938836cb 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1673,7 +1673,8 @@ if(SWIFT_ENABLE_NEW_RUNTIME_BUILD) -DCMAKE_COLOR_DIAGNOSTICS:BOOLEAN=${CMAKE_COLOR_DIAGNOSTICS} -DCMAKE_MAKE_PROGRAM=${CMAKE_MAKE_PROGRAM} -DSwiftCore_INSTALL_NESTED_SUBDIR=YES - -DSwiftCore_ENABLE_CONCURRENCY=${build_concurrency}) + -DSwiftCore_ENABLE_CONCURRENCY=${build_concurrency} + -DSwiftCore_MODULE_CACHE_PATH=${SWIFT_MODULE_CACHE_PATH}) if(NOT ${CMAKE_CROSSCOMPILING}) add_dependencies("${stdlib_target}-core" swift-frontend) endif() @@ -1700,7 +1701,8 @@ if(SWIFT_ENABLE_NEW_RUNTIME_BUILD) -DCMAKE_CXX_COMPILER_TARGET:STRING=${stdlib_target_triple} -DCMAKE_COLOR_DIAGNOSTICS:BOOLEAN=${CMAKE_COLOR_DIAGNOSTICS} -DCMAKE_MAKE_PROGRAM=${CMAKE_MAKE_PROGRAM} - -DCMAKE_FIND_PACKAGE_PREFER_CONFIG=TRUE) + -DCMAKE_FIND_PACKAGE_PREFER_CONFIG=TRUE + -DSwiftOverlay_MODULE_CACHE_PATH=${SWIFT_MODULE_CACHE_PATH}) ExternalProject_Add("${stdlib_target}-Supplemental" SOURCE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/Runtimes/Supplemental" @@ -1724,7 +1726,8 @@ if(SWIFT_ENABLE_NEW_RUNTIME_BUILD) -DCMAKE_CXX_COMPILER_TARGET:STRING=${stdlib_target_triple} -DCMAKE_COLOR_DIAGNOSTICS:BOOLEAN=${CMAKE_COLOR_DIAGNOSTICS} -DCMAKE_MAKE_PROGRAM=${CMAKE_MAKE_PROGRAM} - -DCMAKE_FIND_PACKAGE_PREFER_CONFIG=TRUE) + -DCMAKE_FIND_PACKAGE_PREFER_CONFIG=TRUE + -DSwiftSupplemental_MODULE_CACHE_PATH=${SWIFT_MODULE_CACHE_PATH}) endforeach() endforeach() endif() diff --git a/Runtimes/Core/CMakeLists.txt b/Runtimes/Core/CMakeLists.txt index a6428b6b425ab..f8281b4350227 100644 --- a/Runtimes/Core/CMakeLists.txt +++ b/Runtimes/Core/CMakeLists.txt @@ -194,7 +194,8 @@ add_compile_options( "$<$>,$>:SHELL:-Xfrontend -disable-objc-interop>" "$<$,$>:SHELL:-Xcc -Xclang -Xcc -fbuiltin-headers-in-system-modules>" "$<$,$>:-enable-library-evolution>" - "$<$,$>:SHELL:-Xfrontend -prespecialize-generic-metadata>") + "$<$,$>:SHELL:-Xfrontend -prespecialize-generic-metadata>" + "$<$,$>:SHELL:-module-cache-path ${SwiftCore_MODULE_CACHE_PATH}>") include(ExperimentalFeatures) diff --git a/Runtimes/Overlay/CMakeLists.txt b/Runtimes/Overlay/CMakeLists.txt index 61afeb8f6459d..367981340d51d 100644 --- a/Runtimes/Overlay/CMakeLists.txt +++ b/Runtimes/Overlay/CMakeLists.txt @@ -73,7 +73,8 @@ add_compile_options( "$<$:SHELL:-Xfrontend -enforce-exclusivity=unchecked>" "$<$:SHELL:-Xfrontend -target-min-inlining-version -Xfrontend min>" "$<$,$>:-enable-library-evolution>" - "$<$,$>:SHELL:-Xfrontend -prespecialize-generic-metadata>") + "$<$,$>:SHELL:-Xfrontend -prespecialize-generic-metadata>" + "$<$,$>:SHELL:-module-cache-path ${${PROJECT_NAME}_MODULE_CACHE_PATH}>") include(ExperimentalFeatures) diff --git a/Runtimes/Supplemental/CMakeLists.txt b/Runtimes/Supplemental/CMakeLists.txt index 0b64b98c7c7e1..b3eb4b551d6ec 100644 --- a/Runtimes/Supplemental/CMakeLists.txt +++ b/Runtimes/Supplemental/CMakeLists.txt @@ -55,7 +55,8 @@ if(SwiftRuntime_ENABLE_stringprocessing) # To ensure incremental builds work as expected BUILD_ALWAYS 1 CMAKE_ARGS - ${COMMON_OPTIONS}) + ${COMMON_OPTIONS} + -DSwiftStringProcessing_MODULE_CACHE_PATH=${SwiftSupplemental_MODULE_CACHE_PATH}) endif() # Synchronization @@ -68,7 +69,8 @@ if(SwiftRuntime_ENABLE_synchronization) # To ensure incremental builds work as expected BUILD_ALWAYS 1 CMAKE_ARGS - ${COMMON_OPTIONS}) + ${COMMON_OPTIONS} + -DSwiftSynchronization_MODULE_CACHE_PATH=${SwiftSupplemental_MODULE_CACHE_PATH}) endif() # Distributed @@ -81,7 +83,8 @@ if(SwiftRuntime_ENABLE_distributed) # To ensure incremental builds work as expected BUILD_ALWAYS 1 CMAKE_ARGS - ${COMMON_OPTIONS}) + ${COMMON_OPTIONS} + -DSwiftDistributed_MODULE_CACHE_PATH=${SwiftSupplemental_MODULE_CACHE_PATH}) endif() @@ -95,7 +98,8 @@ if(SwiftRuntime_ENABLE_differentiation) # To ensure incremental builds work as expected BUILD_ALWAYS 1 CMAKE_ARGS - ${COMMON_OPTIONS}) + ${COMMON_OPTIONS} + -DSwiftDifferentiation_MODULE_CACHE_PATH=${SwiftSupplemental_MODULE_CACHE_PATH}) endif() # Observation @@ -108,7 +112,8 @@ if(SwiftRuntime_ENABLE_observation) # To ensure incremental builds work as expected BUILD_ALWAYS 1 CMAKE_ARGS - ${COMMON_OPTIONS}) + ${COMMON_OPTIONS} + -DSwiftObservation_MODULE_CACHE_PATH=${SwiftSupplemental_MODULE_CACHE_PATH}) endif() # Runtime @@ -121,5 +126,6 @@ if(SwiftRuntime_ENABLE_runtime) # To ensure incremental builds work as expected BUILD_ALWAYS 1 CMAKE_ARGS - ${COMMON_OPTIONS}) + ${COMMON_OPTIONS} + -DSwiftRuntime_MODULE_CACHE_PATH=${SwiftSupplemental_MODULE_CACHE_PATH}) endif() diff --git a/Runtimes/Supplemental/Differentiation/CMakeLists.txt b/Runtimes/Supplemental/Differentiation/CMakeLists.txt index 3e0b42124aeff..f021e6df914b1 100644 --- a/Runtimes/Supplemental/Differentiation/CMakeLists.txt +++ b/Runtimes/Supplemental/Differentiation/CMakeLists.txt @@ -75,7 +75,8 @@ add_compile_options( "$<$:SHELL:-enable-experimental-feature MemberImportVisibility>" "$<$:SHELL:-Xfrontend -enforce-exclusivity=unchecked>" "$<$:SHELL:-Xfrontend -target-min-inlining-version -Xfrontend min>" - $<$,$>:-enable-library-evolution>) + $<$,$>:-enable-library-evolution> + "$<$,$>:SHELL:-module-cache-path ${${PROJECT_NAME}_MODULE_CACHE_PATH}>") # LNK4049: symbol 'symbol' defined in 'filename.obj' is imported # LNK4286: symbol 'symbol' defined in 'filename_1.obj' is imported by 'filename_2.obj' diff --git a/Runtimes/Supplemental/Distributed/CMakeLists.txt b/Runtimes/Supplemental/Distributed/CMakeLists.txt index a802147d72c7e..e35140e9662e5 100644 --- a/Runtimes/Supplemental/Distributed/CMakeLists.txt +++ b/Runtimes/Supplemental/Distributed/CMakeLists.txt @@ -82,7 +82,8 @@ add_compile_options( "$<$:SHELL:-Xfrontend -enable-lexical-lifetimes=false>" "$<$:-warn-implicit-overrides>" "$<$,$>:-enable-library-evolution>" - "$<$,$>:SHELL:-Xfrontend -prespecialize-generic-metadata>") + "$<$,$>:SHELL:-Xfrontend -prespecialize-generic-metadata>" + "$<$,$>:SHELL:-module-cache-path ${${PROJECT_NAME}_MODULE_CACHE_PATH}>") # LNK4049: symbol 'symbol' defined in 'filename.obj' is imported # LNK4286: symbol 'symbol' defined in 'filename_1.obj' is imported by 'filename_2.obj' diff --git a/Runtimes/Supplemental/Observation/CMakeLists.txt b/Runtimes/Supplemental/Observation/CMakeLists.txt index 98ce40a292f5e..444f7ef8953c4 100644 --- a/Runtimes/Supplemental/Observation/CMakeLists.txt +++ b/Runtimes/Supplemental/Observation/CMakeLists.txt @@ -80,7 +80,8 @@ add_compile_options( "$<$:SHELL:-Xfrontend -enable-lexical-lifetimes=false>" "$<$:-warn-implicit-overrides>" "$<$,$>:-enable-library-evolution>" - "$<$,$>:SHELL:-Xfrontend -prespecialize-generic-metadata>") + "$<$,$>:SHELL:-Xfrontend -prespecialize-generic-metadata>" + "$<$,$>:SHELL:-module-cache-path ${${PROJECT_NAME}_MODULE_CACHE_PATH}>") # LNK4049: symbol 'symbol' defined in 'filename.obj' is imported # LNK4286: symbol 'symbol' defined in 'filename_1.obj' is imported by 'filename_2.obj' diff --git a/Runtimes/Supplemental/Runtime/CMakeLists.txt b/Runtimes/Supplemental/Runtime/CMakeLists.txt index 099fa4945bea2..1d03c15b7181d 100644 --- a/Runtimes/Supplemental/Runtime/CMakeLists.txt +++ b/Runtimes/Supplemental/Runtime/CMakeLists.txt @@ -89,7 +89,8 @@ add_compile_options( "$<$:-cxx-interoperability-mode=default>" "$<$:SHELL:-Xfrontend -experimental-spi-only-imports>" "$<$,$>:-enable-library-evolution>" - "$<$,$>:SHELL:-Xfrontend -prespecialize-generic-metadata>") + "$<$,$>:SHELL:-Xfrontend -prespecialize-generic-metadata>" + "$<$,$>:SHELL:-module-cache-path ${${PROJECT_NAME}_MODULE_CACHE_PATH}>") # LNK4049: symbol 'symbol' defined in 'filename.obj' is imported # LNK4286: symbol 'symbol' defined in 'filename_1.obj' is imported by 'filename_2.obj' diff --git a/Runtimes/Supplemental/StringProcessing/CMakeLists.txt b/Runtimes/Supplemental/StringProcessing/CMakeLists.txt index 709ba16918411..837ff1a76b9b7 100644 --- a/Runtimes/Supplemental/StringProcessing/CMakeLists.txt +++ b/Runtimes/Supplemental/StringProcessing/CMakeLists.txt @@ -57,7 +57,8 @@ add_compile_options( "$<$:SHELL:-Xfrontend -disable-implicit-string-processing-module-import>" "$<$:-warn-implicit-overrides>" "$<$,$>:-enable-library-evolution>" - "$<$,$>:SHELL:-Xfrontend -prespecialize-generic-metadata>") + "$<$,$>:SHELL:-Xfrontend -prespecialize-generic-metadata>" + "$<$,$>:SHELL:-module-cache-path ${${PROJECT_NAME}_MODULE_CACHE_PATH}>") # LNK4049: symbol 'symbol' defined in 'filename.obj' is imported # LNK4286: symbol 'symbol' defined in 'filename_1.obj' is imported by 'filename_2.obj' diff --git a/Runtimes/Supplemental/Synchronization/CMakeLists.txt b/Runtimes/Supplemental/Synchronization/CMakeLists.txt index 2ab0500c53d94..e28b156205fba 100644 --- a/Runtimes/Supplemental/Synchronization/CMakeLists.txt +++ b/Runtimes/Supplemental/Synchronization/CMakeLists.txt @@ -93,7 +93,8 @@ add_compile_options( "$<$:SHELL:-Xfrontend -enable-lexical-lifetimes=false>" "$<$:-warn-implicit-overrides>" "$<$,$>:-enable-library-evolution>" - "$<$,$>:SHELL:-Xfrontend -prespecialize-generic-metadata>") + "$<$,$>:SHELL:-Xfrontend -prespecialize-generic-metadata>" + "$<$,$>:SHELL:-module-cache-path ${${PROJECT_NAME}_MODULE_CACHE_PATH}>") # LNK4049: symbol 'symbol' defined in 'filename.obj' is imported # LNK4286: symbol 'symbol' defined in 'filename_1.obj' is imported by 'filename_2.obj' diff --git a/Runtimes/Supplemental/Volatile/CMakeLists.txt b/Runtimes/Supplemental/Volatile/CMakeLists.txt index ad8fc2428852a..d97a5c38f3dd0 100644 --- a/Runtimes/Supplemental/Volatile/CMakeLists.txt +++ b/Runtimes/Supplemental/Volatile/CMakeLists.txt @@ -68,7 +68,8 @@ add_compile_options( $<$:-nostdlibimport> $<$:-strict-memory-safety> "$<$,$>:-enable-library-evolution>" - "$<$,$>:SHELL:-Xfrontend -prespecialize-generic-metadata>") + "$<$,$>:SHELL:-Xfrontend -prespecialize-generic-metadata>" + "$<$,$>:SHELL:-module-cache-path ${${PROJECT_NAME}_MODULE_CACHE_PATH}>") # LNK4049: symbol 'symbol' defined in 'filename.obj' is imported # LNK4286: symbol 'symbol' defined in 'filename_1.obj' is imported by 'filename_2.obj' From fe772792b2b459aa32f4daafa18eba26f664b0ee Mon Sep 17 00:00:00 2001 From: Eric Miotto Date: Tue, 21 Oct 2025 11:01:48 -0700 Subject: [PATCH 2/3] Attempt to use separate caches for Core, Overlay and Supplemental:wq --- CMakeLists.txt | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index ed8c2938836cb..ff0ba86469e39 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1674,7 +1674,7 @@ if(SWIFT_ENABLE_NEW_RUNTIME_BUILD) -DCMAKE_MAKE_PROGRAM=${CMAKE_MAKE_PROGRAM} -DSwiftCore_INSTALL_NESTED_SUBDIR=YES -DSwiftCore_ENABLE_CONCURRENCY=${build_concurrency} - -DSwiftCore_MODULE_CACHE_PATH=${SWIFT_MODULE_CACHE_PATH}) + -DSwiftCore_MODULE_CACHE_PATH=${SWIFT_MODULE_CACHE_PATH}-runtimes-core) if(NOT ${CMAKE_CROSSCOMPILING}) add_dependencies("${stdlib_target}-core" swift-frontend) endif() @@ -1702,7 +1702,7 @@ if(SWIFT_ENABLE_NEW_RUNTIME_BUILD) -DCMAKE_COLOR_DIAGNOSTICS:BOOLEAN=${CMAKE_COLOR_DIAGNOSTICS} -DCMAKE_MAKE_PROGRAM=${CMAKE_MAKE_PROGRAM} -DCMAKE_FIND_PACKAGE_PREFER_CONFIG=TRUE - -DSwiftOverlay_MODULE_CACHE_PATH=${SWIFT_MODULE_CACHE_PATH}) + -DSwiftOverlay_MODULE_CACHE_PATH=${SWIFT_MODULE_CACHE_PATH}-runtimes-overlay) ExternalProject_Add("${stdlib_target}-Supplemental" SOURCE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/Runtimes/Supplemental" @@ -1727,7 +1727,7 @@ if(SWIFT_ENABLE_NEW_RUNTIME_BUILD) -DCMAKE_COLOR_DIAGNOSTICS:BOOLEAN=${CMAKE_COLOR_DIAGNOSTICS} -DCMAKE_MAKE_PROGRAM=${CMAKE_MAKE_PROGRAM} -DCMAKE_FIND_PACKAGE_PREFER_CONFIG=TRUE - -DSwiftSupplemental_MODULE_CACHE_PATH=${SWIFT_MODULE_CACHE_PATH}) + -DSwiftSupplemental_MODULE_CACHE_PATH=${SWIFT_MODULE_CACHE_PATH}-runtimes-supplemental) endforeach() endforeach() endif() From f90359671b9b8704fd0a9e2d0380cdd1dcf2e6b7 Mon Sep 17 00:00:00 2001 From: Eric Miotto Date: Tue, 21 Oct 2025 12:08:53 -0700 Subject: [PATCH 3/3] Attempt to use separate caches for each Supplemental library --- Runtimes/Supplemental/CMakeLists.txt | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/Runtimes/Supplemental/CMakeLists.txt b/Runtimes/Supplemental/CMakeLists.txt index b3eb4b551d6ec..8bdfffbbf5391 100644 --- a/Runtimes/Supplemental/CMakeLists.txt +++ b/Runtimes/Supplemental/CMakeLists.txt @@ -56,7 +56,7 @@ if(SwiftRuntime_ENABLE_stringprocessing) BUILD_ALWAYS 1 CMAKE_ARGS ${COMMON_OPTIONS} - -DSwiftStringProcessing_MODULE_CACHE_PATH=${SwiftSupplemental_MODULE_CACHE_PATH}) + -DSwiftStringProcessing_MODULE_CACHE_PATH=${SwiftSupplemental_MODULE_CACHE_PATH}-stringprocessing) endif() # Synchronization @@ -70,7 +70,7 @@ if(SwiftRuntime_ENABLE_synchronization) BUILD_ALWAYS 1 CMAKE_ARGS ${COMMON_OPTIONS} - -DSwiftSynchronization_MODULE_CACHE_PATH=${SwiftSupplemental_MODULE_CACHE_PATH}) + -DSwiftSynchronization_MODULE_CACHE_PATH=${SwiftSupplemental_MODULE_CACHE_PATH}-synchronization) endif() # Distributed @@ -84,7 +84,7 @@ if(SwiftRuntime_ENABLE_distributed) BUILD_ALWAYS 1 CMAKE_ARGS ${COMMON_OPTIONS} - -DSwiftDistributed_MODULE_CACHE_PATH=${SwiftSupplemental_MODULE_CACHE_PATH}) + -DSwiftDistributed_MODULE_CACHE_PATH=${SwiftSupplemental_MODULE_CACHE_PATH}-distributed) endif() @@ -99,7 +99,7 @@ if(SwiftRuntime_ENABLE_differentiation) BUILD_ALWAYS 1 CMAKE_ARGS ${COMMON_OPTIONS} - -DSwiftDifferentiation_MODULE_CACHE_PATH=${SwiftSupplemental_MODULE_CACHE_PATH}) + -DSwiftDifferentiation_MODULE_CACHE_PATH=${SwiftSupplemental_MODULE_CACHE_PATH}-differentiation) endif() # Observation @@ -113,7 +113,7 @@ if(SwiftRuntime_ENABLE_observation) BUILD_ALWAYS 1 CMAKE_ARGS ${COMMON_OPTIONS} - -DSwiftObservation_MODULE_CACHE_PATH=${SwiftSupplemental_MODULE_CACHE_PATH}) + -DSwiftObservation_MODULE_CACHE_PATH=${SwiftSupplemental_MODULE_CACHE_PATH}-observation) endif() # Runtime @@ -127,5 +127,5 @@ if(SwiftRuntime_ENABLE_runtime) BUILD_ALWAYS 1 CMAKE_ARGS ${COMMON_OPTIONS} - -DSwiftRuntime_MODULE_CACHE_PATH=${SwiftSupplemental_MODULE_CACHE_PATH}) + -DSwiftRuntime_MODULE_CACHE_PATH=${SwiftSupplemental_MODULE_CACHE_PATH}-runtime) endif()