Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(67)

Side by Side Diff: tools/gn/ninja_target_writer.cc

Issue 2071573003: GN: Use implicit dependency for binary input deps (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Use implicit dependencies only for inputs Created 4 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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_target_writer.h" 5 #include "tools/gn/ninja_target_writer.h"
6 6
7 #include <sstream> 7 #include <sstream>
8 8
9 #include "base/files/file_util.h" 9 #include "base/files/file_util.h"
10 #include "base/strings/string_util.h" 10 #include "base/strings/string_util.h"
(...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after
158 // number before writing allows us to either skip writing the input deps 158 // number before writing allows us to either skip writing the input deps
159 // stamp or optimize it. Use pointers to avoid copies here. 159 // stamp or optimize it. Use pointers to avoid copies here.
160 std::vector<const SourceFile*> input_deps_sources; 160 std::vector<const SourceFile*> input_deps_sources;
161 input_deps_sources.reserve(32); 161 input_deps_sources.reserve(32);
162 162
163 // Actions get implicit dependencies on the script itself. 163 // Actions get implicit dependencies on the script itself.
164 if (target_->output_type() == Target::ACTION || 164 if (target_->output_type() == Target::ACTION ||
165 target_->output_type() == Target::ACTION_FOREACH) 165 target_->output_type() == Target::ACTION_FOREACH)
166 input_deps_sources.push_back(&target_->action_values().script()); 166 input_deps_sources.push_back(&target_->action_values().script());
167 167
168 // Input files. 168 // Input files are only considered for non-binary targets which use an
169 for (const auto& input : target_->inputs()) 169 // implicit dependency instead.
brettw 2016/06/17 17:54:20 Can you mentioned that the implicit dep in this ca
Petr Hosek 2016/06/17 18:59:30 Done.
170 input_deps_sources.push_back(&input); 170 if (!target_->IsBinary()) {
171 for (const auto& input : target_->inputs())
172 input_deps_sources.push_back(&input);
173 }
171 174
172 // For an action (where we run a script only once) the sources are the same 175 // For an action (where we run a script only once) the sources are the same
173 // as the inputs. For action_foreach, the sources will be operated on 176 // as the inputs. For action_foreach, the sources will be operated on
174 // separately so don't handle them here. 177 // separately so don't handle them here.
175 if (target_->output_type() == Target::ACTION) { 178 if (target_->output_type() == Target::ACTION) {
176 for (const auto& source : target_->sources()) 179 for (const auto& source : target_->sources())
177 input_deps_sources.push_back(&source); 180 input_deps_sources.push_back(&source);
178 } 181 }
179 182
180 // ---------- 183 // ----------
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after
280 << GetNinjaRulePrefixForToolchain(settings_) 283 << GetNinjaRulePrefixForToolchain(settings_)
281 << Toolchain::ToolTypeToName(Toolchain::TYPE_STAMP); 284 << Toolchain::ToolTypeToName(Toolchain::TYPE_STAMP);
282 path_output_.WriteFiles(out_, files); 285 path_output_.WriteFiles(out_, files);
283 286
284 if (!order_only_deps.empty()) { 287 if (!order_only_deps.empty()) {
285 out_ << " ||"; 288 out_ << " ||";
286 path_output_.WriteFiles(out_, order_only_deps); 289 path_output_.WriteFiles(out_, order_only_deps);
287 } 290 }
288 out_ << std::endl; 291 out_ << std::endl;
289 } 292 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698