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
3 // found in the LICENSE file.
5 #include "tools/gn/config.h"
7 #include "tools/gn/err.h"
8 #include "tools/gn/input_file_manager.h"
9 #include "tools/gn/scheduler.h"
11 Config::Config(const Settings
* settings
, const Label
& label
)
12 : Item(settings
, label
),
19 Config
* Config::AsConfig() {
23 const Config
* Config::AsConfig() const {
27 bool Config::OnResolved(Err
* err
) {
31 if (!configs_
.empty()) {
32 // Subconfigs, flatten.
34 // Implementation note for the future: Flattening these here means we
35 // lose the ability to de-dupe subconfigs. If a subconfig is listed as
36 // a separate config or a subconfig that also applies to the target, the
37 // subconfig's flags will be duplicated.
39 // If we want to be able to de-dupe these, here's one idea. As a config is
40 // resolved, inline any sub-sub configs so the configs_ vector is a flat
41 // list, much the same way that libs and lib_dirs are pushed through
42 // targets. Do the same for Target.configs_ when a target is resolved. This
43 // will naturally de-dupe and also prevents recursive config walking to
44 // compute every possible flag, although it will expand the configs list on
45 // a target nontrivially (depending on build configuration).
46 composite_values_
= own_values_
;
47 for (const auto& pair
: configs_
)
48 composite_values_
.AppendValues(pair
.ptr
->resolved_values());