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 26 matching lines...) Expand all Loading... |
37 : TargetGenerator(target, scope, function_call, err), | 37 : TargetGenerator(target, scope, function_call, err), |
38 output_type_(type) { | 38 output_type_(type) { |
39 } | 39 } |
40 | 40 |
41 ActionTargetGenerator::~ActionTargetGenerator() { | 41 ActionTargetGenerator::~ActionTargetGenerator() { |
42 } | 42 } |
43 | 43 |
44 void ActionTargetGenerator::DoRun() { | 44 void ActionTargetGenerator::DoRun() { |
45 target_->set_output_type(output_type_); | 45 target_->set_output_type(output_type_); |
46 | 46 |
47 FillExternal(); | |
48 if (err_->has_error()) | |
49 return; | |
50 | |
51 FillSources(); | 47 FillSources(); |
52 if (err_->has_error()) | 48 if (err_->has_error()) |
53 return; | 49 return; |
54 if (output_type_ == Target::ACTION_FOREACH && target_->sources().empty()) { | 50 if (output_type_ == Target::ACTION_FOREACH && target_->sources().empty()) { |
55 // Foreach rules must always have some sources to have an effect. | 51 // Foreach rules must always have some sources to have an effect. |
56 *err_ = Err(function_call_, "action_foreach target has no sources.", | 52 *err_ = Err(function_call_, "action_foreach target has no sources.", |
57 "If you don't specify any sources, there is nothing to run your\n" | 53 "If you don't specify any sources, there is nothing to run your\n" |
58 "script over."); | 54 "script over."); |
59 return; | 55 return; |
60 } | 56 } |
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
145 if (!FileListHasPattern(outputs)) { | 141 if (!FileListHasPattern(outputs)) { |
146 *err_ = Err(function_call_, | 142 *err_ = Err(function_call_, |
147 "action_foreach should have a pattern in the output.", | 143 "action_foreach should have a pattern in the output.", |
148 "An action_foreach target should have a source expansion pattern in\n" | 144 "An action_foreach target should have a source expansion pattern in\n" |
149 "it to map source file to unique output file name. Otherwise, the\n" | 145 "it to map source file to unique output file name. Otherwise, the\n" |
150 "build system can't determine when your script needs to be run."); | 146 "build system can't determine when your script needs to be run."); |
151 return; | 147 return; |
152 } | 148 } |
153 } | 149 } |
154 } | 150 } |
OLD | NEW |