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

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

Issue 46313003: Implement target visibility in GN (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 8 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 | Annotate | Revision Log
« no previous file with comments | « tools/gn/variables.h ('k') | tools/gn/visibility.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 "tools/gn/variables.h" 5 #include "tools/gn/variables.h"
6 6
7 namespace variables { 7 namespace variables {
8 8
9 // Built-in variables ---------------------------------------------------------- 9 // Built-in variables ----------------------------------------------------------
10 10
(...skipping 725 matching lines...) Expand 10 before | Expand all | Expand 10 after
736 " }\n"; 736 " }\n";
737 737
738 const char kSources[] = "sources"; 738 const char kSources[] = "sources";
739 const char kSources_HelpShort[] = 739 const char kSources_HelpShort[] =
740 "sources: [file list] Source files for a target."; 740 "sources: [file list] Source files for a target.";
741 const char kSources_Help[] = 741 const char kSources_Help[] =
742 "sources: Source files for a target\n" 742 "sources: Source files for a target\n"
743 "\n" 743 "\n"
744 " A list of files relative to the current buildfile.\n"; 744 " A list of files relative to the current buildfile.\n";
745 745
746 const char kVisibility[] = "visibility";
747 const char kVisibility_HelpShort[] =
748 "visibility: [label list] A list of labels that can depend on a target.";
749 const char kVisibility_Help[] =
750 "visibility: A list of labels that can depend on a target.\n"
751 "\n"
752 " A label or a list of labels and label patterns that define which\n"
753 " targets can depend on the current one. These permissions are checked\n"
754 " via then \"check\" command (see \"gn help check\").\n"
755 "\n"
756 " If visibility is not defined, it defaults to public (\"*\").\n"
757 "\n"
758 " If visibility is defined, only the targets with labels that match it\n"
759 " can depend on the current target. The empty list means no targets\n"
760 " can depend on the current target.\n"
761 "\n"
762 " Tip: Often you will want the same visibility for all targets in a\n"
763 " BUILD file. In this case you can just put the definition at the top,\n"
764 " outside of any target, and the targets will inherit that scope and see\n"
765 " the definition.\n"
766 "\n"
767 "Matching:\n"
768 "\n"
769 " You can specify \"*\" but the inputs aren't general patterns. The\n"
770 " following classes of patterns are supported:\n"
771 "\n"
772 " - Explicit (no wildcard):\n"
773 " \"//foo/bar:baz\"\n"
774 " \":baz\"\n"
775 " - Wildcard target names:\n"
776 " \"//foo/bar:*\" (any target in the //foo/bar/BUILD.gn file)\n"
777 " \":*\" (any target in the current build file)\n"
778 " - Wildcard directory names (\"*\" is only supported at the end)\n"
779 " \"*\" (any target anywhere)\n"
780 " \"//foo/bar/*\" (any target in any subdir of //foo/bar)\n"
781 " \"./*\" (any target in the current build file or sub dirs)\n"
782 "\n"
783 " The toolchain (normally an implicit part of a label) is ignored when\n"
784 " checking visibility.\n"
785 "\n"
786 "Examples:\n"
787 "\n"
788 " Only targets in the current buildfile (\"private\", the default):\n"
789 " visibility = \":*\"\n"
790 "\n"
791 " No targets (used for targets that should be leaf nodes):\n"
792 " visibility = []\n"
793 "\n"
794 " Any target (\"public\"):\n"
795 " visibility = \"*\"\n"
796 "\n"
797 " All targets in the current directory and any subdirectory:\n"
798 " visibility = \"./*\"\n"
799 "\n"
800 " Any target in \"//bar/BUILD.gn\":\n"
801 " visibility = \"//bar:*\"\n"
802 "\n"
803 " Any target in \"//bar/\" or any subdirectory thereof:\n"
804 " visibility = \"//bar/*\"\n"
805 "\n"
806 " Just these specific targets:\n"
807 " visibility = [ \":mything\", \"//foo:something_else\" ]\n"
808 "\n"
809 " Any target in the current directory and any subdirectory thereof, plus\n"
810 " any targets in \"//bar/\" and any subdirectory thereof.\n"
811 " visibility = [ \"./*\", \"//bar/*\" ]\n";
812
746 // ----------------------------------------------------------------------------- 813 // -----------------------------------------------------------------------------
747 814
748 VariableInfo::VariableInfo() 815 VariableInfo::VariableInfo()
749 : help_short(NULL), 816 : help_short(NULL),
750 help(NULL) { 817 help(NULL) {
751 } 818 }
752 819
753 VariableInfo::VariableInfo(const char* in_help_short, const char* in_help) 820 VariableInfo::VariableInfo(const char* in_help_short, const char* in_help)
754 : help_short(in_help_short), 821 : help_short(in_help_short),
755 help(in_help) { 822 help(in_help) {
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
799 INSERT_VARIABLE(IncludeDirs) 866 INSERT_VARIABLE(IncludeDirs)
800 INSERT_VARIABLE(Ldflags) 867 INSERT_VARIABLE(Ldflags)
801 INSERT_VARIABLE(Libs) 868 INSERT_VARIABLE(Libs)
802 INSERT_VARIABLE(LibDirs) 869 INSERT_VARIABLE(LibDirs)
803 INSERT_VARIABLE(OutputExtension) 870 INSERT_VARIABLE(OutputExtension)
804 INSERT_VARIABLE(OutputName) 871 INSERT_VARIABLE(OutputName)
805 INSERT_VARIABLE(Outputs) 872 INSERT_VARIABLE(Outputs)
806 INSERT_VARIABLE(Script) 873 INSERT_VARIABLE(Script)
807 INSERT_VARIABLE(SourcePrereqs) 874 INSERT_VARIABLE(SourcePrereqs)
808 INSERT_VARIABLE(Sources) 875 INSERT_VARIABLE(Sources)
876 INSERT_VARIABLE(Visibility)
809 } 877 }
810 return info_map; 878 return info_map;
811 } 879 }
812 880
813 #undef INSERT_VARIABLE 881 #undef INSERT_VARIABLE
814 882
815 } // namespace variables 883 } // namespace variables
OLDNEW
« no previous file with comments | « tools/gn/variables.h ('k') | tools/gn/visibility.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698