| Index: tools/gn/analyzer.cc
|
| diff --git a/tools/gn/analyzer.cc b/tools/gn/analyzer.cc
|
| index aa0eca4d1c1c882fe8ede2bb00b81ef7cf8ebce9..7ed6871a2b6e3926156c458a89ae7d6063285dc7 100644
|
| --- a/tools/gn/analyzer.cc
|
| +++ b/tools/gn/analyzer.cc
|
| @@ -56,12 +56,9 @@ LabelSet LabelsFor(const TargetSet& targets) {
|
| return labels;
|
| }
|
|
|
| -bool AnyBuildFilesWereModified(const SourceFileSet& source_files) {
|
| +bool DotGNFileWasModified(const SourceFileSet& source_files) {
|
| for (auto* file : source_files) {
|
| - if (base::EndsWith(file->value(), ".gn", base::CompareCase::SENSITIVE) ||
|
| - base::EndsWith(file->value(), ".gni", base::CompareCase::SENSITIVE) ||
|
| - base::EndsWith(file->value(), "build/vs_toolchain.py",
|
| - base::CompareCase::SENSITIVE))
|
| + if (file->value() == "//.gn")
|
| return true;
|
| }
|
| return false;
|
| @@ -262,12 +259,7 @@ std::string Analyzer::Analyze(const std::string& input, Err* err) const {
|
| return OutputsToJSON(outputs, default_toolchain_, err);
|
| }
|
|
|
| - // TODO(crbug.com/555273): We can do smarter things when we detect changes
|
| - // to build files. For example, if all of the ninja files are unchanged,
|
| - // we know that we can ignore changes to .gn* files. Also, for most .gn
|
| - // files, we can treat a change as simply affecting every target, config,
|
| - // or toolchain defined in that file.
|
| - if (AnyBuildFilesWereModified(inputs.source_files)) {
|
| + if (DotGNFileWasModified(inputs.source_files)) {
|
| outputs.status = "Found dependency (all)";
|
| if (inputs.compile_included_all) {
|
| outputs.compile_includes_all = true;
|
| @@ -360,6 +352,10 @@ void Analyzer::FilterTarget(const Target* target,
|
|
|
| bool Analyzer::TargetRefersToFile(const Target* target,
|
| const SourceFile* file) const {
|
| + const auto& source_files_hashes = target->source_files_hashes();
|
| + if (source_files_hashes.find(base::Hash(file->value())) !=
|
| + source_files_hashes.end())
|
| + return true;
|
| for (const auto& cur_file : target->sources()) {
|
| if (cur_file == *file)
|
| return true;
|
|
|