From 0d0cb136fb19d96f857f8d7da918e18038d5b627 Mon Sep 17 00:00:00 2001 From: Sebastian Holtermann Date: Thu, 30 May 2019 13:23:06 +0200 Subject: Ninja: Use cmNinjaBuild instead of WritePhonyBuild --- Source/cmNinjaUtilityTargetGenerator.cxx | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/Source/cmNinjaUtilityTargetGenerator.cxx b/Source/cmNinjaUtilityTargetGenerator.cxx index 9d05110..1225cbd 100644 --- a/Source/cmNinjaUtilityTargetGenerator.cxx +++ b/Source/cmNinjaUtilityTargetGenerator.cxx @@ -19,6 +19,7 @@ #include #include #include +#include #include cmNinjaUtilityTargetGenerator::cmNinjaUtilityTargetGenerator( @@ -41,8 +42,9 @@ void cmNinjaUtilityTargetGenerator::Generate() utilCommandName += this->GetTargetName() + ".util"; utilCommandName = this->ConvertToNinjaPath(utilCommandName); + cmNinjaBuild phonyBuild("phony"); std::vector commands; - cmNinjaDeps deps, outputs, util_outputs(1, utilCommandName); + cmNinjaDeps deps, util_outputs(1, utilCommandName); bool uses_terminal = false; { @@ -86,13 +88,13 @@ void cmNinjaUtilityTargetGenerator::Generate() } } - lg->AppendTargetOutputs(genTarget, outputs); + lg->AppendTargetOutputs(genTarget, phonyBuild.Outputs); lg->AppendTargetDepends(genTarget, deps); if (commands.empty()) { - gg->WritePhonyBuild(this->GetBuildFileStream(), - "Utility command for " + this->GetTargetName(), - outputs, deps); + phonyBuild.Comment = "Utility command for " + this->GetTargetName(); + phonyBuild.ExplicitDeps = std::move(deps); + gg->WriteBuild(this->GetBuildFileStream(), phonyBuild); } else { std::string command = lg->BuildCommandLine(commands, "utility", this->GeneratorTarget); @@ -129,8 +131,8 @@ void cmNinjaUtilityTargetGenerator::Generate() /*depfile*/ "", /*job_pool*/ "", uses_terminal, /*restat*/ true, util_outputs, deps); - gg->WritePhonyBuild(this->GetBuildFileStream(), "", outputs, - cmNinjaDeps(1, utilCommandName)); + phonyBuild.ExplicitDeps.push_back(utilCommandName); + gg->WriteBuild(this->GetBuildFileStream(), phonyBuild); } // Add an alias for the logical target name regardless of what directory -- cgit v0.12