| Index: tools/gn/functions.cc
|
| diff --git a/tools/gn/functions.cc b/tools/gn/functions.cc
|
| index 272cd9430bc96d82fef310a8f8ef5600cd3e2725..06d45d2498ca0b72c8d5b6296f05553b5a27ade8 100644
|
| --- a/tools/gn/functions.cc
|
| +++ b/tools/gn/functions.cc
|
| @@ -733,11 +733,14 @@ const char kPool_Help[] =
|
| context of more than one toolchain it is recommended to specify an
|
| explicit toolchain when defining and referencing a pool.
|
|
|
| + A pool marked "console = true" will use the built-in ninja "console"
|
| + pool and cannot specify "depth" which is always 1.
|
| +
|
| A pool is referenced by its label just like a target.
|
|
|
| Variables
|
|
|
| - depth*
|
| + console, depth*
|
| * = required
|
|
|
| Example
|
| @@ -775,25 +778,41 @@ Value RunPool(const FunctionCallNode* function,
|
| if (g_scheduler->verbose_logging())
|
| g_scheduler->Log("Defining pool", label.GetUserVisibleName(true));
|
|
|
| - // Get the pool depth. It is an error to define a pool without a depth,
|
| - // so check first for the presence of the value.
|
| - const Value* depth = scope->GetValue(kDepth, true);
|
| - if (!depth) {
|
| - *err = Err(function, "Can't define a pool without depth.");
|
| - return Value();
|
| + // Create the new pool.
|
| + std::unique_ptr<Pool> pool(new Pool(scope->settings(), label));
|
| +
|
| + // Check the value of console.
|
| + const Value* console = scope->GetValue(variables::kConsole, true);
|
| + if (console) {
|
| + if (!console->VerifyTypeIs(Value::BOOLEAN, err))
|
| + return Value();
|
| }
|
|
|
| - if (!depth->VerifyTypeIs(Value::INTEGER, err))
|
| - return Value();
|
| + // Get the pool depth. Pool must hae a depth or be a console pool.
|
| + const Value* depth = scope->GetValue(kDepth, true);
|
| + if (console && console->boolean_value()) {
|
| + if (depth) {
|
| + *err = Err(function, "Can't define a console pool with depth.");
|
| + return Value();
|
| + }
|
|
|
| - if (depth->int_value() < 0) {
|
| - *err = Err(function, "depth must be positive or nul.");
|
| - return Value();
|
| - }
|
| + pool->set_console(console->boolean_value());
|
| + } else {
|
| + if (!depth) {
|
| + *err = Err(function, "Can't define a pool without depth.");
|
| + return Value();
|
| + }
|
|
|
| - // Create the new pool.
|
| - std::unique_ptr<Pool> pool(new Pool(scope->settings(), label));
|
| - pool->set_depth(depth->int_value());
|
| + if (!depth->VerifyTypeIs(Value::INTEGER, err))
|
| + return Value();
|
| +
|
| + if (depth->int_value() < 0) {
|
| + *err = Err(function, "depth must be positive or nul.");
|
| + return Value();
|
| + }
|
| +
|
| + pool->set_depth(depth->int_value());
|
| + }
|
|
|
| // Save the generated item.
|
| Scope::ItemVector* collector = scope->GetItemCollector();
|
|
|