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/target_generator.h" | 5 #include "tools/gn/target_generator.h" |
6 | 6 |
7 #include "tools/gn/action_target_generator.h" | 7 #include "tools/gn/action_target_generator.h" |
8 #include "tools/gn/binary_target_generator.h" | 8 #include "tools/gn/binary_target_generator.h" |
9 #include "tools/gn/build_settings.h" | 9 #include "tools/gn/build_settings.h" |
10 #include "tools/gn/config.h" | 10 #include "tools/gn/config.h" |
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
110 generator.Run(); | 110 generator.Run(); |
111 } else if (output_type == functions::kStaticLibrary) { | 111 } else if (output_type == functions::kStaticLibrary) { |
112 BinaryTargetGenerator generator(target.get(), scope, function_call, | 112 BinaryTargetGenerator generator(target.get(), scope, function_call, |
113 Target::STATIC_LIBRARY, err); | 113 Target::STATIC_LIBRARY, err); |
114 generator.Run(); | 114 generator.Run(); |
115 } else { | 115 } else { |
116 *err = Err(function_call, "Not a known output type", | 116 *err = Err(function_call, "Not a known output type", |
117 "I am very confused."); | 117 "I am very confused."); |
118 } | 118 } |
119 | 119 |
120 if (!err->has_error()) | 120 if (err->has_error()) |
121 scope->settings()->build_settings()->ItemDefined(target.PassAs<Item>()); | 121 return; |
| 122 |
| 123 // Save this target for the file. |
| 124 Scope::ItemVector* collector = scope->GetItemCollector(); |
| 125 if (!collector) { |
| 126 *err = Err(function_call, "Can't define a target in this context."); |
| 127 return; |
| 128 } |
| 129 collector->push_back(new scoped_ptr<Item>(target.PassAs<Item>())); |
122 } | 130 } |
123 | 131 |
124 const BuildSettings* TargetGenerator::GetBuildSettings() const { | 132 const BuildSettings* TargetGenerator::GetBuildSettings() const { |
125 return scope_->settings()->build_settings(); | 133 return scope_->settings()->build_settings(); |
126 } | 134 } |
127 | 135 |
128 void TargetGenerator::FillSources() { | 136 void TargetGenerator::FillSources() { |
129 const Value* value = scope_->GetValue(variables::kSources, true); | 137 const Value* value = scope_->GetValue(variables::kSources, true); |
130 if (!value) | 138 if (!value) |
131 return; | 139 return; |
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
251 | 259 |
252 void TargetGenerator::FillForwardDependentConfigs() { | 260 void TargetGenerator::FillForwardDependentConfigs() { |
253 const Value* value = scope_->GetValue( | 261 const Value* value = scope_->GetValue( |
254 variables::kForwardDependentConfigsFrom, true); | 262 variables::kForwardDependentConfigsFrom, true); |
255 if (value) { | 263 if (value) { |
256 ExtractListOfLabels(*value, scope_->GetSourceDir(), | 264 ExtractListOfLabels(*value, scope_->GetSourceDir(), |
257 ToolchainLabelForScope(scope_), | 265 ToolchainLabelForScope(scope_), |
258 &target_->forward_dependent_configs(), err_); | 266 &target_->forward_dependent_configs(), err_); |
259 } | 267 } |
260 } | 268 } |
OLD | NEW |