Index: tools/gn/analyzer.cc |
diff --git a/tools/gn/analyzer.cc b/tools/gn/analyzer.cc |
index 8ee303ff0811614b6f50beccf56bc259a3b73797..f89c93dfef20e134ce5db6b6fd34e58806ef697a 100644 |
--- a/tools/gn/analyzer.cc |
+++ b/tools/gn/analyzer.cc |
@@ -252,17 +252,11 @@ std::string Analyzer::Analyze(const std::string& input, Err* err) const { |
return OutputsToJSON(outputs, default_toolchain_, err); |
} |
- TargetSet affected_targets = AllAffectedTargets(inputs.source_files); |
- if (affected_targets.empty()) { |
- outputs.status = "No dependency"; |
- return OutputsToJSON(outputs, default_toolchain_, err); |
- } |
- |
- // TODO: 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 these files. Also, for most .gn files, we can |
- // treat a change as simply affecting every target, config, or toolchain |
- // defined in that file. |
+ // 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 these 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)) { |
outputs.status = "Found dependency (all)"; |
outputs.compile_labels = inputs.compile_labels; |
@@ -270,6 +264,12 @@ std::string Analyzer::Analyze(const std::string& input, Err* err) const { |
return OutputsToJSON(outputs, default_toolchain_, err); |
} |
+ TargetSet affected_targets = AllAffectedTargets(inputs.source_files); |
+ if (affected_targets.empty()) { |
+ outputs.status = "No dependency"; |
+ return OutputsToJSON(outputs, default_toolchain_, err); |
+ } |
+ |
TargetSet compile_targets = TargetsFor(inputs.compile_labels); |
if (inputs.compile_included_all) { |
for (auto& root : roots_) |