Index: tools/gn/commands.cc |
diff --git a/tools/gn/commands.cc b/tools/gn/commands.cc |
index 76aada8fbda4ceb9913e2770c0836c24e76af782..8682d920dfbb7b5deef8114d5525f4f4ba9c4c36 100644 |
--- a/tools/gn/commands.cc |
+++ b/tools/gn/commands.cc |
@@ -6,7 +6,6 @@ |
#include "base/command_line.h" |
#include "base/strings/string_split.h" |
-#include "base/values.h" |
#include "tools/gn/builder.h" |
#include "tools/gn/filesystem_utils.h" |
#include "tools/gn/item.h" |
@@ -281,20 +280,22 @@ |
return item->defined_from()->GetRange().begin().file()->physical_name(); |
} |
-void PrintTargetsAsBuildfiles(const std::vector<const Target*>& targets, |
- base::ListValue* out) { |
+void PrintTargetsAsBuildfiles(bool indent, |
+ const std::vector<const Target*>& targets) { |
// Output the set of unique source files. |
std::set<std::string> unique_files; |
for (const Target* target : targets) |
unique_files.insert(FilePathToUTF8(BuildFileForItem(target))); |
for (const std::string& file : unique_files) { |
- out->AppendString(file); |
- } |
-} |
- |
-void PrintTargetsAsLabels(const std::vector<const Target*>& targets, |
- base::ListValue* out) { |
+ if (indent) |
+ OutputString(" "); |
+ OutputString(file + "\n"); |
+ } |
+} |
+ |
+void PrintTargetsAsLabels(bool indent, |
+ const std::vector<const Target*>& targets) { |
// Putting the labels into a set automatically sorts them for us. |
std::set<Label> unique_labels; |
for (const auto& target : targets) |
@@ -306,13 +307,16 @@ |
for (const Label& label : unique_labels) { |
// Print toolchain only for ones not in the default toolchain. |
- out->AppendString(label.GetUserVisibleName(label.GetToolchainLabel() != |
- default_tc_label)); |
- } |
-} |
- |
-void PrintTargetsAsOutputs(const std::vector<const Target*>& targets, |
- base::ListValue* out) { |
+ if (indent) |
+ OutputString(" "); |
+ OutputString(label.GetUserVisibleName( |
+ label.GetToolchainLabel() != default_tc_label)); |
+ OutputString("\n"); |
+ } |
+} |
+ |
+void PrintTargetsAsOutputs(bool indent, |
+ const std::vector<const Target*>& targets) { |
if (targets.empty()) |
return; |
@@ -332,7 +336,10 @@ |
std::string result = RebasePath(output_as_source.value(), |
build_settings->build_dir(), |
build_settings->root_path_utf8()); |
- out->AppendString(result); |
+ if (indent) |
+ OutputString(" "); |
+ OutputString(result); |
+ OutputString("\n"); |
} |
} |
@@ -483,8 +490,7 @@ |
return true; |
} |
-void FilterAndPrintTargets(std::vector<const Target*>* targets, |
- base::ListValue* out) { |
+void FilterAndPrintTargets(bool indent, std::vector<const Target*>* targets) { |
if (targets->empty()) |
return; |
@@ -498,27 +504,14 @@ |
return; |
switch (printing_mode) { |
case TARGET_PRINT_BUILDFILE: |
- PrintTargetsAsBuildfiles(*targets, out); |
+ PrintTargetsAsBuildfiles(indent, *targets); |
break; |
case TARGET_PRINT_LABEL: |
- PrintTargetsAsLabels(*targets, out); |
+ PrintTargetsAsLabels(indent, *targets); |
break; |
case TARGET_PRINT_OUTPUT: |
- PrintTargetsAsOutputs(*targets, out); |
+ PrintTargetsAsOutputs(indent, *targets); |
break; |
- } |
-} |
- |
-void FilterAndPrintTargets(bool indent, std::vector<const Target*>* targets) { |
- base::ListValue tmp; |
- FilterAndPrintTargets(targets, &tmp); |
- for (const auto& value : tmp) { |
- std::string string; |
- value->GetAsString(&string); |
- if (indent) |
- OutputString(" "); |
- OutputString(string); |
- OutputString("\n"); |
} |
} |
@@ -528,10 +521,4 @@ |
FilterAndPrintTargets(indent, &target_vector); |
} |
-void FilterAndPrintTargetSet(const std::set<const Target*>& targets, |
- base::ListValue* out) { |
- std::vector<const Target*> target_vector(targets.begin(), targets.end()); |
- FilterAndPrintTargets(&target_vector, out); |
-} |
- |
} // namespace commands |