OLD | NEW |
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/binary_target_generator.h" | 5 #include "tools/gn/binary_target_generator.h" |
6 | 6 |
7 #include "tools/gn/config_values_generator.h" | 7 #include "tools/gn/config_values_generator.h" |
8 #include "tools/gn/deps_iterator.h" | 8 #include "tools/gn/deps_iterator.h" |
9 #include "tools/gn/err.h" | 9 #include "tools/gn/err.h" |
10 #include "tools/gn/functions.h" | 10 #include "tools/gn/functions.h" |
11 #include "tools/gn/scope.h" | 11 #include "tools/gn/scope.h" |
| 12 #include "tools/gn/settings.h" |
12 #include "tools/gn/value_extractors.h" | 13 #include "tools/gn/value_extractors.h" |
13 #include "tools/gn/variables.h" | 14 #include "tools/gn/variables.h" |
14 | 15 |
15 BinaryTargetGenerator::BinaryTargetGenerator( | 16 BinaryTargetGenerator::BinaryTargetGenerator( |
16 Target* target, | 17 Target* target, |
17 Scope* scope, | 18 Scope* scope, |
18 const FunctionCallNode* function_call, | 19 const FunctionCallNode* function_call, |
19 Target::OutputType type, | 20 Target::OutputType type, |
20 Err* err) | 21 Err* err) |
21 : TargetGenerator(target, scope, function_call, err), | 22 : TargetGenerator(target, scope, function_call, err), |
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
105 return true; | 106 return true; |
106 } | 107 } |
107 | 108 |
108 bool BinaryTargetGenerator::FillAllowCircularIncludesFrom() { | 109 bool BinaryTargetGenerator::FillAllowCircularIncludesFrom() { |
109 const Value* value = scope_->GetValue( | 110 const Value* value = scope_->GetValue( |
110 variables::kAllowCircularIncludesFrom, true); | 111 variables::kAllowCircularIncludesFrom, true); |
111 if (!value) | 112 if (!value) |
112 return true; | 113 return true; |
113 | 114 |
114 UniqueVector<Label> circular; | 115 UniqueVector<Label> circular; |
115 ExtractListOfUniqueLabels(*value, scope_->GetSourceDir(), | 116 ExtractListOfUniqueLabels(scope_->settings()->build_settings(), *value, |
| 117 scope_->GetSourceDir(), |
116 ToolchainLabelForScope(scope_), &circular, err_); | 118 ToolchainLabelForScope(scope_), &circular, err_); |
117 if (err_->has_error()) | 119 if (err_->has_error()) |
118 return false; | 120 return false; |
119 | 121 |
120 // Validate that all circular includes entries are in the deps. | 122 // Validate that all circular includes entries are in the deps. |
121 for (const auto& cur : circular) { | 123 for (const auto& cur : circular) { |
122 bool found_dep = false; | 124 bool found_dep = false; |
123 for (const auto& dep_pair : target_->GetDeps(Target::DEPS_LINKED)) { | 125 for (const auto& dep_pair : target_->GetDeps(Target::DEPS_LINKED)) { |
124 if (dep_pair.label == cur) { | 126 if (dep_pair.label == cur) { |
125 found_dep = true; | 127 found_dep = true; |
126 break; | 128 break; |
127 } | 129 } |
128 } | 130 } |
129 if (!found_dep) { | 131 if (!found_dep) { |
130 *err_ = Err(*value, "Label not in deps.", | 132 *err_ = Err(*value, "Label not in deps.", |
131 "The label \"" + cur.GetUserVisibleName(false) + | 133 "The label \"" + cur.GetUserVisibleName(false) + |
132 "\"\nwas not in the deps of this target. " | 134 "\"\nwas not in the deps of this target. " |
133 "allow_circular_includes_from only allows\ntargets present in the " | 135 "allow_circular_includes_from only allows\ntargets present in the " |
134 "deps."); | 136 "deps."); |
135 return false; | 137 return false; |
136 } | 138 } |
137 } | 139 } |
138 | 140 |
139 // Add to the set. | 141 // Add to the set. |
140 for (const auto& cur : circular) | 142 for (const auto& cur : circular) |
141 target_->allow_circular_includes_from().insert(cur); | 143 target_->allow_circular_includes_from().insert(cur); |
142 return true; | 144 return true; |
143 } | 145 } |
OLD | NEW |