| 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 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 110 scope_->settings()->build_settings()->root_path_utf8()); | 110 scope_->settings()->build_settings()->root_path_utf8()); |
| 111 if (err_->has_error()) | 111 if (err_->has_error()) |
| 112 return false; | 112 return false; |
| 113 target_->action_values().set_script(script_file); | 113 target_->action_values().set_script(script_file); |
| 114 return true; | 114 return true; |
| 115 } | 115 } |
| 116 | 116 |
| 117 bool ActionTargetGenerator::FillScriptArgs() { | 117 bool ActionTargetGenerator::FillScriptArgs() { |
| 118 const Value* value = scope_->GetValue(variables::kArgs, true); | 118 const Value* value = scope_->GetValue(variables::kArgs, true); |
| 119 if (!value) | 119 if (!value) |
| 120 return true; | 120 return true; // Nothing to do. |
| 121 return target_->action_values().args().Parse(*value, err_); | 121 |
| 122 if (!target_->action_values().args().Parse(*value, err_)) |
| 123 return false; |
| 124 if (!EnsureValidSubstitutions( |
| 125 target_->action_values().args().required_types(), |
| 126 &IsValidScriptArgsSubstitution, |
| 127 value->origin(), err_)) |
| 128 return false; |
| 129 |
| 130 return true; |
| 122 } | 131 } |
| 123 | 132 |
| 124 bool ActionTargetGenerator::FillResponseFileContents() { | 133 bool ActionTargetGenerator::FillResponseFileContents() { |
| 125 const Value* value = scope_->GetValue(variables::kResponseFileContents, true); | 134 const Value* value = scope_->GetValue(variables::kResponseFileContents, true); |
| 126 if (!value) | 135 if (!value) |
| 127 return true; | 136 return true; // Nothing to do. |
| 128 return target_->action_values().rsp_file_contents().Parse(*value, err_); | 137 |
| 138 if (!target_->action_values().rsp_file_contents().Parse(*value, err_)) |
| 139 return false; |
| 140 if (!EnsureValidSubstitutions( |
| 141 target_->action_values().rsp_file_contents().required_types(), |
| 142 &IsValidSourceSubstitution, value->origin(), err_)) |
| 143 return false; |
| 144 |
| 145 return true; |
| 129 } | 146 } |
| 130 | 147 |
| 131 bool ActionTargetGenerator::FillDepfile() { | 148 bool ActionTargetGenerator::FillDepfile() { |
| 132 const Value* value = scope_->GetValue(variables::kDepfile, true); | 149 const Value* value = scope_->GetValue(variables::kDepfile, true); |
| 133 if (!value) | 150 if (!value) |
| 134 return true; | 151 return true; |
| 135 | 152 |
| 136 SubstitutionPattern depfile; | 153 SubstitutionPattern depfile; |
| 137 if (!depfile.Parse(*value, err_)) | 154 if (!depfile.Parse(*value, err_)) |
| 138 return false; | 155 return false; |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 176 *err_ = Err(function_call_, | 193 *err_ = Err(function_call_, |
| 177 "action_foreach should have a pattern in the output.", | 194 "action_foreach should have a pattern in the output.", |
| 178 "An action_foreach target should have a source expansion pattern in\n" | 195 "An action_foreach target should have a source expansion pattern in\n" |
| 179 "it to map source file to unique output file name. Otherwise, the\n" | 196 "it to map source file to unique output file name. Otherwise, the\n" |
| 180 "build system can't determine when your script needs to be run."); | 197 "build system can't determine when your script needs to be run."); |
| 181 return false; | 198 return false; |
| 182 } | 199 } |
| 183 } | 200 } |
| 184 return true; | 201 return true; |
| 185 } | 202 } |
| OLD | NEW |