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

Unified Diff: tools/gn/analyzer.cc

Issue 2355713002: Fix a bug in `gn analyze` related to build-only changes. (Closed)
Patch Set: Created 4 years, 3 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | tools/gn/analyzer_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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_)
« no previous file with comments | « no previous file | tools/gn/analyzer_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698