line-directive: Stop expanding response files

`line-directive` was expanding response files for the swiftc invocation,
which was causing issues on CI when the file list got too long. This
changes the script to stop expanding response files and pass them as-is
to the swiftc invocation instead. The format for the response files was
also incorrect, with each individual file being quoted, so this fixes
the CMake script generating those.
Finally, this changes `line-directive` to dump the command line on
failure.
This commit is contained in:
Fabrice de Gans
2025-06-04 13:16:50 -07:00
parent dd57d4dd85
commit 810588b0c5
2 changed files with 22 additions and 13 deletions

View File

@@ -1015,13 +1015,13 @@ function(_compile_swift_files
# need to work around this by avoiding long command line arguments. This can
# be achieved by writing the list of file paths to a file, then reading that
# list in the Python script.
string(REPLACE ";" "'\n'" source_files_quoted "${source_files}")
string(SHA1 file_name "'${source_files_quoted}'")
string(REPLACE ";" "\n" source_files_quoted "${source_files}")
string(SHA1 file_name "${source_files_quoted}")
set(file_path_target "filelist-${file_name}")
set(file_path "${CMAKE_CURRENT_BINARY_DIR}/${file_name}.txt")
if (NOT TARGET ${file_path_target})
file(WRITE "${file_path}.tmp" "'${source_files_quoted}'")
file(WRITE "${file_path}.tmp" "${source_files_quoted}")
add_custom_command_target(unused_var
COMMAND ${CMAKE_COMMAND} -E copy_if_different "${file_path}.tmp" "${file_path}"
CUSTOM_TARGET_NAME ${file_path_target}