Chromium Code Reviews| Index: tools/gn/config.cc |
| diff --git a/tools/gn/config.cc b/tools/gn/config.cc |
| index dce951f65b33384fec9403cb65176ef6354662d8..96774ab8ac1612d1c3a364ff1aa82ff02fbe0f35 100644 |
| --- a/tools/gn/config.cc |
| +++ b/tools/gn/config.cc |
| @@ -9,7 +9,8 @@ |
| #include "tools/gn/scheduler.h" |
| Config::Config(const Settings* settings, const Label& label) |
| - : Item(settings, label) { |
| + : Item(settings, label), |
| + resolved_(false) { |
| } |
| Config::~Config() { |
| @@ -22,3 +23,28 @@ Config* Config::AsConfig() { |
| const Config* Config::AsConfig() const { |
| return this; |
| } |
| + |
| +bool Config::OnResolved(Err* err) { |
| + DCHECK(!resolved_); |
| + resolved_ = true; |
| + |
| + if (!configs_.empty()) { |
| + // Subconfigs, flatten. |
| + // |
| + // Implementation note for the future: Flattening these here means we |
| + // lose the ability to de-dupe subconfigs. If a subconfig is listed as |
| + // a separate config or a subconfig that also applies to the target, the |
| + // subconfig's flags will be duplicated. |
| + // |
| + // If we want to be able to de-dupe these, here's one idea. As a config is |
| + // resolved, inline any sub-sub configs so the configs_ vector is a flat |
| + // list. To the same for Target.configs_ when a target is resolved. This |
|
Dirk Pranke
2015/09/16 21:03:20
typo: "do the same"
|
| + // will naturally de-dupe and also prevents recursive config walking to |
| + // compute every possible flag, although it will expand the configs list |
| + // on a target nontrivially (depending on build configuration). |
| + composite_values_ = own_values_; |
| + for (const auto& pair : configs_) |
| + composite_values_.AppendValues(pair.ptr->resolved_values()); |
| + } |
| + return true; |
| +} |