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

Unified Diff: tools/gn/builder.cc

Issue 2926013002: Support explicit pools in actions (Closed)
Patch Set: Remove console altogether 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « tools/gn/builder.h ('k') | tools/gn/command_help.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tools/gn/builder.cc
diff --git a/tools/gn/builder.cc b/tools/gn/builder.cc
index bb3f834f6cb21970950f89cae1ae2821832e7556..bfae69f6679bd0641eee1623cd32b39776a17845 100644
--- a/tools/gn/builder.cc
+++ b/tools/gn/builder.cc
@@ -7,6 +7,7 @@
#include <stddef.h>
#include <utility>
+#include "tools/gn/action_values.h"
#include "tools/gn/config.h"
#include "tools/gn/deps_iterator.h"
#include "tools/gn/err.h"
@@ -227,6 +228,7 @@ bool Builder::TargetDefined(BuilderRecord* record, Err* err) {
!AddDeps(record, target->configs().vector(), err) ||
!AddDeps(record, target->all_dependent_configs(), err) ||
!AddDeps(record, target->public_configs(), err) ||
+ !AddActionValuesDep(record, target->action_values(), err) ||
!AddToolchainDep(record, target, err))
return false;
@@ -389,6 +391,22 @@ bool Builder::AddDeps(BuilderRecord* record,
return true;
}
+bool Builder::AddActionValuesDep(BuilderRecord* record,
+ const ActionValues& action_values,
+ Err* err) {
+ if (action_values.pool().label.is_null())
+ return true;
+
+ BuilderRecord* pool_record = GetResolvedRecordOfType(
+ action_values.pool().label, action_values.pool().origin,
+ BuilderRecord::ITEM_POOL, err);
+ if (!pool_record)
+ return false;
+ record->AddDep(pool_record);
+
+ return true;
+}
+
bool Builder::AddToolchainDep(BuilderRecord* record,
const Target* target,
Err* err) {
@@ -439,6 +457,7 @@ bool Builder::ResolveItem(BuilderRecord* record, Err* err) {
!ResolveConfigs(&target->configs(), err) ||
!ResolveConfigs(&target->all_dependent_configs(), err) ||
!ResolveConfigs(&target->public_configs(), err) ||
+ !ResolveActionValues(&target->action_values(), err) ||
!ResolveToolchain(target, err))
return false;
} else if (record->type() == BuilderRecord::ITEM_CONFIG) {
@@ -519,6 +538,20 @@ bool Builder::ResolveToolchain(Target* target, Err* err) {
return true;
}
+bool Builder::ResolveActionValues(ActionValues* action_values, Err* err) {
+ if (action_values->pool().label.is_null())
+ return true;
+
+ BuilderRecord* record = GetResolvedRecordOfType(
+ action_values->pool().label, action_values->pool().origin,
+ BuilderRecord::ITEM_POOL, err);
+ if (!record)
+ return false;
+ action_values->set_pool(LabelPtrPair<Pool>(record->item()->AsPool()));
+
+ return true;
+}
+
bool Builder::ResolvePools(Toolchain* toolchain, Err* err) {
for (int i = Toolchain::TYPE_NONE + 1; i < Toolchain::TYPE_NUMTYPES; i++) {
Toolchain::ToolType tool_type = static_cast<Toolchain::ToolType>(i);
« no previous file with comments | « tools/gn/builder.h ('k') | tools/gn/command_help.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698