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

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

Issue 1443663004: Don't propagate deps across actions in GN. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 1 month 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
« no previous file with comments | « tools/gn/target.h ('k') | tools/gn/target_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/target.h" 5 #include "tools/gn/target.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/strings/string_util.h" 8 #include "base/strings/string_util.h"
9 #include "base/strings/stringprintf.h" 9 #include "base/strings/stringprintf.h"
10 #include "tools/gn/config_values_extractors.h" 10 #include "tools/gn/config_values_extractors.h"
(...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after
191 } 191 }
192 192
193 bool Target::IsLinkable() const { 193 bool Target::IsLinkable() const {
194 return output_type_ == STATIC_LIBRARY || output_type_ == SHARED_LIBRARY; 194 return output_type_ == STATIC_LIBRARY || output_type_ == SHARED_LIBRARY;
195 } 195 }
196 196
197 bool Target::IsFinal() const { 197 bool Target::IsFinal() const {
198 return output_type_ == EXECUTABLE || 198 return output_type_ == EXECUTABLE ||
199 output_type_ == SHARED_LIBRARY || 199 output_type_ == SHARED_LIBRARY ||
200 output_type_ == LOADABLE_MODULE || 200 output_type_ == LOADABLE_MODULE ||
201 output_type_ == ACTION ||
202 output_type_ == ACTION_FOREACH ||
203 output_type_ == COPY_FILES ||
201 (output_type_ == STATIC_LIBRARY && complete_static_lib_); 204 (output_type_ == STATIC_LIBRARY && complete_static_lib_);
202 } 205 }
203 206
204 DepsIteratorRange Target::GetDeps(DepsIterationType type) const { 207 DepsIteratorRange Target::GetDeps(DepsIterationType type) const {
205 if (type == DEPS_LINKED) { 208 if (type == DEPS_LINKED) {
206 return DepsIteratorRange(DepsIterator( 209 return DepsIteratorRange(DepsIterator(
207 &public_deps_, &private_deps_, nullptr)); 210 &public_deps_, &private_deps_, nullptr));
208 } 211 }
209 // All deps. 212 // All deps.
210 return DepsIteratorRange(DepsIterator( 213 return DepsIteratorRange(DepsIterator(
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after
315 PullPublicConfigsFrom(dep.ptr); 318 PullPublicConfigsFrom(dep.ptr);
316 } 319 }
317 320
318 void Target::PullPublicConfigsFrom(const Target* from) { 321 void Target::PullPublicConfigsFrom(const Target* from) {
319 public_configs_.Append(from->public_configs().begin(), 322 public_configs_.Append(from->public_configs().begin(),
320 from->public_configs().end()); 323 from->public_configs().end());
321 } 324 }
322 325
323 void Target::PullRecursiveHardDeps() { 326 void Target::PullRecursiveHardDeps() {
324 for (const auto& pair : GetDeps(DEPS_LINKED)) { 327 for (const auto& pair : GetDeps(DEPS_LINKED)) {
328 // Direct hard dependencies.
325 if (pair.ptr->hard_dep()) 329 if (pair.ptr->hard_dep())
326 recursive_hard_deps_.insert(pair.ptr); 330 recursive_hard_deps_.insert(pair.ptr);
327 331
328 // Android STL doesn't like insert(begin, end) so do it manually. 332 // Recursive hard dependencies of all dependencies.
329 // TODO(brettw) this can be changed to 333 recursive_hard_deps_.insert(pair.ptr->recursive_hard_deps().begin(),
330 // insert(iter.target()->begin(), iter.target()->end()) 334 pair.ptr->recursive_hard_deps().end());
331 // when Android uses a better STL.
332 for (std::set<const Target*>::const_iterator cur =
333 pair.ptr->recursive_hard_deps().begin();
334 cur != pair.ptr->recursive_hard_deps().end(); ++cur)
335 recursive_hard_deps_.insert(*cur);
336 } 335 }
337 } 336 }
338 337
339 void Target::FillOutputFiles() { 338 void Target::FillOutputFiles() {
340 const Tool* tool = toolchain_->GetToolForTargetFinalOutput(this); 339 const Tool* tool = toolchain_->GetToolForTargetFinalOutput(this);
341 bool check_tool_outputs = false; 340 bool check_tool_outputs = false;
342 switch (output_type_) { 341 switch (output_type_) {
343 case GROUP: 342 case GROUP:
344 case SOURCE_SET: 343 case SOURCE_SET:
345 case COPY_FILES: 344 case COPY_FILES:
(...skipping 196 matching lines...) Expand 10 before | Expand all | Expand 10 after
542 return; // Not in output dir, this is OK. 541 return; // Not in output dir, this is OK.
543 542
544 // Tell the scheduler about unknown files. This will be noted for later so 543 // Tell the scheduler about unknown files. This will be noted for later so
545 // the list of files written by the GN build itself (often response files) 544 // the list of files written by the GN build itself (often response files)
546 // can be filtered out of this list. 545 // can be filtered out of this list.
547 OutputFile out_file(settings()->build_settings(), source); 546 OutputFile out_file(settings()->build_settings(), source);
548 std::set<const Target*> seen_targets; 547 std::set<const Target*> seen_targets;
549 if (!EnsureFileIsGeneratedByDependency(this, out_file, true, &seen_targets)) 548 if (!EnsureFileIsGeneratedByDependency(this, out_file, true, &seen_targets))
550 g_scheduler->AddUnknownGeneratedInput(this, source); 549 g_scheduler->AddUnknownGeneratedInput(this, source);
551 } 550 }
OLDNEW
« no previous file with comments | « tools/gn/target.h ('k') | tools/gn/target_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698