Use a correct method to define pool builder record
Also remove the unused console variable and update documentation.
Change-Id: I82c96d75484184dbf1b5e72edafd35d9284a93c5
Reviewed-on: https://chromium-review.googlesource.com/554300
Commit-Queue: Petr Hosek <phosek@chromium.org>
Reviewed-by: Brett Wilson <brettw@chromium.org>
Cr-Original-Commit-Position: refs/heads/master@{#484383}
Cr-Mirrored-From: https://chromium.googlesource.com/chromium/src
Cr-Mirrored-Commit: 216b1a3e072f9e531abcf79600fa52fd729b1262
diff --git a/tools/gn/builder.cc b/tools/gn/builder.cc
index bfae69f..540d83d 100644
--- a/tools/gn/builder.cc
+++ b/tools/gn/builder.cc
@@ -397,7 +397,7 @@
if (action_values.pool().label.is_null())
return true;
- BuilderRecord* pool_record = GetResolvedRecordOfType(
+ BuilderRecord* pool_record = GetOrCreateRecordOfType(
action_values.pool().label, action_values.pool().origin,
BuilderRecord::ITEM_POOL, err);
if (!pool_record)
diff --git a/tools/gn/docs/reference.md b/tools/gn/docs/reference.md
index de924a7..cdc4ca4 100644
--- a/tools/gn/docs/reference.md
+++ b/tools/gn/docs/reference.md
@@ -97,7 +97,6 @@
* [code_signing_sources: [file list] Sources for code signing step.](#code_signing_sources)
* [complete_static_lib: [boolean] Links all deps into a static library.](#complete_static_lib)
* [configs: [label list] Configs applying to this target or config.](#configs)
- * [console: [label] Console pool object.](#console)
* [data: [file list] Runtime data file dependencies.](#data)
* [data_deps: [label list] Non-linked dependencies.](#data_deps)
* [defines: [string list] C preprocessor defines.](#defines)
@@ -1041,7 +1040,7 @@
#### **Variables**
```
- args, console, data, data_deps, depfile, deps, inputs, outputs*,
+ args, data, data_deps, depfile, deps, inputs, outputs*, pool,
response_file_contents, script*, sources
* = required
```
@@ -1119,7 +1118,7 @@
#### **Variables**
```
- args, console, data, data_deps, depfile, deps, inputs, outputs*,
+ args, data, data_deps, depfile, deps, inputs, outputs*, pool,
response_file_contents, script*, sources*
* = required
```
@@ -2146,7 +2145,9 @@
variable_to_ignore_list = [])
Mark the variables in the current or given scope as not needed, which means
- you will not get an error about unused variables for these.
+ you will not get an error about unused variables for these. The
+ variable_to_ignore_list allows excluding variables from "all matches" if
+ variable_list_or_star is "*".
```
#### **Example**
@@ -4327,27 +4328,6 @@
}
}
```
-### <a name="console"></a>**console**: Console pool objects.
-
-```
- Console pool is a special pool object that uses the built-in ninja "console"
- pool. Target using this pool will have access to real stdin and stdout, and
- output will not be buffered by ninja. This can be useful for long-running
- actions with progress logs, or actions that require user input.
-
- Only one console pool target can run at any one time in Ninja. Refer to the
- Ninja documentation on the console pool for more info.
-```
-
-#### **Example**
-
-```
- action("my_action") {
- ...
- pool = console
- ...
- }
-```
### <a name="data"></a>**data**: Runtime data file dependencies.
```
diff --git a/tools/gn/functions_target.cc b/tools/gn/functions_target.cc
index fa97c86..903ab38 100644
--- a/tools/gn/functions_target.cc
+++ b/tools/gn/functions_target.cc
@@ -136,7 +136,7 @@
R"(
Variables
- args, console, data, data_deps, depfile, deps, inputs, outputs*,
+ args, data, data_deps, depfile, deps, inputs, outputs*, pool,
response_file_contents, script*, sources
* = required
@@ -209,7 +209,7 @@
R"(
Variables
- args, console, data, data_deps, depfile, deps, inputs, outputs*,
+ args, data, data_deps, depfile, deps, inputs, outputs*, pool,
response_file_contents, script*, sources*
* = required
diff --git a/tools/gn/ninja_action_target_writer_unittest.cc b/tools/gn/ninja_action_target_writer_unittest.cc
index e24fb0d..3c4c05d 100644
--- a/tools/gn/ninja_action_target_writer_unittest.cc
+++ b/tools/gn/ninja_action_target_writer_unittest.cc
@@ -75,8 +75,8 @@
}
-// Tests an action with no sources and console = true
-TEST(NinjaActionTargetWriter, ActionNoSourcesConsole) {
+// Tests an action with no sources and pool
+TEST(NinjaActionTargetWriter, ActionNoSourcesPool) {
Err err;
TestWithScope setup;
@@ -89,8 +89,11 @@
target.action_values().outputs() =
SubstitutionList::MakeForTest("//out/Debug/foo.out");
- Pool pool(setup.settings(), Label(SourceDir("//foo/"), "pool"), {});
- pool.set_console(true);
+ Pool pool(setup.settings(),
+ Label(SourceDir("//foo/"), "pool", setup.toolchain()->label().dir(),
+ setup.toolchain()->label().name()),
+ {});
+ pool.set_depth(5);
target.action_values().set_pool(LabelPtrPair<Pool>(&pool));
target.SetToolchain(setup.toolchain());
@@ -112,7 +115,7 @@
"../../foo/included.txt\n"
"\n"
"build foo.out: __foo_bar___rule | obj/foo/bar.inputdeps.stamp\n"
- " pool = console\n"
+ " pool = foo_pool\n"
"\n"
"build obj/foo/bar.stamp: stamp foo.out\n";
EXPECT_EQ(expected, out.str());
diff --git a/tools/gn/pool.cc b/tools/gn/pool.cc
index b1bb490..75a7504 100644
--- a/tools/gn/pool.cc
+++ b/tools/gn/pool.cc
@@ -25,9 +25,6 @@
}
std::string Pool::GetNinjaName(bool include_toolchain) const {
- if (console_)
- return "console";
-
std::ostringstream buffer;
if (include_toolchain) {
DCHECK(label().toolchain_dir().is_source_absolute());
diff --git a/tools/gn/pool.h b/tools/gn/pool.h
index 08da33c..81a021d 100644
--- a/tools/gn/pool.h
+++ b/tools/gn/pool.h
@@ -29,10 +29,6 @@
int64_t depth() const { return depth_; }
void set_depth(int64_t depth) { depth_ = depth; }
- // Console pool option
- bool is_console() const { return console_; }
- void set_console(bool value) { console_ = value; }
-
// The pool name in generated ninja files.
std::string GetNinjaName(const Label& default_toolchain) const;
@@ -40,7 +36,6 @@
std::string GetNinjaName(bool include_toolchain) const;
int64_t depth_ = 0;
- bool console_ = false;
};
#endif // TOOLS_GN_POOL_H_