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

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

Issue 1887533003: Add an output_dir override to GN. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: const Created 4 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
« no previous file with comments | « tools/gn/substitution_type.h ('k') | tools/gn/substitution_writer.cc » ('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 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 #include "tools/gn/substitution_type.h" 5 #include "tools/gn/substitution_type.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 #include <stdlib.h> 8 #include <stdlib.h>
9 9
10 #include "tools/gn/err.h" 10 #include "tools/gn/err.h"
(...skipping 25 matching lines...) Expand all
36 "{{cflags_cc}}", // SUBSTITUTION_CFLAGS_CC 36 "{{cflags_cc}}", // SUBSTITUTION_CFLAGS_CC
37 "{{cflags_objc}}", // SUBSTITUTION_CFLAGS_OBJC 37 "{{cflags_objc}}", // SUBSTITUTION_CFLAGS_OBJC
38 "{{cflags_objcc}}", // SUBSTITUTION_CFLAGS_OBJCC 38 "{{cflags_objcc}}", // SUBSTITUTION_CFLAGS_OBJCC
39 "{{defines}}", // SUBSTITUTION_DEFINES 39 "{{defines}}", // SUBSTITUTION_DEFINES
40 "{{include_dirs}}", // SUBSTITUTION_INCLUDE_DIRS 40 "{{include_dirs}}", // SUBSTITUTION_INCLUDE_DIRS
41 41
42 "{{inputs}}", // SUBSTITUTION_LINKER_INPUTS 42 "{{inputs}}", // SUBSTITUTION_LINKER_INPUTS
43 "{{inputs_newline}}", // SUBSTITUTION_LINKER_INPUTS_NEWLINE 43 "{{inputs_newline}}", // SUBSTITUTION_LINKER_INPUTS_NEWLINE
44 "{{ldflags}}", // SUBSTITUTION_LDFLAGS 44 "{{ldflags}}", // SUBSTITUTION_LDFLAGS
45 "{{libs}}", // SUBSTITUTION_LIBS 45 "{{libs}}", // SUBSTITUTION_LIBS
46 "{{output_dir}}", // SUBSTITUTION_OUTPUT_DIR
46 "{{output_extension}}", // SUBSTITUTION_OUTPUT_EXTENSION 47 "{{output_extension}}", // SUBSTITUTION_OUTPUT_EXTENSION
47 "{{solibs}}", // SUBSTITUTION_SOLIBS 48 "{{solibs}}", // SUBSTITUTION_SOLIBS
48 49
49 "{{bundle_root_dir}}", // SUBSTITUTION_BUNDLE_ROOT_DIR 50 "{{bundle_root_dir}}", // SUBSTITUTION_BUNDLE_ROOT_DIR
50 "{{bundle_resources_dir}}", // SUBSTITUTION_BUNDLE_RESOURCES_DIR 51 "{{bundle_resources_dir}}", // SUBSTITUTION_BUNDLE_RESOURCES_DIR
51 "{{bundle_executable_dir}}", // SUBSTITUTION_BUNDLE_EXECUTABLE_DIR 52 "{{bundle_executable_dir}}", // SUBSTITUTION_BUNDLE_EXECUTABLE_DIR
52 "{{bundle_plugins_dir}}", // SUBSTITUTION_BUNDLE_PLUGINS_DIR 53 "{{bundle_plugins_dir}}", // SUBSTITUTION_BUNDLE_PLUGINS_DIR
53 54
54 "{{response_file_name}}", // SUBSTITUTION_RSP_FILE_NAME 55 "{{response_file_name}}", // SUBSTITUTION_RSP_FILE_NAME
55 }; 56 };
(...skipping 28 matching lines...) Expand all
84 "defines", // SUBSTITUTION_DEFINES 85 "defines", // SUBSTITUTION_DEFINES
85 "include_dirs", // SUBSTITUTION_INCLUDE_DIRS 86 "include_dirs", // SUBSTITUTION_INCLUDE_DIRS
86 87
87 // LINKER_INPUTS expands to the same Ninja var as SUBSTITUTION_SOURCE. These 88 // LINKER_INPUTS expands to the same Ninja var as SUBSTITUTION_SOURCE. These
88 // are used in different contexts and are named differently to keep things 89 // are used in different contexts and are named differently to keep things
89 // clear, but they both expand to the "set of input files" for a build rule. 90 // clear, but they both expand to the "set of input files" for a build rule.
90 "in", // SUBSTITUTION_LINKER_INPUTS 91 "in", // SUBSTITUTION_LINKER_INPUTS
91 "in_newline", // SUBSTITUTION_LINKER_INPUTS_NEWLINE 92 "in_newline", // SUBSTITUTION_LINKER_INPUTS_NEWLINE
92 "ldflags", // SUBSTITUTION_LDFLAGS 93 "ldflags", // SUBSTITUTION_LDFLAGS
93 "libs", // SUBSTITUTION_LIBS 94 "libs", // SUBSTITUTION_LIBS
95 "output_dir", // SUBSTITUTION_OUTPUT_DIR
94 "output_extension", // SUBSTITUTION_OUTPUT_EXTENSION 96 "output_extension", // SUBSTITUTION_OUTPUT_EXTENSION
95 "solibs", // SUBSTITUTION_SOLIBS 97 "solibs", // SUBSTITUTION_SOLIBS
96 98
97 "bundle_root_dir", // SUBSTITUTION_BUNDLE_ROOT_DIR 99 "bundle_root_dir", // SUBSTITUTION_BUNDLE_ROOT_DIR
98 "bundle_resources_dir", // SUBSTITUTION_BUNDLE_RESOURCES_DIR 100 "bundle_resources_dir", // SUBSTITUTION_BUNDLE_RESOURCES_DIR
99 "bundle_executable_dir", // SUBSTITUTION_BUNDLE_EXECUTABLE_DIR 101 "bundle_executable_dir", // SUBSTITUTION_BUNDLE_EXECUTABLE_DIR
100 "bundle_plugins_dir", // SUBSTITUTION_BUNDLE_PLUGINS_DIR 102 "bundle_plugins_dir", // SUBSTITUTION_BUNDLE_PLUGINS_DIR
101 103
102 "rspfile", // SUBSTITUTION_RSP_FILE_NAME 104 "rspfile", // SUBSTITUTION_RSP_FILE_NAME
103 }; 105 };
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
186 return (IsValidToolSubstitution(type) && type != SUBSTITUTION_OUTPUT) || 188 return (IsValidToolSubstitution(type) && type != SUBSTITUTION_OUTPUT) ||
187 IsValidSourceSubstitution(type); 189 IsValidSourceSubstitution(type);
188 } 190 }
189 191
190 bool IsValidLinkerSubstitution(SubstitutionType type) { 192 bool IsValidLinkerSubstitution(SubstitutionType type) {
191 return IsValidToolSubstitution(type) || 193 return IsValidToolSubstitution(type) ||
192 type == SUBSTITUTION_LINKER_INPUTS || 194 type == SUBSTITUTION_LINKER_INPUTS ||
193 type == SUBSTITUTION_LINKER_INPUTS_NEWLINE || 195 type == SUBSTITUTION_LINKER_INPUTS_NEWLINE ||
194 type == SUBSTITUTION_LDFLAGS || 196 type == SUBSTITUTION_LDFLAGS ||
195 type == SUBSTITUTION_LIBS || 197 type == SUBSTITUTION_LIBS ||
198 type == SUBSTITUTION_OUTPUT_DIR ||
196 type == SUBSTITUTION_OUTPUT_EXTENSION || 199 type == SUBSTITUTION_OUTPUT_EXTENSION ||
197 type == SUBSTITUTION_SOLIBS; 200 type == SUBSTITUTION_SOLIBS;
198 } 201 }
199 202
200 bool IsValidLinkerOutputsSubstitution(SubstitutionType type) { 203 bool IsValidLinkerOutputsSubstitution(SubstitutionType type) {
201 // All valid compiler outputs plus the output extension. 204 // All valid compiler outputs plus the output extension.
202 return IsValidCompilerOutputsSubstitution(type) || 205 return IsValidCompilerOutputsSubstitution(type) ||
206 type == SUBSTITUTION_OUTPUT_DIR ||
203 type == SUBSTITUTION_OUTPUT_EXTENSION; 207 type == SUBSTITUTION_OUTPUT_EXTENSION;
204 } 208 }
205 209
206 bool IsValidCopySubstitution(SubstitutionType type) { 210 bool IsValidCopySubstitution(SubstitutionType type) {
207 return IsValidToolSubstitution(type) || 211 return IsValidToolSubstitution(type) ||
208 type == SUBSTITUTION_SOURCE; 212 type == SUBSTITUTION_SOURCE;
209 } 213 }
210 214
211 bool IsValidCompileXCassetsSubstitution(SubstitutionType type) { 215 bool IsValidCompileXCassetsSubstitution(SubstitutionType type) {
212 return IsValidToolSubstitution(type) || 216 return IsValidToolSubstitution(type) ||
213 type == SUBSTITUTION_LINKER_INPUTS; 217 type == SUBSTITUTION_LINKER_INPUTS;
214 } 218 }
215 219
216 bool EnsureValidSourcesSubstitutions( 220 bool EnsureValidSourcesSubstitutions(
217 const std::vector<SubstitutionType>& types, 221 const std::vector<SubstitutionType>& types,
218 const ParseNode* origin, 222 const ParseNode* origin,
219 Err* err) { 223 Err* err) {
220 for (size_t i = 0; i < types.size(); i++) { 224 for (size_t i = 0; i < types.size(); i++) {
221 if (!IsValidSourceSubstitution(types[i])) { 225 if (!IsValidSourceSubstitution(types[i])) {
222 *err = Err(origin, "Invalid substitution type.", 226 *err = Err(origin, "Invalid substitution type.",
223 "The substitution " + std::string(kSubstitutionNames[types[i]]) + 227 "The substitution " + std::string(kSubstitutionNames[types[i]]) +
224 " isn't valid for something\n" 228 " isn't valid for something\n"
225 "operating on a source file such as this."); 229 "operating on a source file such as this.");
226 return false; 230 return false;
227 } 231 }
228 } 232 }
229 return true; 233 return true;
230 } 234 }
OLDNEW
« no previous file with comments | « tools/gn/substitution_type.h ('k') | tools/gn/substitution_writer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698