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

Unified Diff: tools/gn/command_desc.cc

Issue 2105333002: Display outputs for "executable" targets in "gn desc". (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@{1}
Patch Set: Address comments. Created 4 years, 6 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 | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tools/gn/command_desc.cc
diff --git a/tools/gn/command_desc.cc b/tools/gn/command_desc.cc
index d1edfe487b42baadd4e1cdfac511125b1a582a93..ea1bab3d88b5bc4886a2366a48fc9c68902cf2a3 100644
--- a/tools/gn/command_desc.cc
+++ b/tools/gn/command_desc.cc
@@ -338,7 +338,7 @@ void PrintOutputs(const Target* target, bool display_header) {
target->bundle_data().GetOutputsAsSourceFiles(target->settings(),
&output_files);
PrintFileList(output_files, std::string(), true, false);
- } else {
+ } else if (target->output_type() == Target::ACTION_FOREACH) {
const SubstitutionList& outputs = target->action_values().outputs();
if (!outputs.required_types().empty()) {
// Display the pattern and resolved pattern separately, since there are
@@ -356,6 +356,21 @@ void PrintOutputs(const Target* target, bool display_header) {
SubstitutionWriter::ApplyListToSources(target->settings(), outputs,
target->sources(), &output_files);
PrintFileList(output_files, std::string(), true, false);
+ } else {
+ DCHECK(target->IsBinary());
+ const Tool* tool = target->toolchain()->GetToolForTargetFinalOutput(target);
+
+ std::vector<OutputFile> output_files;
+ SubstitutionWriter::ApplyListToLinkerAsOutputFile(
+ target, tool, tool->outputs(), &output_files);
+
+ std::vector<SourceFile> output_files_as_source_file;
+ for (const OutputFile& output_file : output_files) {
+ output_files_as_source_file.push_back(
+ output_file.AsSourceFile(target->settings()->build_settings()));
+ }
+
+ PrintFileList(output_files_as_source_file, std::string(), true, false);
}
}
@@ -613,10 +628,8 @@ bool PrintTarget(const Target* target,
}
// Outputs.
- if (target->output_type() == Target::ACTION ||
- target->output_type() == Target::ACTION_FOREACH ||
- target->output_type() == Target::COPY_FILES ||
- target->output_type() == Target::CREATE_BUNDLE) {
+ if (target->output_type() != Target::SOURCE_SET &&
+ target->output_type() != Target::GROUP) {
if (what.empty() || what == variables::kOutputs) {
PrintOutputs(target, display_headers);
found_match = true;
@@ -820,6 +833,12 @@ const char kDesc_Help[] =
" Configs can have child configs. Specifying --tree will show the\n"
" hierarchy.\n"
"\n"
+ "Printing outputs\n"
+ "\n"
+ " The \"outputs\" section will list all outputs that apply, including\n"
+ " the outputs computed from the tool definition (eg for \"executable\",\n"
+ " \"static_library\", ... targets).\n"
+ "\n"
"Printing deps\n"
"\n"
" Deps will include all public, private, and data deps (TODO this could\n"
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698