From c5ef7fac239d24e72ae09d48c3ab4ae02e57603d Mon Sep 17 00:00:00 2001 From: Jeremy Day Date: Mon, 22 Apr 2024 12:25:02 -0700 Subject: 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 --- Source/cmNinjaTargetGenerator.cxx | 5 +++++ Tests/RunCMake/Swift/IncrementalSwift-second-stdout.txt | 4 ++-- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/Source/cmNinjaTargetGenerator.cxx b/Source/cmNinjaTargetGenerator.cxx index e2642b2..c52a012 100644 --- a/Source/cmNinjaTargetGenerator.cxx +++ b/Source/cmNinjaTargetGenerator.cxx @@ -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 = diff --git a/Tests/RunCMake/Swift/IncrementalSwift-second-stdout.txt b/Tests/RunCMake/Swift/IncrementalSwift-second-stdout.txt index 8e5b97c..ccd8aee 100644 --- a/Tests/RunCMake/Swift/IncrementalSwift-second-stdout.txt +++ b/Tests/RunCMake/Swift/IncrementalSwift-second-stdout.txt @@ -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)? -- cgit v0.12