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

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

Issue 10228016: ninja windows: fix expansion of some VS macros (Closed) Base URL: https://gyp.googlecode.com/svn/trunk
Patch Set: refactor test to not include case normalization 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 | pylib/gyp/msvs_emulation.py » ('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
(...skipping 466 matching lines...) Expand 10 before | Expand all | Expand 10 after
477 if message: 477 if message:
478 return '%s %s' % (verb, self.ExpandSpecial(message)) 478 return '%s %s' % (verb, self.ExpandSpecial(message))
479 else: 479 else:
480 return '%s %s: %s' % (verb, self.name, fallback) 480 return '%s %s: %s' % (verb, self.name, fallback)
481 481
482 def WriteActions(self, actions, extra_sources, prebuild, 482 def WriteActions(self, actions, extra_sources, prebuild,
483 extra_mac_bundle_resources): 483 extra_mac_bundle_resources):
484 # Actions cd into the base directory. 484 # Actions cd into the base directory.
485 env = self.GetXcodeEnv() 485 env = self.GetXcodeEnv()
486 if self.flavor == 'win': 486 if self.flavor == 'win':
487 env = self.msvs_settings.GetVSMacroEnv(self.base_to_build) 487 env = self.msvs_settings.GetVSMacroEnv('$!PRODUCT_DIR')
488 all_outputs = [] 488 all_outputs = []
489 for action in actions: 489 for action in actions:
490 # First write out a rule for the action. 490 # First write out a rule for the action.
491 name = re.sub(r'[ {}$]', '_', action['action_name']) 491 name = re.sub(r'[ {}$]', '_', action['action_name'])
492 description = self.GenerateDescription('ACTION', 492 description = self.GenerateDescription('ACTION',
493 action.get('message', None), 493 action.get('message', None),
494 name) 494 name)
495 is_cygwin = (self.msvs_settings.IsRuleRunUnderCygwin(action) 495 is_cygwin = (self.msvs_settings.IsRuleRunUnderCygwin(action)
496 if self.flavor == 'win' else False) 496 if self.flavor == 'win' else False)
497 rule_name = self.WriteNewNinjaRule(name, action['action'], description, 497 rule_name = self.WriteNewNinjaRule(name, action['action'], description,
(...skipping 309 matching lines...) Expand 10 before | Expand all | Expand 10 after
807 if self.flavor == 'mac': 807 if self.flavor == 'mac':
808 ldflags = self.xcode_settings.GetLdflags(config_name, 808 ldflags = self.xcode_settings.GetLdflags(config_name,
809 self.ExpandSpecial(generator_default_variables['PRODUCT_DIR']), 809 self.ExpandSpecial(generator_default_variables['PRODUCT_DIR']),
810 self.GypPathToNinja) 810 self.GypPathToNinja)
811 elif self.flavor == 'win': 811 elif self.flavor == 'win':
812 libflags = self.msvs_settings.GetLibFlags(config_name, 812 libflags = self.msvs_settings.GetLibFlags(config_name,
813 self.GypPathToNinja) 813 self.GypPathToNinja)
814 self.WriteVariableList( 814 self.WriteVariableList(
815 'libflags', gyp.common.uniquer(map(self.ExpandSpecial, libflags))) 815 'libflags', gyp.common.uniquer(map(self.ExpandSpecial, libflags)))
816 ldflags = self.msvs_settings.GetLdflags(config_name, 816 ldflags = self.msvs_settings.GetLdflags(config_name,
817 self.ExpandSpecial(generator_default_variables['PRODUCT_DIR']), 817 self.GypPathToNinja, self.ExpandSpecial)
818 self.GypPathToNinja)
819 else: 818 else:
820 ldflags = config.get('ldflags', []) 819 ldflags = config.get('ldflags', [])
821 self.WriteVariableList('ldflags', 820 self.WriteVariableList('ldflags',
822 gyp.common.uniquer(map(self.ExpandSpecial, 821 gyp.common.uniquer(map(self.ExpandSpecial,
823 ldflags))) 822 ldflags)))
824 823
825 libraries = gyp.common.uniquer(map(self.ExpandSpecial, 824 libraries = gyp.common.uniquer(map(self.ExpandSpecial,
826 spec.get('libraries', []))) 825 spec.get('libraries', [])))
827 if self.flavor == 'mac': 826 if self.flavor == 'mac':
828 libraries = self.xcode_settings.AdjustLibraries(libraries) 827 libraries = self.xcode_settings.AdjustLibraries(libraries)
(...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after
1008 raise 'Unhandled output type', type 1007 raise 'Unhandled output type', type
1009 1008
1010 def ComputeOutput(self, spec, type=None): 1009 def ComputeOutput(self, spec, type=None):
1011 """Compute the path for the final output of the spec.""" 1010 """Compute the path for the final output of the spec."""
1012 assert not self.is_mac_bundle or type 1011 assert not self.is_mac_bundle or type
1013 1012
1014 if not type: 1013 if not type:
1015 type = spec['type'] 1014 type = spec['type']
1016 1015
1017 if self.flavor == 'win': 1016 if self.flavor == 'win':
1018 overridden_name = self.msvs_settings.GetOutputName(spec, self.config_name) 1017 override = self.msvs_settings.GetOutputName(self.config_name,
1019 if overridden_name: 1018 self.ExpandSpecial)
1020 return self.ExpandSpecial(overridden_name, self.base_to_build) 1019 if override:
1020 return override
1021 1021
1022 if self.flavor == 'mac' and type in ( 1022 if self.flavor == 'mac' and type in (
1023 'static_library', 'executable', 'shared_library', 'loadable_module'): 1023 'static_library', 'executable', 'shared_library', 'loadable_module'):
1024 filename = self.xcode_settings.GetExecutablePath() 1024 filename = self.xcode_settings.GetExecutablePath()
1025 else: 1025 else:
1026 filename = self.ComputeOutputFileName(spec, type) 1026 filename = self.ComputeOutputFileName(spec, type)
1027 1027
1028 if 'product_dir' in spec: 1028 if 'product_dir' in spec:
1029 path = os.path.join(spec['product_dir'], filename) 1029 path = os.path.join(spec['product_dir'], filename)
1030 return self.ExpandSpecial(path) 1030 return self.ExpandSpecial(path)
(...skipping 240 matching lines...) Expand 10 before | Expand all | Expand 10 after
1271 depfile='$out.d') 1271 depfile='$out.d')
1272 else: 1272 else:
1273 # TODO(scottmg): Requires fork of ninja for dependency and linking 1273 # TODO(scottmg): Requires fork of ninja for dependency and linking
1274 # support: https://github.com/sgraham/ninja 1274 # support: https://github.com/sgraham/ninja
1275 master_ninja.rule( 1275 master_ninja.rule(
1276 'cc', 1276 'cc',
1277 description='CC $out', 1277 description='CC $out',
1278 command=('cmd /s /c "$cc /nologo /showIncludes ' 1278 command=('cmd /s /c "$cc /nologo /showIncludes '
1279 '@$out.rsp ' 1279 '@$out.rsp '
1280 '$cflags_pch_c /c $in /Fo$out /Fd$pdbname ' 1280 '$cflags_pch_c /c $in /Fo$out /Fd$pdbname '
1281 '| ninja-deplist-helper -q -f cl -o $out.dl"'), 1281 '| ninja-deplist-helper -r . -q -f cl -o $out.dl"'),
1282 deplist='$out.dl', 1282 deplist='$out.dl',
1283 rspfile='$out.rsp', 1283 rspfile='$out.rsp',
1284 rspfile_content='$defines $includes $cflags $cflags_c') 1284 rspfile_content='$defines $includes $cflags $cflags_c')
1285 master_ninja.rule( 1285 master_ninja.rule(
1286 'cxx', 1286 'cxx',
1287 description='CXX $out', 1287 description='CXX $out',
1288 command=('cmd /s /c "$cxx /nologo /showIncludes ' 1288 command=('cmd /s /c "$cxx /nologo /showIncludes '
1289 '@$out.rsp ' 1289 '@$out.rsp '
1290 '$cflags_pch_cc /c $in /Fo$out /Fd$pdbname ' 1290 '$cflags_pch_cc /c $in /Fo$out /Fd$pdbname '
1291 '| ninja-deplist-helper -q -f cl -o $out.dl"'), 1291 '| ninja-deplist-helper -r . -q -f cl -o $out.dl"'),
1292 deplist='$out.dl', 1292 deplist='$out.dl',
1293 rspfile='$out.rsp', 1293 rspfile='$out.rsp',
1294 rspfile_content='$defines $includes $cflags $cflags_cc') 1294 rspfile_content='$defines $includes $cflags $cflags_cc')
1295 master_ninja.rule( 1295 master_ninja.rule(
1296 'idl', 1296 'idl',
1297 description='IDL $in', 1297 description='IDL $in',
1298 command=('python gyp-win-tool midl-wrapper $outdir ' 1298 command=('python gyp-win-tool midl-wrapper $outdir '
1299 '$tlb $h $dlldata $iid $proxy $in ' 1299 '$tlb $h $dlldata $iid $proxy $in '
1300 '$idlflags')) 1300 '$idlflags'))
1301 master_ninja.rule( 1301 master_ninja.rule(
(...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after
1472 1472
1473 user_config = params.get('generator_flags', {}).get('config', None) 1473 user_config = params.get('generator_flags', {}).get('config', None)
1474 if user_config: 1474 if user_config:
1475 GenerateOutputForConfig(target_list, target_dicts, data, params, 1475 GenerateOutputForConfig(target_list, target_dicts, data, params,
1476 user_config) 1476 user_config)
1477 else: 1477 else:
1478 config_names = target_dicts[target_list[0]]['configurations'].keys() 1478 config_names = target_dicts[target_list[0]]['configurations'].keys()
1479 for config_name in config_names: 1479 for config_name in config_names:
1480 GenerateOutputForConfig(target_list, target_dicts, data, params, 1480 GenerateOutputForConfig(target_list, target_dicts, data, params,
1481 config_name) 1481 config_name)
OLDNEW
« no previous file with comments | « no previous file | pylib/gyp/msvs_emulation.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698