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

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

Issue 1436563003: Support spaces in Mac GN build output names. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 1 month 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 <stdlib.h> 7 #include <stdlib.h>
8 8
9 #include "tools/gn/err.h" 9 #include "tools/gn/err.h"
10 10
11 const char* kSubstitutionNames[SUBSTITUTION_NUM_TYPES] = { 11 const char* kSubstitutionNames[SUBSTITUTION_NUM_TYPES] = {
12 "<<literal>>", // SUBSTITUTION_LITERAL 12 "<<literal>>", // SUBSTITUTION_LITERAL
13 13
14 "{{source}}", // SUBSTITUTION_SOURCE 14 "{{source}}", // SUBSTITUTION_SOURCE
15 "{{output}}", // SUBSTITUTION_OUTPUT 15 "{{output}}", // SUBSTITUTION_OUTPUT
16 16
17 "{{source_name_part}}", // SUBSTITUTION_NAME_PART 17 "{{source_name_part}}", // SUBSTITUTION_NAME_PART
18 "{{source_file_part}}", // SUBSTITUTION_FILE_PART 18 "{{source_file_part}}", // SUBSTITUTION_FILE_PART
19 "{{source_dir}}", // SUBSTITUTION_SOURCE_DIR 19 "{{source_dir}}", // SUBSTITUTION_SOURCE_DIR
20 "{{source_root_relative_dir}}", // SUBSTITUTION_SOURCE_ROOT_RELATIVE_DIR 20 "{{source_root_relative_dir}}", // SUBSTITUTION_SOURCE_ROOT_RELATIVE_DIR
21 "{{source_gen_dir}}", // SUBSTITUTION_SOURCE_GEN_DIR 21 "{{source_gen_dir}}", // SUBSTITUTION_SOURCE_GEN_DIR
22 "{{source_out_dir}}", // SUBSTITUTION_SOURCE_OUT_DIR 22 "{{source_out_dir}}", // SUBSTITUTION_SOURCE_OUT_DIR
23 23
24 "{{label}}", // SUBSTITUTION_LABEL 24 "{{label}}", // SUBSTITUTION_LABEL
25 "{{label_name}}", // SUBSTITUTION_LABEL_NAME
25 "{{root_gen_dir}}", // SUBSTITUTION_ROOT_GEN_DIR 26 "{{root_gen_dir}}", // SUBSTITUTION_ROOT_GEN_DIR
26 "{{root_out_dir}}", // SUBSTITUTION_ROOT_OUT_DIR 27 "{{root_out_dir}}", // SUBSTITUTION_ROOT_OUT_DIR
27 "{{target_gen_dir}}", // SUBSTITUTION_TARGET_GEN_DIR 28 "{{target_gen_dir}}", // SUBSTITUTION_TARGET_GEN_DIR
28 "{{target_out_dir}}", // SUBSTITUTION_TARGET_OUT_DIR 29 "{{target_out_dir}}", // SUBSTITUTION_TARGET_OUT_DIR
29 "{{target_output_name}}", // SUBSTITUTION_TARGET_OUTPUT_NAME 30 "{{target_output_name}}", // SUBSTITUTION_TARGET_OUTPUT_NAME
30 31
31 "{{asmflags}}", // SUBSTITUTION_ASMFLAGS 32 "{{asmflags}}", // SUBSTITUTION_ASMFLAGS
32 "{{cflags}}", // SUBSTITUTION_CFLAGS 33 "{{cflags}}", // SUBSTITUTION_CFLAGS
33 "{{cflags_c}}", // SUBSTITUTION_CFLAGS_C 34 "{{cflags_c}}", // SUBSTITUTION_CFLAGS_C
34 "{{cflags_cc}}", // SUBSTITUTION_CFLAGS_CC 35 "{{cflags_cc}}", // SUBSTITUTION_CFLAGS_CC
(...skipping 17 matching lines...) Expand all
52 "out", // SUBSTITUTION_OUTPUT 53 "out", // SUBSTITUTION_OUTPUT
53 54
54 "source_name_part", // SUBSTITUTION_NAME_PART 55 "source_name_part", // SUBSTITUTION_NAME_PART
55 "source_file_part", // SUBSTITUTION_FILE_PART 56 "source_file_part", // SUBSTITUTION_FILE_PART
56 "source_dir", // SUBSTITUTION_SOURCE_DIR 57 "source_dir", // SUBSTITUTION_SOURCE_DIR
57 "source_root_relative_dir", // SUBSTITUTION_SOURCE_ROOT_RELATIVE_DIR 58 "source_root_relative_dir", // SUBSTITUTION_SOURCE_ROOT_RELATIVE_DIR
58 "source_gen_dir", // SUBSTITUTION_SOURCE_GEN_DIR 59 "source_gen_dir", // SUBSTITUTION_SOURCE_GEN_DIR
59 "source_out_dir", // SUBSTITUTION_SOURCE_OUT_DIR 60 "source_out_dir", // SUBSTITUTION_SOURCE_OUT_DIR
60 61
61 "label", // SUBSTITUTION_LABEL 62 "label", // SUBSTITUTION_LABEL
63 "label_name", // SUBSTITUTION_LABEL_NAME
62 "root_gen_dir", // SUBSTITUTION_ROOT_GEN_DIR 64 "root_gen_dir", // SUBSTITUTION_ROOT_GEN_DIR
63 "root_out_dir", // SUBSTITUTION_ROOT_OUT_DIR 65 "root_out_dir", // SUBSTITUTION_ROOT_OUT_DIR
64 "target_gen_dir", // SUBSTITUTION_TARGET_GEN_DIR 66 "target_gen_dir", // SUBSTITUTION_TARGET_GEN_DIR
65 "target_out_dir", // SUBSTITUTION_TARGET_OUT_DIR 67 "target_out_dir", // SUBSTITUTION_TARGET_OUT_DIR
66 "target_output_name", // SUBSTITUTION_TARGET_OUTPUT_NAME 68 "target_output_name", // SUBSTITUTION_TARGET_OUTPUT_NAME
67 69
68 "asmflags", // SUBSTITUTION_ASMFLAGS 70 "asmflags", // SUBSTITUTION_ASMFLAGS
69 "cflags", // SUBSTITUTION_CFLAGS 71 "cflags", // SUBSTITUTION_CFLAGS
70 "cflags_c", // SUBSTITUTION_CFLAGS_C 72 "cflags_c", // SUBSTITUTION_CFLAGS_C
71 "cflags_cc", // SUBSTITUTION_CFLAGS_CC 73 "cflags_cc", // SUBSTITUTION_CFLAGS_CC
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
117 type == SUBSTITUTION_SOURCE_DIR || 119 type == SUBSTITUTION_SOURCE_DIR ||
118 type == SUBSTITUTION_SOURCE_ROOT_RELATIVE_DIR || 120 type == SUBSTITUTION_SOURCE_ROOT_RELATIVE_DIR ||
119 type == SUBSTITUTION_SOURCE_GEN_DIR || 121 type == SUBSTITUTION_SOURCE_GEN_DIR ||
120 type == SUBSTITUTION_SOURCE_OUT_DIR; 122 type == SUBSTITUTION_SOURCE_OUT_DIR;
121 } 123 }
122 124
123 bool IsValidToolSubstutition(SubstitutionType type) { 125 bool IsValidToolSubstutition(SubstitutionType type) {
124 return type == SUBSTITUTION_LITERAL || 126 return type == SUBSTITUTION_LITERAL ||
125 type == SUBSTITUTION_OUTPUT || 127 type == SUBSTITUTION_OUTPUT ||
126 type == SUBSTITUTION_LABEL || 128 type == SUBSTITUTION_LABEL ||
129 type == SUBSTITUTION_LABEL_NAME ||
127 type == SUBSTITUTION_ROOT_GEN_DIR || 130 type == SUBSTITUTION_ROOT_GEN_DIR ||
128 type == SUBSTITUTION_ROOT_OUT_DIR || 131 type == SUBSTITUTION_ROOT_OUT_DIR ||
129 type == SUBSTITUTION_TARGET_GEN_DIR || 132 type == SUBSTITUTION_TARGET_GEN_DIR ||
130 type == SUBSTITUTION_TARGET_OUT_DIR || 133 type == SUBSTITUTION_TARGET_OUT_DIR ||
131 type == SUBSTITUTION_TARGET_OUTPUT_NAME; 134 type == SUBSTITUTION_TARGET_OUTPUT_NAME;
132 } 135 }
133 136
134 bool IsValidCompilerSubstitution(SubstitutionType type) { 137 bool IsValidCompilerSubstitution(SubstitutionType type) {
135 return IsValidToolSubstutition(type) || 138 return IsValidToolSubstutition(type) ||
136 IsValidSourceSubstitution(type) || 139 IsValidSourceSubstitution(type) ||
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
180 if (!IsValidSourceSubstitution(types[i])) { 183 if (!IsValidSourceSubstitution(types[i])) {
181 *err = Err(origin, "Invalid substitution type.", 184 *err = Err(origin, "Invalid substitution type.",
182 "The substitution " + std::string(kSubstitutionNames[i]) + 185 "The substitution " + std::string(kSubstitutionNames[i]) +
183 " isn't valid for something\n" 186 " isn't valid for something\n"
184 "operating on a source file such as this."); 187 "operating on a source file such as this.");
185 return false; 188 return false;
186 } 189 }
187 } 190 }
188 return true; 191 return true;
189 } 192 }
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