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

Side by Side Diff: pylib/gyp/generator/ninja.py

Issue 10269012: ninja windows: sanitize rule names to not emit corrupt .ninja files (Closed) Base URL: https://gyp.googlecode.com/svn/trunk
Patch Set: line endings Created 8 years, 7 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 | « no previous file | test/sanitize-rule-names/blah.X » ('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) 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.msvs_emulation 8 import gyp.msvs_emulation
9 import gyp.MSVSVersion 9 import gyp.MSVSVersion
10 import gyp.system_test 10 import gyp.system_test
11 import gyp.xcode_emulation 11 import gyp.xcode_emulation
12 import os.path 12 import os.path
13 import re 13 import re
14 import subprocess 14 import subprocess
15 import string
15 import sys 16 import sys
16 17
17 import gyp.ninja_syntax as ninja_syntax 18 import gyp.ninja_syntax as ninja_syntax
18 19
19 generator_default_variables = { 20 generator_default_variables = {
20 'EXECUTABLE_PREFIX': '', 21 'EXECUTABLE_PREFIX': '',
21 'EXECUTABLE_SUFFIX': '', 22 'EXECUTABLE_SUFFIX': '',
22 'STATIC_LIB_PREFIX': 'lib', 23 'STATIC_LIB_PREFIX': 'lib',
23 'STATIC_LIB_SUFFIX': '.a', 24 'STATIC_LIB_SUFFIX': '.a',
24 'SHARED_LIB_PREFIX': 'lib', 25 'SHARED_LIB_PREFIX': 'lib',
(...skipping 1037 matching lines...) Expand 10 before | Expand all | Expand 10 after
1062 1063
1063 Returns the name of the new rule.""" 1064 Returns the name of the new rule."""
1064 1065
1065 # TODO: we shouldn't need to qualify names; we do it because 1066 # TODO: we shouldn't need to qualify names; we do it because
1066 # currently the ninja rule namespace is global, but it really 1067 # currently the ninja rule namespace is global, but it really
1067 # should be scoped to the subninja. 1068 # should be scoped to the subninja.
1068 rule_name = self.name 1069 rule_name = self.name
1069 if self.toolset == 'target': 1070 if self.toolset == 'target':
1070 rule_name += '.' + self.toolset 1071 rule_name += '.' + self.toolset
1071 rule_name += '.' + name 1072 rule_name += '.' + name
1072 rule_name = rule_name.replace(' ', '_') 1073 rule_name = rule_name.translate(string.maketrans(' ()', '___'))
1073 1074
1074 args = args[:] 1075 args = args[:]
1075 1076
1076 # gyp dictates that commands are run from the base directory. 1077 # gyp dictates that commands are run from the base directory.
1077 # cd into the directory before running, and adjust paths in 1078 # cd into the directory before running, and adjust paths in
1078 # the arguments to point to the proper locations. 1079 # the arguments to point to the proper locations.
1079 if self.flavor == 'win': 1080 if self.flavor == 'win':
1080 cd = 'cmd /s /c "' 1081 cd = 'cmd /s /c "'
1081 if not is_cygwin: 1082 if not is_cygwin:
1082 # cd command added by BuildCygwinBashCommandLine in cygwin case. 1083 # cd command added by BuildCygwinBashCommandLine in cygwin case.
(...skipping 393 matching lines...) Expand 10 before | Expand all | Expand 10 after
1476 1477
1477 user_config = params.get('generator_flags', {}).get('config', None) 1478 user_config = params.get('generator_flags', {}).get('config', None)
1478 if user_config: 1479 if user_config:
1479 GenerateOutputForConfig(target_list, target_dicts, data, params, 1480 GenerateOutputForConfig(target_list, target_dicts, data, params,
1480 user_config) 1481 user_config)
1481 else: 1482 else:
1482 config_names = target_dicts[target_list[0]]['configurations'].keys() 1483 config_names = target_dicts[target_list[0]]['configurations'].keys()
1483 for config_name in config_names: 1484 for config_name in config_names:
1484 GenerateOutputForConfig(target_list, target_dicts, data, params, 1485 GenerateOutputForConfig(target_list, target_dicts, data, params,
1485 config_name) 1486 config_name)
OLDNEW
« no previous file with comments | « no previous file | test/sanitize-rule-names/blah.X » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698