Swift/Ninja: Add description to Swift object build steps

By default, Ninja displays the full build command for the object which
is very verbose. Warnings are often lost in the noise, and compile
errors take some searching to find. If a build step fails, Ninja will
still print out the full build command, so there's no loss of useful
information.

Fixes: #25853
This commit is contained in:
Jeremy Day
2024-04-22 12:25:02 -07:00
parent f1b3143ee9
commit c5ef7fac23
2 changed files with 7 additions and 2 deletions

View File

@@ -1992,6 +1992,11 @@ void cmNinjaTargetGenerator::WriteSwiftObjectBuildStatement(
std::string const moduleFilepath =
this->ConvertToNinjaPath(cmStrCat(moduleDirectory, '/', moduleFilename));
vars.emplace("description",
cmStrCat("Building Swift Module '", moduleName, "' with ",
sources.size(),
sources.size() == 1 ? " source" : " sources"));
bool const isSingleOutput = [this, compileMode]() -> bool {
bool isMultiThread = false;
if (cmValue numThreadStr =

View File

@@ -1,3 +1,3 @@
.*Building Swift object A.swiftmodule CMakeFiles(/|\\)A.dir(/|\\)a.swift.o(bj)?
.*Building Swift object B.swiftmodule CMakeFiles(/|\\)B.dir(/|\\)b.swift.o(bj)?
.*Building Swift Module 'A' with 1 source
.*Building Swift Module 'B' with 1 source
FAILED: B.swiftmodule CMakeFiles(/|\\)B.dir(/|\\)b.swift.o(bj)?