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/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 534 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
545 // Checks that any inputs or sources to this target that are in the build | 545 // Checks that any inputs or sources to this target that are in the build |
546 // directory are generated by a target that this one transitively depends on | 546 // directory are generated by a target that this one transitively depends on |
547 // in some way. We already guarantee that all generated files are written | 547 // in some way. We already guarantee that all generated files are written |
548 // to the build dir. | 548 // to the build dir. |
549 // | 549 // |
550 // See Scheduler::AddUnknownGeneratedInput's declaration for more. | 550 // See Scheduler::AddUnknownGeneratedInput's declaration for more. |
551 for (const SourceFile& file : sources_) | 551 for (const SourceFile& file : sources_) |
552 CheckSourceGenerated(file); | 552 CheckSourceGenerated(file); |
553 for (const SourceFile& file : inputs_) | 553 for (const SourceFile& file : inputs_) |
554 CheckSourceGenerated(file); | 554 CheckSourceGenerated(file); |
555 for (size_t i = 0; i < all_libs_.size(); i++) { | 555 // TODO(agrieve): Check all_libs_ here as well (those that are source files). |
556 if (all_libs_[i].is_source_file()) | 556 // http://crbug.com/571731 |
557 CheckSourceGenerated(all_libs_[i].source_file()); | |
558 } | |
559 } | 557 } |
560 | 558 |
561 void Target::CheckSourceGenerated(const SourceFile& source) const { | 559 void Target::CheckSourceGenerated(const SourceFile& source) const { |
562 if (!IsStringInOutputDir(settings()->build_settings()->build_dir(), | 560 if (!IsStringInOutputDir(settings()->build_settings()->build_dir(), |
563 source.value())) | 561 source.value())) |
564 return; // Not in output dir, this is OK. | 562 return; // Not in output dir, this is OK. |
565 | 563 |
566 // Tell the scheduler about unknown files. This will be noted for later so | 564 // Tell the scheduler about unknown files. This will be noted for later so |
567 // the list of files written by the GN build itself (often response files) | 565 // the list of files written by the GN build itself (often response files) |
568 // can be filtered out of this list. | 566 // can be filtered out of this list. |
569 OutputFile out_file(settings()->build_settings(), source); | 567 OutputFile out_file(settings()->build_settings(), source); |
570 std::set<const Target*> seen_targets; | 568 std::set<const Target*> seen_targets; |
571 if (!EnsureFileIsGeneratedByDependency(this, out_file, true, &seen_targets)) | 569 if (!EnsureFileIsGeneratedByDependency(this, out_file, true, &seen_targets)) |
572 g_scheduler->AddUnknownGeneratedInput(this, source); | 570 g_scheduler->AddUnknownGeneratedInput(this, source); |
573 } | 571 } |
OLD | NEW |