From ec1e589bec6567c955db24adeb6294258e3db463 Mon Sep 17 00:00:00 2001 From: Ben Boeckel Date: Tue, 21 Nov 2023 09:19:08 -0500 Subject: Ninja: Revert exact collation dependencies for 3.27 Revert commit b6a5382217 (Ninja: depend on language module information files directly, 2023-02-10, v3.27.0-rc1~502^2) from !8197. This reverts the "exact dependencies" for collation inputs and returns to "get all targets" and target-ordering. Use of exact dependencies caused a parade of use cases that had not been tested previously to be found and need fixing over the 3.27 release series. To stop the flow on 3.27, revert to the 3.26 strategy. We will continue in 3.28. Note that this is a restoration of 3.26 semantics where incremental rebuilds may be subtly incorrect in the presence of stale `Modules.json` files. However, since C++ support is experimental and Fortran has always had this problem as of 3.27, it is not considered a regression. See: #25112 See: #25123 See: #25252 See: #25365 See: #25417 See: #25425 --- Source/cmNinjaTargetGenerator.cxx | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/Source/cmNinjaTargetGenerator.cxx b/Source/cmNinjaTargetGenerator.cxx index d712d71..bc04d1f 100644 --- a/Source/cmNinjaTargetGenerator.cxx +++ b/Source/cmNinjaTargetGenerator.cxx @@ -1034,11 +1034,6 @@ void cmNinjaTargetGenerator::WriteObjectBuildStatements( cmNinjaBuild build(this->LanguageDyndepRule(language, config)); build.Outputs.push_back(this->GetDyndepFilePath(language, config)); - build.ImplicitOuts.push_back( - cmStrCat(this->Makefile->GetCurrentBinaryDirectory(), '/', - this->LocalGenerator->GetTargetDirectory(this->GeneratorTarget), - this->GetGlobalGenerator()->ConfigDirectory(config), '/', - language, "Modules.json")); for (auto const& scanFiles : scanningFiles) { if (!scanFiles.ScanningOutput.empty()) { build.ExplicitDeps.push_back(scanFiles.ScanningOutput); @@ -1050,10 +1045,17 @@ void cmNinjaTargetGenerator::WriteObjectBuildStatements( this->WriteTargetDependInfo(language, config); - for (std::string const& l : - this->GetLinkedTargetDirectories(language, config)) { - build.ImplicitDeps.push_back(cmStrCat(l, '/', language, "Modules.json")); - } + // Make sure dyndep files for all our dependencies have already + // been generated so that the 'Modules.json' files they + // produced as side-effects are available for us to read. + // Ideally we should depend on the 'Modules.json' files + // from our dependencies directly, but we don't know which of + // our dependencies produces them. Fixing this will require + // refactoring the Ninja generator to generate targets in + // dependency order so that we can collect the needed information. + this->GetLocalGenerator()->AppendTargetDepends( + this->GeneratorTarget, build.OrderOnlyDeps, config, fileConfig, + DependOnTargetArtifact); this->GetGlobalGenerator()->WriteBuild(this->GetImplFileStream(fileConfig), build); -- cgit v0.12