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 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
47 | 47 |
48 if (!FillScriptArgs()) | 48 if (!FillScriptArgs()) |
49 return; | 49 return; |
50 | 50 |
51 if (!FillOutputs(output_type_ == Target::ACTION_FOREACH)) | 51 if (!FillOutputs(output_type_ == Target::ACTION_FOREACH)) |
52 return; | 52 return; |
53 | 53 |
54 if (!FillDepfile()) | 54 if (!FillDepfile()) |
55 return; | 55 return; |
56 | 56 |
| 57 if (!FillConsole()) |
| 58 return; |
| 59 |
57 if (!FillCheckIncludes()) | 60 if (!FillCheckIncludes()) |
58 return; | 61 return; |
59 | 62 |
60 if (!CheckOutputs()) | 63 if (!CheckOutputs()) |
61 return; | 64 return; |
62 | 65 |
63 // Action outputs don't depend on the current toolchain so we can skip adding | 66 // Action outputs don't depend on the current toolchain so we can skip adding |
64 // that dependency. | 67 // that dependency. |
65 } | 68 } |
66 | 69 |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
100 SubstitutionPattern depfile; | 103 SubstitutionPattern depfile; |
101 if (!depfile.Parse(*value, err_)) | 104 if (!depfile.Parse(*value, err_)) |
102 return false; | 105 return false; |
103 if (!EnsureSubstitutionIsInOutputDir(depfile, *value)) | 106 if (!EnsureSubstitutionIsInOutputDir(depfile, *value)) |
104 return false; | 107 return false; |
105 | 108 |
106 target_->action_values().set_depfile(depfile); | 109 target_->action_values().set_depfile(depfile); |
107 return true; | 110 return true; |
108 } | 111 } |
109 | 112 |
| 113 bool ActionTargetGenerator::FillConsole() { |
| 114 const Value* value = scope_->GetValue(variables::kConsole, true); |
| 115 if (!value) |
| 116 return true; |
| 117 if (!value->VerifyTypeIs(Value::BOOLEAN, err_)) |
| 118 return false; |
| 119 target_->action_values().set_console(value->boolean_value()); |
| 120 return true; |
| 121 } |
| 122 |
110 bool ActionTargetGenerator::CheckOutputs() { | 123 bool ActionTargetGenerator::CheckOutputs() { |
111 const SubstitutionList& outputs = target_->action_values().outputs(); | 124 const SubstitutionList& outputs = target_->action_values().outputs(); |
112 if (outputs.list().empty()) { | 125 if (outputs.list().empty()) { |
113 *err_ = Err(function_call_, "Action has no outputs.", | 126 *err_ = Err(function_call_, "Action has no outputs.", |
114 "If you have no outputs, the build system can not tell when your\n" | 127 "If you have no outputs, the build system can not tell when your\n" |
115 "script needs to be run."); | 128 "script needs to be run."); |
116 return false; | 129 return false; |
117 } | 130 } |
118 | 131 |
119 if (output_type_ == Target::ACTION) { | 132 if (output_type_ == Target::ACTION) { |
(...skipping 10 matching lines...) Expand all Loading... |
130 *err_ = Err(function_call_, | 143 *err_ = Err(function_call_, |
131 "action_foreach should have a pattern in the output.", | 144 "action_foreach should have a pattern in the output.", |
132 "An action_foreach target should have a source expansion pattern in\n" | 145 "An action_foreach target should have a source expansion pattern in\n" |
133 "it to map source file to unique output file name. Otherwise, the\n" | 146 "it to map source file to unique output file name. Otherwise, the\n" |
134 "build system can't determine when your script needs to be run."); | 147 "build system can't determine when your script needs to be run."); |
135 return false; | 148 return false; |
136 } | 149 } |
137 } | 150 } |
138 return true; | 151 return true; |
139 } | 152 } |
OLD | NEW |