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/ninja_action_target_writer.h" | 5 #include "tools/gn/ninja_action_target_writer.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 | 8 |
9 #include "base/strings/string_util.h" | 9 #include "base/strings/string_util.h" |
10 #include "tools/gn/deps_iterator.h" | 10 #include "tools/gn/deps_iterator.h" |
(...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
159 | 159 |
160 const Target::FileList& sources = target_->sources(); | 160 const Target::FileList& sources = target_->sources(); |
161 for (size_t i = 0; i < sources.size(); i++) { | 161 for (size_t i = 0; i < sources.size(); i++) { |
162 out_ << "build"; | 162 out_ << "build"; |
163 WriteOutputFilesForBuildLine(sources[i], output_files); | 163 WriteOutputFilesForBuildLine(sources[i], output_files); |
164 | 164 |
165 out_ << ": " << custom_rule_name << " "; | 165 out_ << ": " << custom_rule_name << " "; |
166 path_output_.WriteFile(out_, sources[i]); | 166 path_output_.WriteFile(out_, sources[i]); |
167 if (!input_dep.value().empty()) { | 167 if (!input_dep.value().empty()) { |
168 // Using "|" for the dependencies forces all implicit dependencies to be | 168 // Using "|" for the dependencies forces all implicit dependencies to be |
169 // fully up-to-date before running the action, and will re-run this | 169 // fully up to date before running the action, and will re-run this |
170 // action if any input dependencies change. This is important because | 170 // action if any input dependencies change. This is important because |
171 // this action may consume the outputs of previous steps. | 171 // this action may consume the outputs of previous steps. |
172 out_ << " | "; | 172 out_ << " | "; |
173 path_output_.WriteFile(out_, input_dep); | 173 path_output_.WriteFile(out_, input_dep); |
174 } | 174 } |
175 out_ << std::endl; | 175 out_ << std::endl; |
176 | 176 |
177 // Response files require a unique name be defined. | 177 // Response files require a unique name be defined. |
178 if (target_->action_values().uses_rsp_file()) | 178 if (target_->action_values().uses_rsp_file()) |
179 out_ << " unique_name = " << i << std::endl; | 179 out_ << " unique_name = " << i << std::endl; |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
212 out_ << " "; | 212 out_ << " "; |
213 path_output_.WriteFile(out_, (*output_files)[i]); | 213 path_output_.WriteFile(out_, (*output_files)[i]); |
214 } | 214 } |
215 } | 215 } |
216 | 216 |
217 void NinjaActionTargetWriter::WriteDepfile(const SourceFile& source) { | 217 void NinjaActionTargetWriter::WriteDepfile(const SourceFile& source) { |
218 path_output_.WriteFile(out_, | 218 path_output_.WriteFile(out_, |
219 SubstitutionWriter::ApplyPatternToSourceAsOutputFile( | 219 SubstitutionWriter::ApplyPatternToSourceAsOutputFile( |
220 settings_, target_->action_values().depfile(), source)); | 220 settings_, target_->action_values().depfile(), source)); |
221 } | 221 } |
OLD | NEW |