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

Side by Side Diff: tools/gn/builder.cc

Issue 2926013002: Support explicit pools in actions (Closed)
Patch Set: Support explicit pools in actions Created 3 years, 6 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 unified diff | Download patch
OLDNEW
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "tools/gn/builder.h" 5 #include "tools/gn/builder.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 #include <utility> 8 #include <utility>
9 9
10 #include "tools/gn/action_values.h"
10 #include "tools/gn/config.h" 11 #include "tools/gn/config.h"
11 #include "tools/gn/deps_iterator.h" 12 #include "tools/gn/deps_iterator.h"
12 #include "tools/gn/err.h" 13 #include "tools/gn/err.h"
13 #include "tools/gn/loader.h" 14 #include "tools/gn/loader.h"
14 #include "tools/gn/pool.h" 15 #include "tools/gn/pool.h"
15 #include "tools/gn/scheduler.h" 16 #include "tools/gn/scheduler.h"
16 #include "tools/gn/settings.h" 17 #include "tools/gn/settings.h"
17 #include "tools/gn/target.h" 18 #include "tools/gn/target.h"
18 #include "tools/gn/trace.h" 19 #include "tools/gn/trace.h"
19 20
(...skipping 199 matching lines...) Expand 10 before | Expand all | Expand 10 after
219 } 220 }
220 221
221 bool Builder::TargetDefined(BuilderRecord* record, Err* err) { 222 bool Builder::TargetDefined(BuilderRecord* record, Err* err) {
222 Target* target = record->item()->AsTarget(); 223 Target* target = record->item()->AsTarget();
223 224
224 if (!AddDeps(record, target->public_deps(), err) || 225 if (!AddDeps(record, target->public_deps(), err) ||
225 !AddDeps(record, target->private_deps(), err) || 226 !AddDeps(record, target->private_deps(), err) ||
226 !AddDeps(record, target->data_deps(), err) || 227 !AddDeps(record, target->data_deps(), err) ||
227 !AddDeps(record, target->configs().vector(), err) || 228 !AddDeps(record, target->configs().vector(), err) ||
228 !AddDeps(record, target->all_dependent_configs(), err) || 229 !AddDeps(record, target->all_dependent_configs(), err) ||
229 !AddDeps(record, target->public_configs(), err) || 230 !AddDeps(record, target->public_configs(), err) ||
brettw 2017/06/28 21:23:27 You need to add a line here to add the pool to the
Petr Hosek 2017/06/28 23:42:32 Done.
230 !AddToolchainDep(record, target, err)) 231 !AddToolchainDep(record, target, err))
231 return false; 232 return false;
232 233
233 // All targets in the default toolchain get generated by default. We also 234 // All targets in the default toolchain get generated by default. We also
234 // check if this target was previously marked as "required" and force setting 235 // check if this target was previously marked as "required" and force setting
235 // the bit again so the target's dependencies (which we now know) get the 236 // the bit again so the target's dependencies (which we now know) get the
236 // required bit pushed to them. 237 // required bit pushed to them.
237 if (record->should_generate() || target->settings()->is_default()) 238 if (record->should_generate() || target->settings()->is_default())
238 RecursiveSetShouldGenerate(record, true); 239 RecursiveSetShouldGenerate(record, true);
239 240
(...skipping 192 matching lines...) Expand 10 before | Expand all | Expand 10 after
432 DCHECK(record->can_resolve() && !record->resolved()); 433 DCHECK(record->can_resolve() && !record->resolved());
433 434
434 if (record->type() == BuilderRecord::ITEM_TARGET) { 435 if (record->type() == BuilderRecord::ITEM_TARGET) {
435 Target* target = record->item()->AsTarget(); 436 Target* target = record->item()->AsTarget();
436 if (!ResolveDeps(&target->public_deps(), err) || 437 if (!ResolveDeps(&target->public_deps(), err) ||
437 !ResolveDeps(&target->private_deps(), err) || 438 !ResolveDeps(&target->private_deps(), err) ||
438 !ResolveDeps(&target->data_deps(), err) || 439 !ResolveDeps(&target->data_deps(), err) ||
439 !ResolveConfigs(&target->configs(), err) || 440 !ResolveConfigs(&target->configs(), err) ||
440 !ResolveConfigs(&target->all_dependent_configs(), err) || 441 !ResolveConfigs(&target->all_dependent_configs(), err) ||
441 !ResolveConfigs(&target->public_configs(), err) || 442 !ResolveConfigs(&target->public_configs(), err) ||
443 !ResolveActionValues(&target->action_values(), err) ||
442 !ResolveToolchain(target, err)) 444 !ResolveToolchain(target, err))
443 return false; 445 return false;
444 } else if (record->type() == BuilderRecord::ITEM_CONFIG) { 446 } else if (record->type() == BuilderRecord::ITEM_CONFIG) {
445 Config* config = record->item()->AsConfig(); 447 Config* config = record->item()->AsConfig();
446 if (!ResolveConfigs(&config->configs(), err)) 448 if (!ResolveConfigs(&config->configs(), err))
447 return false; 449 return false;
448 } else if (record->type() == BuilderRecord::ITEM_TOOLCHAIN) { 450 } else if (record->type() == BuilderRecord::ITEM_TOOLCHAIN) {
449 Toolchain* toolchain = record->item()->AsToolchain(); 451 Toolchain* toolchain = record->item()->AsToolchain();
450 if (!ResolveDeps(&toolchain->deps(), err)) 452 if (!ResolveDeps(&toolchain->deps(), err))
451 return false; 453 return false;
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
512 target->settings()->toolchain_label().GetUserVisibleName(false)); 514 target->settings()->toolchain_label().GetUserVisibleName(false));
513 return false; 515 return false;
514 } 516 }
515 517
516 if (!target->SetToolchain(record->item()->AsToolchain(), err)) 518 if (!target->SetToolchain(record->item()->AsToolchain(), err))
517 return false; 519 return false;
518 520
519 return true; 521 return true;
520 } 522 }
521 523
524 bool Builder::ResolveActionValues(ActionValues* action_values, Err* err) {
525 if (action_values->pool().label.is_null())
526 return true;
527
528 BuilderRecord* record = GetResolvedRecordOfType(
529 action_values->pool().label, action_values->pool().origin,
530 BuilderRecord::ITEM_POOL, err);
531 if (!record)
532 return false;
533 action_values->set_pool(LabelPtrPair<Pool>(record->item()->AsPool()));
534
535 return true;
536 }
537
522 bool Builder::ResolvePools(Toolchain* toolchain, Err* err) { 538 bool Builder::ResolvePools(Toolchain* toolchain, Err* err) {
523 for (int i = Toolchain::TYPE_NONE + 1; i < Toolchain::TYPE_NUMTYPES; i++) { 539 for (int i = Toolchain::TYPE_NONE + 1; i < Toolchain::TYPE_NUMTYPES; i++) {
524 Toolchain::ToolType tool_type = static_cast<Toolchain::ToolType>(i); 540 Toolchain::ToolType tool_type = static_cast<Toolchain::ToolType>(i);
525 Tool* tool = toolchain->GetTool(tool_type); 541 Tool* tool = toolchain->GetTool(tool_type);
526 if (!tool || tool->pool().label.is_null()) 542 if (!tool || tool->pool().label.is_null())
527 continue; 543 continue;
528 544
529 BuilderRecord* record = 545 BuilderRecord* record =
530 GetResolvedRecordOfType(tool->pool().label, toolchain->defined_from(), 546 GetResolvedRecordOfType(tool->pool().label, toolchain->defined_from(),
531 BuilderRecord::ITEM_POOL, err); 547 BuilderRecord::ITEM_POOL, err);
(...skipping 19 matching lines...) Expand all
551 std::string ret; 567 std::string ret;
552 for (size_t i = 0; i < cycle.size(); i++) { 568 for (size_t i = 0; i < cycle.size(); i++) {
553 ret += " " + cycle[i]->label().GetUserVisibleName(false); 569 ret += " " + cycle[i]->label().GetUserVisibleName(false);
554 if (i != cycle.size() - 1) 570 if (i != cycle.size() - 1)
555 ret += " ->"; 571 ret += " ->";
556 ret += "\n"; 572 ret += "\n";
557 } 573 }
558 574
559 return ret; 575 return ret;
560 } 576 }
OLDNEW
« no previous file with comments | « tools/gn/builder.h ('k') | tools/gn/command_help.cc » ('j') | tools/gn/loader.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698