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

Side by Side 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: Created 4 years, 5 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 unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include <stddef.h> 5 #include <stddef.h>
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <set> 8 #include <set>
9 #include <sstream> 9 #include <sstream>
10 10
(...skipping 320 matching lines...) Expand 10 before | Expand all | Expand 10 after
331 if (target->output_type() == Target::ACTION) { 331 if (target->output_type() == Target::ACTION) {
332 // Action, print out outputs, don't apply sources to it. 332 // Action, print out outputs, don't apply sources to it.
333 for (const auto& elem : target->action_values().outputs().list()) { 333 for (const auto& elem : target->action_values().outputs().list()) {
334 OutputString(" " + elem.AsString() + "\n"); 334 OutputString(" " + elem.AsString() + "\n");
335 } 335 }
336 } else if (target->output_type() == Target::CREATE_BUNDLE) { 336 } else if (target->output_type() == Target::CREATE_BUNDLE) {
337 std::vector<SourceFile> output_files; 337 std::vector<SourceFile> output_files;
338 target->bundle_data().GetOutputsAsSourceFiles(target->settings(), 338 target->bundle_data().GetOutputsAsSourceFiles(target->settings(),
339 &output_files); 339 &output_files);
340 PrintFileList(output_files, std::string(), true, false); 340 PrintFileList(output_files, std::string(), true, false);
341 } else if (target->output_type() == Target::EXECUTABLE) {
342 const Tool* tool = target->toolchain()->GetToolForTargetFinalOutput(target);
343
344 std::vector<OutputFile> output_files;
345 SubstitutionWriter::ApplyListToLinkerAsOutputFile(
346 target, tool, tool->outputs(), &output_files);
347
348 std::vector<SourceFile> output_files_as_source_file;
349 for (const OutputFile& output_file : output_files) {
350 output_files_as_source_file.push_back(
351 output_file.AsSourceFile(target->settings()->build_settings()));
352 }
353
354 PrintFileList(output_files_as_source_file, std::string(), true, false);
341 } else { 355 } else {
brettw 2016/06/29 23:12:09 Currently the "outputs" section was actually the o
sdefresne 2016/07/01 13:12:40 Done.
342 const SubstitutionList& outputs = target->action_values().outputs(); 356 const SubstitutionList& outputs = target->action_values().outputs();
343 if (!outputs.required_types().empty()) { 357 if (!outputs.required_types().empty()) {
344 // Display the pattern and resolved pattern separately, since there are 358 // Display the pattern and resolved pattern separately, since there are
345 // subtitutions used. 359 // subtitutions used.
346 OutputString(" Output pattern\n"); 360 OutputString(" Output pattern\n");
347 for (const auto& elem : outputs.list()) 361 for (const auto& elem : outputs.list())
348 OutputString(" " + elem.AsString() + "\n"); 362 OutputString(" " + elem.AsString() + "\n");
349 363
350 // Now display what that resolves to given the sources. 364 // Now display what that resolves to given the sources.
351 OutputString("\n Resolved output file list\n"); 365 OutputString("\n Resolved output file list\n");
(...skipping 257 matching lines...) Expand 10 before | Expand all | Expand 10 after
609 if (what.empty() || what == variables::kDepfile) { 623 if (what.empty() || what == variables::kDepfile) {
610 PrintDepfile(target, display_headers); 624 PrintDepfile(target, display_headers);
611 found_match = true; 625 found_match = true;
612 } 626 }
613 } 627 }
614 628
615 // Outputs. 629 // Outputs.
616 if (target->output_type() == Target::ACTION || 630 if (target->output_type() == Target::ACTION ||
617 target->output_type() == Target::ACTION_FOREACH || 631 target->output_type() == Target::ACTION_FOREACH ||
618 target->output_type() == Target::COPY_FILES || 632 target->output_type() == Target::COPY_FILES ||
619 target->output_type() == Target::CREATE_BUNDLE) { 633 target->output_type() == Target::CREATE_BUNDLE ||
634 target->output_type() == Target::EXECUTABLE) {
620 if (what.empty() || what == variables::kOutputs) { 635 if (what.empty() || what == variables::kOutputs) {
621 PrintOutputs(target, display_headers); 636 PrintOutputs(target, display_headers);
622 found_match = true; 637 found_match = true;
623 } 638 }
624 } 639 }
625 640
626 // Values from configs only apply to binary targets. 641 // Values from configs only apply to binary targets.
627 if (is_binary_output) { 642 if (is_binary_output) {
628 #define CONFIG_VALUE_ARRAY_HANDLER(name, type) \ 643 #define CONFIG_VALUE_ARRAY_HANDLER(name, type) \
629 if (what.empty() || what == #name) { \ 644 if (what.empty() || what == #name) { \
(...skipping 294 matching lines...) Expand 10 before | Expand all | Expand 10 after
924 printed_output = true; 939 printed_output = true;
925 940
926 if (!PrintConfig(config, what_to_print, display_item_header)) 941 if (!PrintConfig(config, what_to_print, display_item_header))
927 return 1; 942 return 1;
928 } 943 }
929 944
930 return 0; 945 return 0;
931 } 946 }
932 947
933 } // namespace commands 948 } // namespace commands
OLDNEW
« 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