| 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/err.h" | 8 #include "tools/gn/err.h" |
| 9 #include "tools/gn/scope.h" | 9 #include "tools/gn/scope.h" |
| 10 #include "tools/gn/variables.h" | 10 #include "tools/gn/variables.h" |
| 11 | 11 |
| 12 BinaryTargetGenerator::BinaryTargetGenerator(Target* target, | 12 BinaryTargetGenerator::BinaryTargetGenerator( |
| 13 Scope* scope, | 13 Target* target, |
| 14 const Token& function_token, | 14 Scope* scope, |
| 15 Target::OutputType type, | 15 const FunctionCallNode* function_call, |
| 16 Err* err) | 16 Target::OutputType type, |
| 17 : TargetGenerator(target, scope, function_token, err), | 17 Err* err) |
| 18 : TargetGenerator(target, scope, function_call, err), |
| 18 output_type_(type) { | 19 output_type_(type) { |
| 19 } | 20 } |
| 20 | 21 |
| 21 BinaryTargetGenerator::~BinaryTargetGenerator() { | 22 BinaryTargetGenerator::~BinaryTargetGenerator() { |
| 22 } | 23 } |
| 23 | 24 |
| 24 void BinaryTargetGenerator::DoRun() { | 25 void BinaryTargetGenerator::DoRun() { |
| 25 target_->set_output_type(output_type_); | 26 target_->set_output_type(output_type_); |
| 26 | 27 |
| 27 FillOutputName(); | 28 FillOutputName(); |
| (...skipping 11 matching lines...) Expand all Loading... |
| 39 FillSourcePrereqs(); | 40 FillSourcePrereqs(); |
| 40 if (err_->has_error()) | 41 if (err_->has_error()) |
| 41 return; | 42 return; |
| 42 | 43 |
| 43 FillConfigs(); | 44 FillConfigs(); |
| 44 if (err_->has_error()) | 45 if (err_->has_error()) |
| 45 return; | 46 return; |
| 46 | 47 |
| 47 // Config values (compiler flags, etc.) set directly on this target. | 48 // Config values (compiler flags, etc.) set directly on this target. |
| 48 ConfigValuesGenerator gen(&target_->config_values(), scope_, | 49 ConfigValuesGenerator gen(&target_->config_values(), scope_, |
| 49 function_token_, scope_->GetSourceDir(), err_); | 50 scope_->GetSourceDir(), err_); |
| 50 gen.Run(); | 51 gen.Run(); |
| 51 if (err_->has_error()) | 52 if (err_->has_error()) |
| 52 return; | 53 return; |
| 53 | |
| 54 SetToolchainDependency(); | |
| 55 } | 54 } |
| 56 | 55 |
| 57 void BinaryTargetGenerator::FillOutputName() { | 56 void BinaryTargetGenerator::FillOutputName() { |
| 58 const Value* value = scope_->GetValue(variables::kOutputName, true); | 57 const Value* value = scope_->GetValue(variables::kOutputName, true); |
| 59 if (!value) | 58 if (!value) |
| 60 return; | 59 return; |
| 61 if (!value->VerifyTypeIs(Value::STRING, err_)) | 60 if (!value->VerifyTypeIs(Value::STRING, err_)) |
| 62 return; | 61 return; |
| 63 target_->set_output_name(value->string_value()); | 62 target_->set_output_name(value->string_value()); |
| 64 } | 63 } |
| OLD | NEW |