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

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

Issue 1375023003: tools/gn: Remove code for forward_dependent_configs_from variable. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: forward_dependent_configs Created 5 years, 2 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/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 150 matching lines...) Expand 10 before | Expand all | Expand 10 after
161 // Copy our own libs and lib_dirs to the final set. This will be from our 161 // Copy our own libs and lib_dirs to the final set. This will be from our
162 // target and all of our configs. We do this specially since these must be 162 // target and all of our configs. We do this specially since these must be
163 // inherited through the dependency tree (other flags don't work this way). 163 // inherited through the dependency tree (other flags don't work this way).
164 for (ConfigValuesIterator iter(this); !iter.done(); iter.Next()) { 164 for (ConfigValuesIterator iter(this); !iter.done(); iter.Next()) {
165 const ConfigValues& cur = iter.cur(); 165 const ConfigValues& cur = iter.cur();
166 all_lib_dirs_.append(cur.lib_dirs().begin(), cur.lib_dirs().end()); 166 all_lib_dirs_.append(cur.lib_dirs().begin(), cur.lib_dirs().end());
167 all_libs_.append(cur.libs().begin(), cur.libs().end()); 167 all_libs_.append(cur.libs().begin(), cur.libs().end());
168 } 168 }
169 169
170 PullDependentTargets(); 170 PullDependentTargets();
171 PullForwardedDependentConfigs(); 171 PullPublicConfigs();
172 PullRecursiveHardDeps(); 172 PullRecursiveHardDeps();
173 if (!ResolvePrecompiledHeaders(err)) 173 if (!ResolvePrecompiledHeaders(err))
174 return false; 174 return false;
175 175
176 FillOutputFiles(); 176 FillOutputFiles();
177 177
178 if (settings()->build_settings()->check_for_bad_items()) { 178 if (settings()->build_settings()->check_for_bad_items()) {
179 if (!CheckVisibility(err)) 179 if (!CheckVisibility(err))
180 return false; 180 return false;
181 if (!CheckTestonly(err)) 181 if (!CheckTestonly(err))
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after
298 } 298 }
299 } 299 }
300 300
301 void Target::PullDependentTargets() { 301 void Target::PullDependentTargets() {
302 for (const auto& dep : public_deps_) 302 for (const auto& dep : public_deps_)
303 PullDependentTarget(dep.ptr, true); 303 PullDependentTarget(dep.ptr, true);
304 for (const auto& dep : private_deps_) 304 for (const auto& dep : private_deps_)
305 PullDependentTarget(dep.ptr, false); 305 PullDependentTarget(dep.ptr, false);
306 } 306 }
307 307
308 void Target::PullForwardedDependentConfigs() { 308 void Target::PullPublicConfigs() {
309 // Pull public configs from each of our dependency's public deps. 309 // Pull public configs from each of our dependency's public deps.
310 for (const auto& dep : public_deps_) 310 for (const auto& dep : public_deps_)
311 PullForwardedDependentConfigsFrom(dep.ptr); 311 PullPublicConfigsFrom(dep.ptr);
312
313 // Forward public configs if explicitly requested.
314 for (const auto& dep : forward_dependent_configs_) {
315 const Target* from_target = dep.ptr;
316
317 // The forward_dependent_configs_ must be in the deps (public or private)
318 // already, so we don't need to bother copying to our configs, only
319 // forwarding.
320 DCHECK(std::find_if(private_deps_.begin(), private_deps_.end(),
321 LabelPtrPtrEquals<Target>(from_target)) !=
322 private_deps_.end() ||
323 std::find_if(public_deps_.begin(), public_deps_.end(),
324 LabelPtrPtrEquals<Target>(from_target)) !=
325 public_deps_.end());
326
327 PullForwardedDependentConfigsFrom(from_target);
328 }
329 } 312 }
330 313
331 void Target::PullForwardedDependentConfigsFrom(const Target* from) { 314 void Target::PullPublicConfigsFrom(const Target* from) {
332 public_configs_.Append(from->public_configs().begin(), 315 public_configs_.Append(from->public_configs().begin(),
333 from->public_configs().end()); 316 from->public_configs().end());
334 } 317 }
335 318
336 void Target::PullRecursiveHardDeps() { 319 void Target::PullRecursiveHardDeps() {
337 for (const auto& pair : GetDeps(DEPS_LINKED)) { 320 for (const auto& pair : GetDeps(DEPS_LINKED)) {
338 if (pair.ptr->hard_dep()) 321 if (pair.ptr->hard_dep())
339 recursive_hard_deps_.insert(pair.ptr); 322 recursive_hard_deps_.insert(pair.ptr);
340 323
341 // Android STL doesn't like insert(begin, end) so do it manually. 324 // Android STL doesn't like insert(begin, end) so do it manually.
(...skipping 212 matching lines...) Expand 10 before | Expand all | Expand 10 after
554 return; // Not in output dir, this is OK. 537 return; // Not in output dir, this is OK.
555 538
556 // Tell the scheduler about unknown files. This will be noted for later so 539 // Tell the scheduler about unknown files. This will be noted for later so
557 // the list of files written by the GN build itself (often response files) 540 // the list of files written by the GN build itself (often response files)
558 // can be filtered out of this list. 541 // can be filtered out of this list.
559 OutputFile out_file(settings()->build_settings(), source); 542 OutputFile out_file(settings()->build_settings(), source);
560 std::set<const Target*> seen_targets; 543 std::set<const Target*> seen_targets;
561 if (!EnsureFileIsGeneratedByDependency(this, out_file, true, &seen_targets)) 544 if (!EnsureFileIsGeneratedByDependency(this, out_file, true, &seen_targets))
562 g_scheduler->AddUnknownGeneratedInput(this, source); 545 g_scheduler->AddUnknownGeneratedInput(this, source);
563 } 546 }
OLDNEW
« no previous file with comments | « tools/gn/target.h ('k') | tools/gn/target_generator.h » ('j') | tools/gn/target_unittest.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698