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

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

Issue 2605963002: Stop propagation of dependent configs between toolchains. (Closed)
Patch Set: public_configs Created 3 years, 11 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
« no previous file with comments | « no previous file | 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 <stddef.h> 7 #include <stddef.h>
8 8
9 #include <algorithm> 9 #include <algorithm>
10 10
(...skipping 334 matching lines...) Expand 10 before | Expand all | Expand 10 after
345 // Copy public configs from all dependencies into the list of configs 345 // Copy public configs from all dependencies into the list of configs
346 // applying to this target (configs_). 346 // applying to this target (configs_).
347 PullDependentTargetConfigs(); 347 PullDependentTargetConfigs();
348 348
349 // Copies public dependencies' public configs to this target's public 349 // Copies public dependencies' public configs to this target's public
350 // configs. These configs have already been applied to this target by 350 // configs. These configs have already been applied to this target by
351 // PullDependentTargetConfigs above, along with the public configs from 351 // PullDependentTargetConfigs above, along with the public configs from
352 // private deps. This step re-exports them as public configs for targets that 352 // private deps. This step re-exports them as public configs for targets that
353 // depend on this one. 353 // depend on this one.
354 for (const auto& dep : public_deps_) { 354 for (const auto& dep : public_deps_) {
355 public_configs_.Append(dep.ptr->public_configs().begin(), 355 if (dep.ptr->toolchain() == toolchain()) {
356 dep.ptr->public_configs().end()); 356 public_configs_.Append(dep.ptr->public_configs().begin(),
357 dep.ptr->public_configs().end());
358 }
357 } 359 }
358 360
359 // Copy our own libs and lib_dirs to the final set. This will be from our 361 // Copy our own libs and lib_dirs to the final set. This will be from our
360 // target and all of our configs. We do this specially since these must be 362 // target and all of our configs. We do this specially since these must be
361 // inherited through the dependency tree (other flags don't work this way). 363 // inherited through the dependency tree (other flags don't work this way).
362 // 364 //
363 // This needs to happen after we pull dependent target configs for the 365 // This needs to happen after we pull dependent target configs for the
364 // public config's libs to be included here. And it needs to happen 366 // public config's libs to be included here. And it needs to happen
365 // before pulling the dependent target libs so the libs are in the correct 367 // before pulling the dependent target libs so the libs are in the correct
366 // order (local ones first, then the dependency's). 368 // order (local ones first, then the dependency's).
(...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after
495 if (!tool) 497 if (!tool)
496 return false; // Tool does not apply for this toolchain.file. 498 return false; // Tool does not apply for this toolchain.file.
497 499
498 // Figure out what output(s) this compiler produces. 500 // Figure out what output(s) this compiler produces.
499 SubstitutionWriter::ApplyListToCompilerAsOutputFile( 501 SubstitutionWriter::ApplyListToCompilerAsOutputFile(
500 this, source, tool->outputs(), outputs); 502 this, source, tool->outputs(), outputs);
501 return !outputs->empty(); 503 return !outputs->empty();
502 } 504 }
503 505
504 void Target::PullDependentTargetConfigs() { 506 void Target::PullDependentTargetConfigs() {
505 for (const auto& pair : GetDeps(DEPS_LINKED)) 507 for (const auto& pair : GetDeps(DEPS_LINKED)) {
506 MergeAllDependentConfigsFrom(pair.ptr, &configs_, &all_dependent_configs_); 508 if (pair.ptr->toolchain() == toolchain()) {
507 for (const auto& pair : GetDeps(DEPS_LINKED)) 509 MergeAllDependentConfigsFrom(pair.ptr, &configs_,
508 MergePublicConfigsFrom(pair.ptr, &configs_); 510 &all_dependent_configs_);
511 }
512 }
513 for (const auto& pair : GetDeps(DEPS_LINKED)) {
514 if (pair.ptr->toolchain() == toolchain()) {
515 MergePublicConfigsFrom(pair.ptr, &configs_);
516 }
517 }
509 } 518 }
510 519
511 void Target::PullDependentTargetLibsFrom(const Target* dep, bool is_public) { 520 void Target::PullDependentTargetLibsFrom(const Target* dep, bool is_public) {
512 // Direct dependent libraries. 521 // Direct dependent libraries.
513 if (dep->output_type() == STATIC_LIBRARY || 522 if (dep->output_type() == STATIC_LIBRARY ||
514 dep->output_type() == SHARED_LIBRARY || 523 dep->output_type() == SHARED_LIBRARY ||
515 dep->output_type() == SOURCE_SET) 524 dep->output_type() == SOURCE_SET)
516 inherited_libraries_.Append(dep, is_public); 525 inherited_libraries_.Append(dep, is_public);
517 526
518 if (dep->output_type() == SHARED_LIBRARY) { 527 if (dep->output_type() == SHARED_LIBRARY) {
(...skipping 327 matching lines...) Expand 10 before | Expand all | Expand 10 after
846 check_data_deps = g_scheduler->IsFileGeneratedByWriteRuntimeDeps(out_file); 855 check_data_deps = g_scheduler->IsFileGeneratedByWriteRuntimeDeps(out_file);
847 // Check object files (much slower and very rare) only if the "normal" 856 // Check object files (much slower and very rare) only if the "normal"
848 // output check failed. 857 // output check failed.
849 consider_object_files = !check_data_deps; 858 consider_object_files = !check_data_deps;
850 if (!EnsureFileIsGeneratedByDependency(this, out_file, true, 859 if (!EnsureFileIsGeneratedByDependency(this, out_file, true,
851 consider_object_files, 860 consider_object_files,
852 check_data_deps, &seen_targets)) 861 check_data_deps, &seen_targets))
853 g_scheduler->AddUnknownGeneratedInput(this, source); 862 g_scheduler->AddUnknownGeneratedInput(this, source);
854 } 863 }
855 } 864 }
OLDNEW
« no previous file with comments | « no previous file | tools/gn/target_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698