OLD | NEW |
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 Loading... |
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 { | 341 } else if (target->output_type() == Target::ACTION_FOREACH) { |
342 const SubstitutionList& outputs = target->action_values().outputs(); | 342 const SubstitutionList& outputs = target->action_values().outputs(); |
343 if (!outputs.required_types().empty()) { | 343 if (!outputs.required_types().empty()) { |
344 // Display the pattern and resolved pattern separately, since there are | 344 // Display the pattern and resolved pattern separately, since there are |
345 // subtitutions used. | 345 // subtitutions used. |
346 OutputString(" Output pattern\n"); | 346 OutputString(" Output pattern\n"); |
347 for (const auto& elem : outputs.list()) | 347 for (const auto& elem : outputs.list()) |
348 OutputString(" " + elem.AsString() + "\n"); | 348 OutputString(" " + elem.AsString() + "\n"); |
349 | 349 |
350 // Now display what that resolves to given the sources. | 350 // Now display what that resolves to given the sources. |
351 OutputString("\n Resolved output file list\n"); | 351 OutputString("\n Resolved output file list\n"); |
352 } | 352 } |
353 | 353 |
354 // Resolved output list. | 354 // Resolved output list. |
355 std::vector<SourceFile> output_files; | 355 std::vector<SourceFile> output_files; |
356 SubstitutionWriter::ApplyListToSources(target->settings(), outputs, | 356 SubstitutionWriter::ApplyListToSources(target->settings(), outputs, |
357 target->sources(), &output_files); | 357 target->sources(), &output_files); |
358 PrintFileList(output_files, std::string(), true, false); | 358 PrintFileList(output_files, std::string(), true, false); |
| 359 } else { |
| 360 DCHECK(target->IsBinary()); |
| 361 const Tool* tool = target->toolchain()->GetToolForTargetFinalOutput(target); |
| 362 |
| 363 std::vector<OutputFile> output_files; |
| 364 SubstitutionWriter::ApplyListToLinkerAsOutputFile( |
| 365 target, tool, tool->outputs(), &output_files); |
| 366 |
| 367 std::vector<SourceFile> output_files_as_source_file; |
| 368 for (const OutputFile& output_file : output_files) { |
| 369 output_files_as_source_file.push_back( |
| 370 output_file.AsSourceFile(target->settings()->build_settings())); |
| 371 } |
| 372 |
| 373 PrintFileList(output_files_as_source_file, std::string(), true, false); |
359 } | 374 } |
360 } | 375 } |
361 | 376 |
362 void PrintScript(const Target* target, bool display_header) { | 377 void PrintScript(const Target* target, bool display_header) { |
363 if (display_header) | 378 if (display_header) |
364 OutputString("\nscript\n"); | 379 OutputString("\nscript\n"); |
365 OutputString(" " + target->action_values().script().value() + "\n"); | 380 OutputString(" " + target->action_values().script().value() + "\n"); |
366 } | 381 } |
367 | 382 |
368 void PrintArgs(const Target* target, bool display_header) { | 383 void PrintArgs(const Target* target, bool display_header) { |
(...skipping 237 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
606 PrintArgs(target, display_headers); | 621 PrintArgs(target, display_headers); |
607 found_match = true; | 622 found_match = true; |
608 } | 623 } |
609 if (what.empty() || what == variables::kDepfile) { | 624 if (what.empty() || what == variables::kDepfile) { |
610 PrintDepfile(target, display_headers); | 625 PrintDepfile(target, display_headers); |
611 found_match = true; | 626 found_match = true; |
612 } | 627 } |
613 } | 628 } |
614 | 629 |
615 // Outputs. | 630 // Outputs. |
616 if (target->output_type() == Target::ACTION || | 631 if (target->output_type() != Target::SOURCE_SET && |
617 target->output_type() == Target::ACTION_FOREACH || | 632 target->output_type() != Target::GROUP) { |
618 target->output_type() == Target::COPY_FILES || | |
619 target->output_type() == Target::CREATE_BUNDLE) { | |
620 if (what.empty() || what == variables::kOutputs) { | 633 if (what.empty() || what == variables::kOutputs) { |
621 PrintOutputs(target, display_headers); | 634 PrintOutputs(target, display_headers); |
622 found_match = true; | 635 found_match = true; |
623 } | 636 } |
624 } | 637 } |
625 | 638 |
626 // Values from configs only apply to binary targets. | 639 // Values from configs only apply to binary targets. |
627 if (is_binary_output) { | 640 if (is_binary_output) { |
628 #define CONFIG_VALUE_ARRAY_HANDLER(name, type) \ | 641 #define CONFIG_VALUE_ARRAY_HANDLER(name, type) \ |
629 if (what.empty() || what == #name) { \ | 642 if (what.empty() || what == #name) { \ |
(...skipping 183 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
813 "Configs\n" | 826 "Configs\n" |
814 "\n" | 827 "\n" |
815 " The \"configs\" section will list all configs that apply. For targets\n" | 828 " The \"configs\" section will list all configs that apply. For targets\n" |
816 " this will include configs specified in the \"configs\" variable of\n" | 829 " this will include configs specified in the \"configs\" variable of\n" |
817 " the target, and also configs pushed onto this target via public\n" | 830 " the target, and also configs pushed onto this target via public\n" |
818 " or \"all dependent\" configs.\n" | 831 " or \"all dependent\" configs.\n" |
819 "\n" | 832 "\n" |
820 " Configs can have child configs. Specifying --tree will show the\n" | 833 " Configs can have child configs. Specifying --tree will show the\n" |
821 " hierarchy.\n" | 834 " hierarchy.\n" |
822 "\n" | 835 "\n" |
| 836 "Printing outputs\n" |
| 837 "\n" |
| 838 " The \"outputs\" section will list all outputs that apply, including\n" |
| 839 " the outputs computed from the tool definition (eg for \"executable\",\n" |
| 840 " \"static_library\", ... targets).\n" |
| 841 "\n" |
823 "Printing deps\n" | 842 "Printing deps\n" |
824 "\n" | 843 "\n" |
825 " Deps will include all public, private, and data deps (TODO this could\n" | 844 " Deps will include all public, private, and data deps (TODO this could\n" |
826 " be clarified and enhanced) sorted in order applying. The following\n" | 845 " be clarified and enhanced) sorted in order applying. The following\n" |
827 " may be used:\n" | 846 " may be used:\n" |
828 "\n" | 847 "\n" |
829 " --all\n" | 848 " --all\n" |
830 " Collects all recursive dependencies and prints a sorted flat list.\n" | 849 " Collects all recursive dependencies and prints a sorted flat list.\n" |
831 " Also usable with --tree (see below).\n" | 850 " Also usable with --tree (see below).\n" |
832 "\n" | 851 "\n" |
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
924 printed_output = true; | 943 printed_output = true; |
925 | 944 |
926 if (!PrintConfig(config, what_to_print, display_item_header)) | 945 if (!PrintConfig(config, what_to_print, display_item_header)) |
927 return 1; | 946 return 1; |
928 } | 947 } |
929 | 948 |
930 return 0; | 949 return 0; |
931 } | 950 } |
932 | 951 |
933 } // namespace commands | 952 } // namespace commands |
OLD | NEW |