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

Unified Diff: tools/gn/analyzer.cc

Issue 2350963006: Fix an issue in `gn analyze` when building all. (Closed)
Patch Set: use nico's union code 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 f89c93dfef20e134ce5db6b6fd34e58806ef697a..011b77baa77f9d725c0324c9cc4ab26a7fd0010d 100644
--- a/tools/gn/analyzer.cc
+++ b/tools/gn/analyzer.cc
@@ -34,7 +34,7 @@ struct Inputs {
std::vector<SourceFile> source_vec;
std::vector<Label> compile_vec;
std::vector<Label> test_vec;
- bool compile_included_all;
+ bool compile_included_all = false;
SourceFileSet source_files;
LabelSet compile_labels;
LabelSet test_labels;
@@ -43,6 +43,7 @@ struct Inputs {
struct Outputs {
std::string status;
std::string error;
+ bool compile_includes_all = false;
LabelSet compile_labels;
LabelSet test_labels;
LabelSet invalid_labels;
@@ -203,8 +204,14 @@ std::string OutputsToJSON(const Outputs& outputs,
outputs.invalid_labels);
} else {
WriteString(*value, "status", outputs.status);
- WriteLabels(default_toolchain, *value, "compile_targets",
- outputs.compile_labels);
+ if (outputs.compile_includes_all) {
+ auto compile_targets = base::WrapUnique(new base::ListValue());
+ compile_targets->AppendString("all");
+ value->Set("compile_targets", std::move(compile_targets));
+ } else {
+ WriteLabels(default_toolchain, *value, "compile_targets",
+ outputs.compile_labels);
+ }
WriteLabels(default_toolchain, *value, "test_targets", outputs.test_labels);
}
@@ -259,7 +266,14 @@ std::string Analyzer::Analyze(const std::string& input, Err* err) const {
// or toolchain defined in that file.
if (AnyBuildFilesWereModified(inputs.source_files)) {
outputs.status = "Found dependency (all)";
- outputs.compile_labels = inputs.compile_labels;
+ if (inputs.compile_included_all) {
+ outputs.compile_includes_all = true;
+ } else {
+ outputs.compile_labels.insert(inputs.compile_labels.begin(),
+ inputs.compile_labels.end());
+ outputs.compile_labels.insert(inputs.test_labels.begin(),
+ inputs.test_labels.end());
+ }
outputs.test_labels = inputs.test_labels;
return OutputsToJSON(outputs, default_toolchain_, err);
}
« 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