OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 #ifndef TOOLS_GN_SUBSTITUTION_TYPE_H_ | 5 #ifndef TOOLS_GN_SUBSTITUTION_TYPE_H_ |
6 #define TOOLS_GN_SUBSTITUTION_TYPE_H_ | 6 #define TOOLS_GN_SUBSTITUTION_TYPE_H_ |
7 | 7 |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 class Err; | 10 class Err; |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
52 SUBSTITUTION_INCLUDE_DIRS, // {{include_dirs}} | 52 SUBSTITUTION_INCLUDE_DIRS, // {{include_dirs}} |
53 | 53 |
54 // Valid for linker tools. | 54 // Valid for linker tools. |
55 SUBSTITUTION_LINKER_INPUTS, // {{inputs}} | 55 SUBSTITUTION_LINKER_INPUTS, // {{inputs}} |
56 SUBSTITUTION_LINKER_INPUTS_NEWLINE, // {{inputs_newline}} | 56 SUBSTITUTION_LINKER_INPUTS_NEWLINE, // {{inputs_newline}} |
57 SUBSTITUTION_LDFLAGS, // {{ldflags}} | 57 SUBSTITUTION_LDFLAGS, // {{ldflags}} |
58 SUBSTITUTION_LIBS, // {{libs}} | 58 SUBSTITUTION_LIBS, // {{libs}} |
59 SUBSTITUTION_OUTPUT_EXTENSION, // {{output_extension}} | 59 SUBSTITUTION_OUTPUT_EXTENSION, // {{output_extension}} |
60 SUBSTITUTION_SOLIBS, // {{solibs}} | 60 SUBSTITUTION_SOLIBS, // {{solibs}} |
61 | 61 |
| 62 // Valid for bundle_data targets. |
| 63 SUBSTITUTION_BUNDLE_ROOT_DIR, // {{bundle_root_dir}} |
| 64 SUBSTITUTION_BUNDLE_RESOURCES_DIR, // {{bundle_resources_dir}} |
| 65 SUBSTITUTION_BUNDLE_EXECUTABLE_DIR, // {{bundle_executable_dir}} |
| 66 SUBSTITUTION_BUNDLE_PLUGINS_DIR, // {{bundle_plugins_dir}} |
| 67 |
62 // Used only for the args of actions. | 68 // Used only for the args of actions. |
63 SUBSTITUTION_RSP_FILE_NAME, // {{response_file_name}} | 69 SUBSTITUTION_RSP_FILE_NAME, // {{response_file_name}} |
64 | 70 |
65 SUBSTITUTION_NUM_TYPES // Must be last. | 71 SUBSTITUTION_NUM_TYPES // Must be last. |
66 }; | 72 }; |
67 | 73 |
68 // An array of size SUBSTITUTION_NUM_TYPES that lists the names of the | 74 // An array of size SUBSTITUTION_NUM_TYPES that lists the names of the |
69 // substitution patterns, including the curly braces. So, for example, | 75 // substitution patterns, including the curly braces. So, for example, |
70 // kSubstitutionNames[SUBSTITUTION_SOURCE] == "{{source}}". | 76 // kSubstitutionNames[SUBSTITUTION_SOURCE] == "{{source}}". |
71 extern const char* kSubstitutionNames[SUBSTITUTION_NUM_TYPES]; | 77 extern const char* kSubstitutionNames[SUBSTITUTION_NUM_TYPES]; |
(...skipping 17 matching lines...) Expand all Loading... |
89 void FillVector(std::vector<SubstitutionType>* vect) const; | 95 void FillVector(std::vector<SubstitutionType>* vect) const; |
90 | 96 |
91 bool used[SUBSTITUTION_NUM_TYPES]; | 97 bool used[SUBSTITUTION_NUM_TYPES]; |
92 }; | 98 }; |
93 | 99 |
94 // Returns true if the given substitution pattern references the output | 100 // Returns true if the given substitution pattern references the output |
95 // directory. This is used to check strings that begin with a substitution to | 101 // directory. This is used to check strings that begin with a substitution to |
96 // verify that they produce a file in the output directory. | 102 // verify that they produce a file in the output directory. |
97 bool SubstitutionIsInOutputDir(SubstitutionType type); | 103 bool SubstitutionIsInOutputDir(SubstitutionType type); |
98 | 104 |
| 105 // Returns true if the given substitution pattern references the bundle |
| 106 // directory. This is used to check strings that begin with a substitution to |
| 107 // verify that they produce a file in the bundle directory. |
| 108 bool SubstitutionIsInBundleDir(SubstitutionType type); |
| 109 |
99 // Returns true if the given substitution is valid for the named purpose. | 110 // Returns true if the given substitution is valid for the named purpose. |
| 111 bool IsValidBundleDataSubstitution(SubstitutionType type); |
100 bool IsValidSourceSubstitution(SubstitutionType type); | 112 bool IsValidSourceSubstitution(SubstitutionType type); |
101 // Both compiler and linker tools. | 113 // Both compiler and linker tools. |
102 bool IsValidToolSubstitution(SubstitutionType type); | 114 bool IsValidToolSubstitution(SubstitutionType type); |
103 bool IsValidCompilerSubstitution(SubstitutionType type); | 115 bool IsValidCompilerSubstitution(SubstitutionType type); |
104 bool IsValidCompilerOutputsSubstitution(SubstitutionType type); | 116 bool IsValidCompilerOutputsSubstitution(SubstitutionType type); |
105 bool IsValidLinkerSubstitution(SubstitutionType type); | 117 bool IsValidLinkerSubstitution(SubstitutionType type); |
106 bool IsValidLinkerOutputsSubstitution(SubstitutionType type); | 118 bool IsValidLinkerOutputsSubstitution(SubstitutionType type); |
107 bool IsValidCopySubstitution(SubstitutionType type); | 119 bool IsValidCopySubstitution(SubstitutionType type); |
108 | 120 |
109 // Like the "IsValid..." version above but checks a list of types and sets a | 121 // Like the "IsValid..." version above but checks a list of types and sets a |
110 // an error blaming the given source if the test fails. | 122 // an error blaming the given source if the test fails. |
111 bool EnsureValidSourcesSubstitutions( | 123 bool EnsureValidSourcesSubstitutions( |
112 const std::vector<SubstitutionType>& types, | 124 const std::vector<SubstitutionType>& types, |
113 const ParseNode* origin, | 125 const ParseNode* origin, |
114 Err* err); | 126 Err* err); |
115 | 127 |
116 #endif // TOOLS_GN_SUBSTITUTION_TYPE_H_ | 128 #endif // TOOLS_GN_SUBSTITUTION_TYPE_H_ |
OLD | NEW |