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

Side by Side Diff: tools/gn/command_desc.cc

Issue 1752033002: Add "create_bundle" target in order to support bundle with gn. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@gn-bundle-data
Patch Set: Add unit tests, address comments, update docs and format with clang-format Created 4 years, 9 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 | « tools/gn/bundle_file_rule.cc ('k') | tools/gn/create_bundle_target_generator.h » ('j') | 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 309 matching lines...) Expand 10 before | Expand all | Expand 10 after
320 320
321 void PrintOutputs(const Target* target, bool display_header) { 321 void PrintOutputs(const Target* target, bool display_header) {
322 if (display_header) 322 if (display_header)
323 OutputString("\noutputs:\n"); 323 OutputString("\noutputs:\n");
324 324
325 if (target->output_type() == Target::ACTION) { 325 if (target->output_type() == Target::ACTION) {
326 // Action, print out outputs, don't apply sources to it. 326 // Action, print out outputs, don't apply sources to it.
327 for (const auto& elem : target->action_values().outputs().list()) { 327 for (const auto& elem : target->action_values().outputs().list()) {
328 OutputString(" " + elem.AsString() + "\n"); 328 OutputString(" " + elem.AsString() + "\n");
329 } 329 }
330 } else if (target->output_type() == Target::CREATE_BUNDLE) {
331 std::vector<SourceFile> output_files;
332 target->bundle_data().GetOutputsAsSourceFiles(target->settings(),
333 &output_files);
334 PrintFileList(output_files, "", true, false);
330 } else { 335 } else {
331 const SubstitutionList& outputs = target->action_values().outputs(); 336 const SubstitutionList& outputs = target->action_values().outputs();
332 if (!outputs.required_types().empty()) { 337 if (!outputs.required_types().empty()) {
333 // Display the pattern and resolved pattern separately, since there are 338 // Display the pattern and resolved pattern separately, since there are
334 // subtitutions used. 339 // subtitutions used.
335 OutputString(" Output pattern:\n"); 340 OutputString(" Output pattern:\n");
336 for (const auto& elem : outputs.list()) 341 for (const auto& elem : outputs.list())
337 OutputString(" " + elem.AsString() + "\n"); 342 OutputString(" " + elem.AsString() + "\n");
338 343
339 // Now display what that resolves to given the sources. 344 // Now display what that resolves to given the sources.
(...skipping 338 matching lines...) Expand 10 before | Expand all | Expand 10 after
678 } 683 }
679 684
680 // Display summary. 685 // Display summary.
681 686
682 // Display this only applicable to binary targets. 687 // Display this only applicable to binary targets.
683 bool is_binary_output = 688 bool is_binary_output =
684 target->output_type() != Target::GROUP && 689 target->output_type() != Target::GROUP &&
685 target->output_type() != Target::COPY_FILES && 690 target->output_type() != Target::COPY_FILES &&
686 target->output_type() != Target::ACTION && 691 target->output_type() != Target::ACTION &&
687 target->output_type() != Target::ACTION_FOREACH && 692 target->output_type() != Target::ACTION_FOREACH &&
688 target->output_type() != Target::BUNDLE_DATA; 693 target->output_type() != Target::BUNDLE_DATA &&
694 target->output_type() != Target::CREATE_BUNDLE;
689 695
690 // Generally we only want to display toolchains on labels when the toolchain 696 // Generally we only want to display toolchains on labels when the toolchain
691 // is different than the default one for this target (which we always print 697 // is different than the default one for this target (which we always print
692 // in the header). 698 // in the header).
693 Label target_toolchain = target->label().GetToolchainLabel(); 699 Label target_toolchain = target->label().GetToolchainLabel();
694 700
695 // Header. 701 // Header.
696 OutputString("Target: ", DECORATION_YELLOW); 702 OutputString("Target: ", DECORATION_YELLOW);
697 OutputString(target->label().GetUserVisibleName(false) + "\n"); 703 OutputString(target->label().GetUserVisibleName(false) + "\n");
698 OutputString("Type: ", DECORATION_YELLOW); 704 OutputString("Type: ", DECORATION_YELLOW);
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
732 738
733 if (target->output_type() == Target::ACTION || 739 if (target->output_type() == Target::ACTION ||
734 target->output_type() == Target::ACTION_FOREACH) { 740 target->output_type() == Target::ACTION_FOREACH) {
735 PrintScript(target, true); 741 PrintScript(target, true);
736 PrintArgs(target, true); 742 PrintArgs(target, true);
737 PrintDepfile(target, true); 743 PrintDepfile(target, true);
738 } 744 }
739 745
740 if (target->output_type() == Target::ACTION || 746 if (target->output_type() == Target::ACTION ||
741 target->output_type() == Target::ACTION_FOREACH || 747 target->output_type() == Target::ACTION_FOREACH ||
742 target->output_type() == Target::COPY_FILES) { 748 target->output_type() == Target::COPY_FILES ||
749 target->output_type() == Target::CREATE_BUNDLE) {
743 PrintOutputs(target, true); 750 PrintOutputs(target, true);
744 } 751 }
745 752
746 // Libs can be part of any target and get recursively pushed up the chain, 753 // Libs can be part of any target and get recursively pushed up the chain,
747 // so always display them, even for groups and such. 754 // so always display them, even for groups and such.
748 PrintLibs(target, true); 755 PrintLibs(target, true);
749 PrintLibDirs(target, true); 756 PrintLibDirs(target, true);
750 757
751 PrintDeps(target, true); 758 PrintDeps(target, true);
752 759
753 return 0; 760 return 0;
754 } 761 }
755 762
756 } // namespace commands 763 } // namespace commands
OLDNEW
« no previous file with comments | « tools/gn/bundle_file_rule.cc ('k') | tools/gn/create_bundle_target_generator.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698