Swift/Ninja: Fix missing OFM in CMP0157 OLD behavior

The CMP0157 old behavior omitted the output-file-map after the Swift
build split because we stopped calling `EmitSwiftDependencyInfo` when we
could not split the build because we didn't call
`WriteObjectBuildStatement`. If we can't split the build, then we still
need to include the OFM information to not break incremental builds.
This commit is contained in:
Evan Wilde
2023-12-18 19:26:41 -08:00
parent daf8da8c80
commit d31b48816c
3 changed files with 14 additions and 4 deletions

View File

@@ -1142,7 +1142,8 @@ void cmNinjaTargetGenerator::WriteObjectBuildStatements(
std::vector<cmSourceFile const*> swiftSources;
for (cmSourceFile const* sf : objectSources) {
if (sf->GetLanguage() == "Swift") {
if (this->GetLocalGenerator()->IsSplitSwiftBuild() &&
sf->GetLanguage() == "Swift") {
swiftSources.push_back(sf);
} else {
this->WriteObjectBuildStatement(sf, config, fileConfig,

View File

@@ -0,0 +1 @@
swiftc .* -output-file-map CMakeFiles/greetings_default.dir//output-file-map.json .*

View File

@@ -49,9 +49,17 @@ elseif(RunCMake_GENERATOR STREQUAL Ninja)
run_cmake_command(IncrementalSwift-second ${CMAKE_COMMAND} --build ${IncrementalSwift_TEST_BINARY_DIR} -- -d explain)
endblock()
run_cmake(CMP0157-NEW)
run_cmake(CMP0157-OLD)
run_cmake(CMP0157-WARN)
block()
set(CMP0157-OLD_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/CMP0157-OLD-build)
set(CMP0157-OLD_TEST_NO_CLEAN 1)
set(CMP0157-OLD_TEST_OUTPUT_MERGE 1)
run_cmake(CMP0157-NEW)
run_cmake(CMP0157-OLD)
# -n: dry-run to avoid actually compiling, -v: verbose to capture executed command
run_cmake_command(CMP0157-OLD-build ${CMAKE_COMMAND} --build ${CMP0157-OLD_TEST_BINARY_DIR} -- -n -v)
run_cmake(CMP0157-WARN)
endblock()
endif()
elseif(RunCMake_GENERATOR STREQUAL "Ninja Multi-Config")