Revert "Ninja: Avoid re-running CMake on next build after regeneration"

Revert commit 6fac24d7 (Ninja: Avoid re-running CMake on next build
after regeneration, 2014-01-09).  The files reported by the method
cmMakefile::GetOutputFiles() must cause CMake to re-run only if they are
missing and without considering a timestamp.  Therefore they cannot be
listed as outputs of the re-run rule or Ninja will re-run CMake every
time because the timestamp of configure_file outputs does not change.

Another solution will have to be found to the original problem.
This commit is contained in:
Brad King 2014-01-15 16:33:22 -05:00
parent 6fac24d750
commit 7985968900
1 changed files with 5 additions and 24 deletions

View File

@ -1086,46 +1086,27 @@ void cmGlobalNinjaGenerator::WriteTargetRebuildManifest(std::ostream& os)
/*depfile=*/ "", /*depfile=*/ "",
/*rspfile=*/ "", /*rspfile=*/ "",
/*rspcontent*/ "", /*rspcontent*/ "",
/*restat=*/ true, /*restat=*/ false,
/*generator=*/ true); /*generator=*/ true);
cmNinjaDeps implicitDeps, outputs, temp; cmNinjaDeps implicitDeps;
outputs.push_back(NINJA_BUILD_FILE);
for (std::vector<cmLocalGenerator *>::const_iterator i = for (std::vector<cmLocalGenerator *>::const_iterator i =
this->LocalGenerators.begin(); i != this->LocalGenerators.end(); ++i) { this->LocalGenerators.begin(); i != this->LocalGenerators.end(); ++i) {
const std::vector<std::string>& lf = (*i)->GetMakefile()->GetListFiles(); const std::vector<std::string>& lf = (*i)->GetMakefile()->GetListFiles();
implicitDeps.insert(implicitDeps.end(), lf.begin(), lf.end()); implicitDeps.insert(implicitDeps.end(), lf.begin(), lf.end());
const std::vector<std::string>& of = (*i)->GetMakefile()->GetOutputFiles(); const std::vector<std::string>& of = (*i)->GetMakefile()->GetOutputFiles();
temp.insert(temp.end(), of.begin(), of.end()); implicitDeps.insert(implicitDeps.end(), of.begin(), of.end());
} }
//Add the CMakeCache.txt file to the implicit depends so that we catch
//when somebody manually modifies the file.
implicitDeps.push_back("CMakeCache.txt");
//make sure nothing is in implicit depends twice
std::sort(implicitDeps.begin(), implicitDeps.end()); std::sort(implicitDeps.begin(), implicitDeps.end());
implicitDeps.erase(std::unique(implicitDeps.begin(), implicitDeps.end()), implicitDeps.erase(std::unique(implicitDeps.begin(), implicitDeps.end()),
implicitDeps.end()); implicitDeps.end());
implicitDeps.push_back("CMakeCache.txt");
//make sure nothing is in outputs depends twice
std::sort(temp.begin(), temp.end());
temp.erase(std::unique(temp.begin(), temp.end()),
temp.end());
//make sure that anything that is in implicitDeps is also NOT in outputs
std::set_difference(temp.begin(),
temp.end(),
implicitDeps.begin(),
implicitDeps.end(),
std::back_inserter(outputs));
this->WriteBuild(os, this->WriteBuild(os,
"Re-run CMake if any of its inputs changed.", "Re-run CMake if any of its inputs changed.",
"RERUN_CMAKE", "RERUN_CMAKE",
outputs, /*outputs=*/ cmNinjaDeps(1, NINJA_BUILD_FILE),
/*explicitDeps=*/ cmNinjaDeps(), /*explicitDeps=*/ cmNinjaDeps(),
implicitDeps, implicitDeps,
/*orderOnlyDeps=*/ cmNinjaDeps(), /*orderOnlyDeps=*/ cmNinjaDeps(),