OLD | NEW |
---|---|
1 # Copyright (c) 2012 Google Inc. All rights reserved. | 1 # Copyright (c) 2012 Google Inc. 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 import copy | 5 import copy |
6 import gyp | 6 import gyp |
7 import gyp.common | 7 import gyp.common |
8 import gyp.system_test | 8 import gyp.system_test |
9 import gyp.xcode_emulation | 9 import gyp.xcode_emulation |
10 import os.path | 10 import os.path |
(...skipping 184 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
195 dir. Otherwise, |product_dir| is the relative path to the product | 195 dir. Otherwise, |product_dir| is the relative path to the product |
196 dir. | 196 dir. |
197 """ | 197 """ |
198 | 198 |
199 PRODUCT_DIR = '$!PRODUCT_DIR' | 199 PRODUCT_DIR = '$!PRODUCT_DIR' |
200 if PRODUCT_DIR in path: | 200 if PRODUCT_DIR in path: |
201 if product_dir: | 201 if product_dir: |
202 path = path.replace(PRODUCT_DIR, product_dir) | 202 path = path.replace(PRODUCT_DIR, product_dir) |
203 else: | 203 else: |
204 path = path.replace(PRODUCT_DIR + '/', '') | 204 path = path.replace(PRODUCT_DIR + '/', '') |
205 path = path.replace(PRODUCT_DIR + '\\', '') | 205 path = path.replace(PRODUCT_DIR + '\\', '') |
Evan Martin
2012/02/20 22:18:19
The two above lines can now be removed, as the one
| |
206 path = path.replace(PRODUCT_DIR, '.') | 206 path = path.replace(PRODUCT_DIR, '.') |
207 | 207 |
208 INTERMEDIATE_DIR = '$!INTERMEDIATE_DIR' | 208 INTERMEDIATE_DIR = '$!INTERMEDIATE_DIR' |
209 if INTERMEDIATE_DIR in path: | 209 if INTERMEDIATE_DIR in path: |
210 int_dir = self.GypPathToUniqueOutput('gen') | 210 int_dir = self.GypPathToUniqueOutput('gen') |
211 # GypPathToUniqueOutput generates a path relative to the product dir, | 211 # GypPathToUniqueOutput generates a path relative to the product dir, |
212 # so insert product_dir in front if it is provided. | 212 # so insert product_dir in front if it is provided. |
213 path = path.replace(INTERMEDIATE_DIR, | 213 path = path.replace(INTERMEDIATE_DIR, |
214 os.path.join(product_dir or '', int_dir)) | 214 os.path.join(product_dir or '', int_dir)) |
215 | 215 |
216 return path | 216 return os.path.normpath(path) |
217 | 217 |
218 def ExpandRuleVariables(self, path, root, dirname, source, ext, name): | 218 def ExpandRuleVariables(self, path, root, dirname, source, ext, name): |
219 path = path.replace(generator_default_variables['RULE_INPUT_ROOT'], root) | 219 path = path.replace(generator_default_variables['RULE_INPUT_ROOT'], root) |
220 path = path.replace(generator_default_variables['RULE_INPUT_DIRNAME'], | 220 path = path.replace(generator_default_variables['RULE_INPUT_DIRNAME'], |
221 dirname) | 221 dirname) |
222 path = path.replace(generator_default_variables['RULE_INPUT_PATH'], source) | 222 path = path.replace(generator_default_variables['RULE_INPUT_PATH'], source) |
223 path = path.replace(generator_default_variables['RULE_INPUT_EXT'], ext) | 223 path = path.replace(generator_default_variables['RULE_INPUT_EXT'], ext) |
224 path = path.replace(generator_default_variables['RULE_INPUT_NAME'], name) | 224 path = path.replace(generator_default_variables['RULE_INPUT_NAME'], name) |
225 return path | 225 return path |
226 | 226 |
(...skipping 949 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1176 '&& touch $out') | 1176 '&& touch $out') |
1177 master_ninja.rule( | 1177 master_ninja.rule( |
1178 'stamp', | 1178 'stamp', |
1179 description='STAMP $out', | 1179 description='STAMP $out', |
1180 command='${postbuilds}touch $out') | 1180 command='${postbuilds}touch $out') |
1181 if flavor == 'win': | 1181 if flavor == 'win': |
1182 # TODO(scottmg): Copy fallback? | 1182 # TODO(scottmg): Copy fallback? |
1183 master_ninja.rule( | 1183 master_ninja.rule( |
1184 'copy', | 1184 'copy', |
1185 description='COPY $in $out', | 1185 description='COPY $in $out', |
1186 command='mklink /h $out $in >nul') | 1186 command='cmd /c mklink /h $out $in >nul || mklink /h /j $out $in >nul') |
1187 else: | 1187 else: |
1188 master_ninja.rule( | 1188 master_ninja.rule( |
1189 'copy', | 1189 'copy', |
1190 description='COPY $in $out', | 1190 description='COPY $in $out', |
1191 command='ln -f $in $out 2>/dev/null || (rm -rf $out && cp -af $in $out)') | 1191 command='ln -f $in $out 2>/dev/null || (rm -rf $out && cp -af $in $out)') |
1192 master_ninja.newline() | 1192 master_ninja.newline() |
1193 | 1193 |
1194 all_targets = set() | 1194 all_targets = set() |
1195 for build_file in params['build_files']: | 1195 for build_file in params['build_files']: |
1196 for target in gyp.common.AllTargets(target_list, target_dicts, build_file): | 1196 for target in gyp.common.AllTargets(target_list, target_dicts, build_file): |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1244 | 1244 |
1245 user_config = params.get('generator_flags', {}).get('config', None) | 1245 user_config = params.get('generator_flags', {}).get('config', None) |
1246 if user_config: | 1246 if user_config: |
1247 GenerateOutputForConfig(target_list, target_dicts, data, params, | 1247 GenerateOutputForConfig(target_list, target_dicts, data, params, |
1248 user_config) | 1248 user_config) |
1249 else: | 1249 else: |
1250 config_names = target_dicts[target_list[0]]['configurations'].keys() | 1250 config_names = target_dicts[target_list[0]]['configurations'].keys() |
1251 for config_name in config_names: | 1251 for config_name in config_names: |
1252 GenerateOutputForConfig(target_list, target_dicts, data, params, | 1252 GenerateOutputForConfig(target_list, target_dicts, data, params, |
1253 config_name) | 1253 config_name) |
OLD | NEW |