| 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 21 matching lines...) Expand all Loading... |
| 32 } | 32 } |
| 33 | 33 |
| 34 TargetGenerator::~TargetGenerator() { | 34 TargetGenerator::~TargetGenerator() { |
| 35 } | 35 } |
| 36 | 36 |
| 37 void TargetGenerator::Run() { | 37 void TargetGenerator::Run() { |
| 38 // All target types use these. | 38 // All target types use these. |
| 39 FillDependentConfigs(); | 39 FillDependentConfigs(); |
| 40 FillData(); | 40 FillData(); |
| 41 FillDependencies(); | 41 FillDependencies(); |
| 42 FillGypFile(); | |
| 43 | 42 |
| 44 // Do type-specific generation. | 43 // Do type-specific generation. |
| 45 DoRun(); | 44 DoRun(); |
| 46 } | 45 } |
| 47 | 46 |
| 48 // static | 47 // static |
| 49 void TargetGenerator::GenerateTarget(Scope* scope, | 48 void TargetGenerator::GenerateTarget(Scope* scope, |
| 50 const FunctionCallNode* function_call, | 49 const FunctionCallNode* function_call, |
| 51 const std::vector<Value>& args, | 50 const std::vector<Value>& args, |
| 52 const std::string& output_type, | 51 const std::string& output_type, |
| (...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 166 FillGenericDeps(variables::kDeps, &target_->deps()); | 165 FillGenericDeps(variables::kDeps, &target_->deps()); |
| 167 FillGenericDeps(variables::kDatadeps, &target_->datadeps()); | 166 FillGenericDeps(variables::kDatadeps, &target_->datadeps()); |
| 168 | 167 |
| 169 // This is a list of dependent targets to have their configs fowarded, so | 168 // This is a list of dependent targets to have their configs fowarded, so |
| 170 // it goes here rather than in FillConfigs. | 169 // it goes here rather than in FillConfigs. |
| 171 FillForwardDependentConfigs(); | 170 FillForwardDependentConfigs(); |
| 172 | 171 |
| 173 FillHardDep(); | 172 FillHardDep(); |
| 174 } | 173 } |
| 175 | 174 |
| 176 void TargetGenerator::FillGypFile() { | |
| 177 const Value* gyp_file_value = scope_->GetValue(variables::kGypFile, true); | |
| 178 if (!gyp_file_value) | |
| 179 return; | |
| 180 if (!gyp_file_value->VerifyTypeIs(Value::STRING, err_)) | |
| 181 return; | |
| 182 | |
| 183 target_->set_gyp_file(scope_->GetSourceDir().ResolveRelativeFile( | |
| 184 gyp_file_value->string_value())); | |
| 185 } | |
| 186 | |
| 187 void TargetGenerator::FillHardDep() { | 175 void TargetGenerator::FillHardDep() { |
| 188 const Value* hard_dep_value = scope_->GetValue(variables::kHardDep, true); | 176 const Value* hard_dep_value = scope_->GetValue(variables::kHardDep, true); |
| 189 if (!hard_dep_value) | 177 if (!hard_dep_value) |
| 190 return; | 178 return; |
| 191 if (!hard_dep_value->VerifyTypeIs(Value::BOOLEAN, err_)) | 179 if (!hard_dep_value->VerifyTypeIs(Value::BOOLEAN, err_)) |
| 192 return; | 180 return; |
| 193 target_->set_hard_dep(hard_dep_value->boolean_value()); | 181 target_->set_hard_dep(hard_dep_value->boolean_value()); |
| 194 } | 182 } |
| 195 | 183 |
| 196 void TargetGenerator::FillExternal() { | |
| 197 const Value* value = scope_->GetValue(variables::kExternal, true); | |
| 198 if (!value) | |
| 199 return; | |
| 200 if (!value->VerifyTypeIs(Value::BOOLEAN, err_)) | |
| 201 return; | |
| 202 target_->set_external(value->boolean_value()); | |
| 203 } | |
| 204 | |
| 205 void TargetGenerator::FillOutputs() { | 184 void TargetGenerator::FillOutputs() { |
| 206 const Value* value = scope_->GetValue(variables::kOutputs, true); | 185 const Value* value = scope_->GetValue(variables::kOutputs, true); |
| 207 if (!value) | 186 if (!value) |
| 208 return; | 187 return; |
| 209 | 188 |
| 210 Target::FileList outputs; | 189 Target::FileList outputs; |
| 211 if (!ExtractListOfRelativeFiles(scope_->settings()->build_settings(), *value, | 190 if (!ExtractListOfRelativeFiles(scope_->settings()->build_settings(), *value, |
| 212 scope_->GetSourceDir(), &outputs, err_)) | 191 scope_->GetSourceDir(), &outputs, err_)) |
| 213 return; | 192 return; |
| 214 | 193 |
| (...skipping 28 matching lines...) Expand all Loading... |
| 243 | 222 |
| 244 void TargetGenerator::FillForwardDependentConfigs() { | 223 void TargetGenerator::FillForwardDependentConfigs() { |
| 245 const Value* value = scope_->GetValue( | 224 const Value* value = scope_->GetValue( |
| 246 variables::kForwardDependentConfigsFrom, true); | 225 variables::kForwardDependentConfigsFrom, true); |
| 247 if (value) { | 226 if (value) { |
| 248 ExtractListOfLabels(*value, scope_->GetSourceDir(), | 227 ExtractListOfLabels(*value, scope_->GetSourceDir(), |
| 249 ToolchainLabelForScope(scope_), | 228 ToolchainLabelForScope(scope_), |
| 250 &target_->forward_dependent_configs(), err_); | 229 &target_->forward_dependent_configs(), err_); |
| 251 } | 230 } |
| 252 } | 231 } |
| OLD | NEW |