Skip to content

Commit 9360398

Browse files
committed
Move availability args to response file
The availability flags keep increasing the number of characters on the command line overflowing the maximum character length on Windows and making the commands harder to read. This patch moves the generated arguments into a separate response file so that they can continue to grow without running into argument length limitations.
1 parent 8ea7657 commit 9360398

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

Runtimes/Core/cmake/modules/AvailabilityMacros.cmake

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ configure_file("${SwiftCore_SWIFTC_SOURCE_DIR}/utils/availability-macros.def"
44
file(STRINGS "${CMAKE_CURRENT_BINARY_DIR}/availability-macros.def" availability_defs)
55
list(FILTER availability_defs EXCLUDE REGEX "^\\s*(#.*)?$")
66
foreach(def ${availability_defs})
7-
add_compile_options("$<$<COMPILE_LANGUAGE:Swift>:SHELL:-Xfrontend -define-availability -Xfrontend \"${def}\">")
7+
list(APPEND availability_definitions "-Xfrontend -define-availability -Xfrontend \"${def}\"")
88

99
if("${def}" MATCHES "SwiftStdlib .*")
1010
# For each SwiftStdlib x.y, also define StdlibDeploymentTarget x.y, which,
@@ -31,6 +31,12 @@ foreach(def ${availability_defs})
3131
endif()
3232
endif()
3333
endif()
34-
add_compile_options("$<$<COMPILE_LANGUAGE:Swift>:SHELL:-Xfrontend -define-availability -Xfrontend \"${current}\">")
34+
list(APPEND availability_definitions "-Xfrontend -define-availability -Xfrontend \"${current}\"")
3535
endif()
3636
endforeach()
37+
38+
list(JOIN availability_definitions "\n" availability_definitions)
39+
file(GENERATE
40+
OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/availability-macros.rsp"
41+
CONTENT "${availability_definitions}")
42+
add_compile_options("$<$<COMPILE_LANGUAGE:Swift>:SHELL:${CMAKE_Swift_RESPONSE_FILE_FLAG}${CMAKE_CURRENT_BINARY_DIR}/availability-macros.rsp>")

0 commit comments

Comments
 (0)