Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1692)

Unified Diff: tools/gn/ninja_toolchain_writer.cc

Issue 2006923004: Add support for user defined "pool" to GN. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: tools/gn/ninja_toolchain_writer.cc
diff --git a/tools/gn/ninja_toolchain_writer.cc b/tools/gn/ninja_toolchain_writer.cc
index e7459ebb3cfa2ede1e0d5303aedfdf0b36e134b2..0e6beedcbf98214f480ebe01de2fe80bd5026d71 100644
--- a/tools/gn/ninja_toolchain_writer.cc
+++ b/tools/gn/ninja_toolchain_writer.cc
@@ -11,6 +11,7 @@
#include "tools/gn/build_settings.h"
#include "tools/gn/filesystem_utils.h"
#include "tools/gn/ninja_utils.h"
+#include "tools/gn/pool.h"
#include "tools/gn/settings.h"
#include "tools/gn/substitution_writer.h"
#include "tools/gn/target.h"
@@ -70,6 +71,22 @@ bool NinjaToolchainWriter::RunAndWriteFile(
void NinjaToolchainWriter::WriteRules() {
std::string rule_prefix = GetNinjaRulePrefixForToolchain(settings_);
+ UniqueVector<const Pool*> pools;
+ for (int i = Toolchain::TYPE_NONE + 1; i < Toolchain::TYPE_NUMTYPES; i++) {
+ Toolchain::ToolType tool_type = static_cast<Toolchain::ToolType>(i);
+ const Tool* tool = toolchain_->GetTool(tool_type);
+ if (tool && tool->pool_label_pair().ptr)
+ pools.push_back(tool->pool_label_pair().ptr);
+ }
+
+ if (!pools.empty()) {
+ for (const Pool* pool : pools) {
+ out_ << "pool " << rule_prefix << pool->label().name() << std::endl;
brettw 2016/05/24 22:03:31 How the naming works here is a bit suspicious. In
sdefresne 2016/05/26 15:38:37 Done.
+ out_ << kIndent << "depth = " << pool->depth() << std::endl;
+ }
+ out_ << std::endl;
+ }
+
for (int i = Toolchain::TYPE_NONE + 1; i < Toolchain::TYPE_NUMTYPES; i++) {
Toolchain::ToolType tool_type = static_cast<Toolchain::ToolType>(i);
const Tool* tool = toolchain_->GetTool(tool_type);
@@ -117,6 +134,11 @@ void NinjaToolchainWriter::WriteToolRule(const Toolchain::ToolType type,
if (tool->restat())
out_ << kIndent << "restat = 1" << std::endl;
+
+ if (tool->pool_label_pair().ptr) {
+ out_ << kIndent << "pool = "
+ << rule_prefix << tool->pool_label_pair().label.name() << std::endl;
+ }
}
void NinjaToolchainWriter::WriteRulePattern(const char* name,

Powered by Google App Engine
This is Rietveld 408576698