| 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 19 matching lines...) Expand all Loading... |
| 30 function_call_(function_call), | 30 function_call_(function_call), |
| 31 err_(err) { | 31 err_(err) { |
| 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 if (err_->has_error()) |
| 41 return; |
| 42 |
| 40 FillData(); | 43 FillData(); |
| 44 if (err_->has_error()) |
| 45 return; |
| 46 |
| 41 FillDependencies(); | 47 FillDependencies(); |
| 48 if (err_->has_error()) |
| 49 return; |
| 50 |
| 51 if (!Visibility::FillItemVisibility(target_, scope_, err_)) |
| 52 return; |
| 42 | 53 |
| 43 // Do type-specific generation. | 54 // Do type-specific generation. |
| 44 DoRun(); | 55 DoRun(); |
| 45 } | 56 } |
| 46 | 57 |
| 47 // static | 58 // static |
| 48 void TargetGenerator::GenerateTarget(Scope* scope, | 59 void TargetGenerator::GenerateTarget(Scope* scope, |
| 49 const FunctionCallNode* function_call, | 60 const FunctionCallNode* function_call, |
| 50 const std::vector<Value>& args, | 61 const std::vector<Value>& args, |
| 51 const std::string& output_type, | 62 const std::string& output_type, |
| (...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 156 | 167 |
| 157 Target::FileList dest_data; | 168 Target::FileList dest_data; |
| 158 if (!ExtractListOfRelativeFiles(scope_->settings()->build_settings(), *value, | 169 if (!ExtractListOfRelativeFiles(scope_->settings()->build_settings(), *value, |
| 159 scope_->GetSourceDir(), &dest_data, err_)) | 170 scope_->GetSourceDir(), &dest_data, err_)) |
| 160 return; | 171 return; |
| 161 target_->data().swap(dest_data); | 172 target_->data().swap(dest_data); |
| 162 } | 173 } |
| 163 | 174 |
| 164 void TargetGenerator::FillDependencies() { | 175 void TargetGenerator::FillDependencies() { |
| 165 FillGenericDeps(variables::kDeps, &target_->deps()); | 176 FillGenericDeps(variables::kDeps, &target_->deps()); |
| 177 if (err_->has_error()) |
| 178 return; |
| 166 FillGenericDeps(variables::kDatadeps, &target_->datadeps()); | 179 FillGenericDeps(variables::kDatadeps, &target_->datadeps()); |
| 180 if (err_->has_error()) |
| 181 return; |
| 167 | 182 |
| 168 // This is a list of dependent targets to have their configs fowarded, so | 183 // This is a list of dependent targets to have their configs fowarded, so |
| 169 // it goes here rather than in FillConfigs. | 184 // it goes here rather than in FillConfigs. |
| 170 FillForwardDependentConfigs(); | 185 FillForwardDependentConfigs(); |
| 186 if (err_->has_error()) |
| 187 return; |
| 171 | 188 |
| 172 FillHardDep(); | 189 FillHardDep(); |
| 173 } | 190 } |
| 174 | 191 |
| 175 void TargetGenerator::FillHardDep() { | 192 void TargetGenerator::FillHardDep() { |
| 176 const Value* hard_dep_value = scope_->GetValue(variables::kHardDep, true); | 193 const Value* hard_dep_value = scope_->GetValue(variables::kHardDep, true); |
| 177 if (!hard_dep_value) | 194 if (!hard_dep_value) |
| 178 return; | 195 return; |
| 179 if (!hard_dep_value->VerifyTypeIs(Value::BOOLEAN, err_)) | 196 if (!hard_dep_value->VerifyTypeIs(Value::BOOLEAN, err_)) |
| 180 return; | 197 return; |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 222 | 239 |
| 223 void TargetGenerator::FillForwardDependentConfigs() { | 240 void TargetGenerator::FillForwardDependentConfigs() { |
| 224 const Value* value = scope_->GetValue( | 241 const Value* value = scope_->GetValue( |
| 225 variables::kForwardDependentConfigsFrom, true); | 242 variables::kForwardDependentConfigsFrom, true); |
| 226 if (value) { | 243 if (value) { |
| 227 ExtractListOfLabels(*value, scope_->GetSourceDir(), | 244 ExtractListOfLabels(*value, scope_->GetSourceDir(), |
| 228 ToolchainLabelForScope(scope_), | 245 ToolchainLabelForScope(scope_), |
| 229 &target_->forward_dependent_configs(), err_); | 246 &target_->forward_dependent_configs(), err_); |
| 230 } | 247 } |
| 231 } | 248 } |
| OLD | NEW |