| 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/action_target_generator.h" | 5 #include "tools/gn/action_target_generator.h" |
| 6 | 6 |
| 7 #include "tools/gn/build_settings.h" | 7 #include "tools/gn/build_settings.h" |
| 8 #include "tools/gn/err.h" | 8 #include "tools/gn/err.h" |
| 9 #include "tools/gn/filesystem_utils.h" | 9 #include "tools/gn/filesystem_utils.h" |
| 10 #include "tools/gn/parse_tree.h" | 10 #include "tools/gn/parse_tree.h" |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 66 // if it doesn't have one. | 66 // if it doesn't have one. |
| 67 const Value* value = scope_->GetValue(variables::kScript, true); | 67 const Value* value = scope_->GetValue(variables::kScript, true); |
| 68 if (!value) { | 68 if (!value) { |
| 69 *err_ = Err(function_call_, "This target type requires a \"script\"."); | 69 *err_ = Err(function_call_, "This target type requires a \"script\"."); |
| 70 return false; | 70 return false; |
| 71 } | 71 } |
| 72 if (!value->VerifyTypeIs(Value::STRING, err_)) | 72 if (!value->VerifyTypeIs(Value::STRING, err_)) |
| 73 return false; | 73 return false; |
| 74 | 74 |
| 75 SourceFile script_file = | 75 SourceFile script_file = |
| 76 scope_->GetSourceDir().ResolveRelativeFile(value->string_value()); | 76 scope_->GetSourceDir().ResolveRelativeFile(value->string_value(), |
| 77 scope_->settings()->build_settings()->root_path()); |
| 77 if (script_file.value().empty()) { | 78 if (script_file.value().empty()) { |
| 78 *err_ = Err(*value, "script name is empty"); | 79 *err_ = Err(*value, "script name is empty"); |
| 79 return false; | 80 return false; |
| 80 } | 81 } |
| 81 target_->action_values().set_script(script_file); | 82 target_->action_values().set_script(script_file); |
| 82 return true; | 83 return true; |
| 83 } | 84 } |
| 84 | 85 |
| 85 bool ActionTargetGenerator::FillScriptArgs() { | 86 bool ActionTargetGenerator::FillScriptArgs() { |
| 86 const Value* value = scope_->GetValue(variables::kArgs, true); | 87 const Value* value = scope_->GetValue(variables::kArgs, true); |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 127 *err_ = Err(function_call_, | 128 *err_ = Err(function_call_, |
| 128 "action_foreach should have a pattern in the output.", | 129 "action_foreach should have a pattern in the output.", |
| 129 "An action_foreach target should have a source expansion pattern in\n" | 130 "An action_foreach target should have a source expansion pattern in\n" |
| 130 "it to map source file to unique output file name. Otherwise, the\n" | 131 "it to map source file to unique output file name. Otherwise, the\n" |
| 131 "build system can't determine when your script needs to be run."); | 132 "build system can't determine when your script needs to be run."); |
| 132 return false; | 133 return false; |
| 133 } | 134 } |
| 134 } | 135 } |
| 135 return true; | 136 return true; |
| 136 } | 137 } |
| OLD | NEW |