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

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

Issue 203383003: Support building selected C/C++ files in msvs-ninja (Closed) Base URL: http://gyp.googlecode.com/svn/trunk
Patch Set: use BASEDIR Created 6 years, 9 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/win_tool.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 collections 5 import collections
6 import copy 6 import copy
7 import ntpath 7 import ntpath
8 import os 8 import os
9 import posixpath 9 import posixpath
10 import re 10 import re
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
74 74
75 generator_additional_non_configuration_keys = [ 75 generator_additional_non_configuration_keys = [
76 'msvs_cygwin_dirs', 76 'msvs_cygwin_dirs',
77 'msvs_cygwin_shell', 77 'msvs_cygwin_shell',
78 'msvs_large_pdb', 78 'msvs_large_pdb',
79 'msvs_shard', 79 'msvs_shard',
80 'msvs_external_builder', 80 'msvs_external_builder',
81 'msvs_external_builder_out_dir', 81 'msvs_external_builder_out_dir',
82 'msvs_external_builder_build_cmd', 82 'msvs_external_builder_build_cmd',
83 'msvs_external_builder_clean_cmd', 83 'msvs_external_builder_clean_cmd',
84 'msvs_external_builder_clcompile_cmd',
84 ] 85 ]
85 86
86 87
87 # List of precompiled header related keys. 88 # List of precompiled header related keys.
88 precomp_keys = [ 89 precomp_keys = [
89 'msvs_precompiled_header', 90 'msvs_precompiled_header',
90 'msvs_precompiled_source', 91 'msvs_precompiled_source',
91 ] 92 ]
92 93
93 94
(...skipping 1761 matching lines...) Expand 10 before | Expand all | Expand 10 after
1855 ] 1856 ]
1856 if not spec.get('msvs_external_builder_clean_cmd'): 1857 if not spec.get('msvs_external_builder_clean_cmd'):
1857 spec['msvs_external_builder_clean_cmd'] = [ 1858 spec['msvs_external_builder_clean_cmd'] = [
1858 path_to_ninja, 1859 path_to_ninja,
1859 '-C', 1860 '-C',
1860 '$(OutDir)', 1861 '$(OutDir)',
1861 '-t', 1862 '-t',
1862 'clean', 1863 'clean',
1863 '$(ProjectName)', 1864 '$(ProjectName)',
1864 ] 1865 ]
1866 if not spec.get('msvs_external_builder_clcompile_cmd'):
1867 spec['msvs_external_builder_clcompile_cmd'] = [
1868 sys.executable,
1869 '$(OutDir)/gyp-win-tool',
1870 'cl-compile',
1871 '$(ProjectDir)',
1872 '$(SelectedFiles)',
1873 ]
1865 1874
1866 1875
1867 def CalculateVariables(default_variables, params): 1876 def CalculateVariables(default_variables, params):
1868 """Generated variables that require params to be known.""" 1877 """Generated variables that require params to be known."""
1869 1878
1870 generator_flags = params.get('generator_flags', {}) 1879 generator_flags = params.get('generator_flags', {})
1871 1880
1872 # Select project file format version (if unset, default to auto detecting). 1881 # Select project file format version (if unset, default to auto detecting).
1873 msvs_version = MSVSVersion.SelectVisualStudioVersion( 1882 msvs_version = MSVSVersion.SelectVisualStudioVersion(
1874 generator_flags.get('msvs_version', 'auto')) 1883 generator_flags.get('msvs_version', 'auto'))
(...skipping 1351 matching lines...) Expand 10 before | Expand all | Expand 10 after
3226 # has_run_as = _WriteMSVSUserFile(project.path, version, spec) 3235 # has_run_as = _WriteMSVSUserFile(project.path, version, spec)
3227 3236
3228 easy_xml.WriteXmlIfChanged(content, project.path, pretty=True, win32=True) 3237 easy_xml.WriteXmlIfChanged(content, project.path, pretty=True, win32=True)
3229 3238
3230 return missing_sources 3239 return missing_sources
3231 3240
3232 3241
3233 def _GetMSBuildExternalBuilderTargets(spec): 3242 def _GetMSBuildExternalBuilderTargets(spec):
3234 """Return a list of MSBuild targets for external builders. 3243 """Return a list of MSBuild targets for external builders.
3235 3244
3236 Right now, only "Build" and "Clean" targets are generated. 3245 The "Build" and "Clean" targets are always generated. If the spec contains
3246 'msvs_external_builder_clcompile_cmd', then the "ClCompile" target will also
3247 be generated, to support building selected C/C++ files.
3237 3248
3238 Arguments: 3249 Arguments:
3239 spec: The gyp target spec. 3250 spec: The gyp target spec.
3240 Returns: 3251 Returns:
3241 List of MSBuild 'Target' specs. 3252 List of MSBuild 'Target' specs.
3242 """ 3253 """
3243 build_cmd = _BuildCommandLineForRuleRaw( 3254 build_cmd = _BuildCommandLineForRuleRaw(
3244 spec, spec['msvs_external_builder_build_cmd'], 3255 spec, spec['msvs_external_builder_build_cmd'],
3245 False, False, False, False) 3256 False, False, False, False)
3246 build_target = ['Target', {'Name': 'Build'}] 3257 build_target = ['Target', {'Name': 'Build'}]
3247 build_target.append(['Exec', {'Command': build_cmd}]) 3258 build_target.append(['Exec', {'Command': build_cmd}])
3248 3259
3249 clean_cmd = _BuildCommandLineForRuleRaw( 3260 clean_cmd = _BuildCommandLineForRuleRaw(
3250 spec, spec['msvs_external_builder_clean_cmd'], 3261 spec, spec['msvs_external_builder_clean_cmd'],
3251 False, False, False, False) 3262 False, False, False, False)
3252 clean_target = ['Target', {'Name': 'Clean'}] 3263 clean_target = ['Target', {'Name': 'Clean'}]
3253 clean_target.append(['Exec', {'Command': clean_cmd}]) 3264 clean_target.append(['Exec', {'Command': clean_cmd}])
3254 3265
3255 return [build_target, clean_target] 3266 targets = [build_target, clean_target]
3267
3268 if spec.get('msvs_external_builder_clcompile_cmd'):
3269 clcompile_cmd = _BuildCommandLineForRuleRaw(
3270 spec, spec['msvs_external_builder_clcompile_cmd'],
3271 False, False, False, False)
3272 clcompile_target = ['Target', {'Name': 'ClCompile'}]
3273 clcompile_target.append(['Exec', {'Command': clcompile_cmd}])
3274 targets.append(clcompile_target)
3275
3276 return targets
3256 3277
3257 3278
3258 def _GetMSBuildExtensions(props_files_of_rules): 3279 def _GetMSBuildExtensions(props_files_of_rules):
3259 extensions = ['ImportGroup', {'Label': 'ExtensionSettings'}] 3280 extensions = ['ImportGroup', {'Label': 'ExtensionSettings'}]
3260 for props_file in props_files_of_rules: 3281 for props_file in props_files_of_rules:
3261 extensions.append(['Import', {'Project': props_file}]) 3282 extensions.append(['Import', {'Project': props_file}])
3262 return [extensions] 3283 return [extensions]
3263 3284
3264 3285
3265 def _GetMSBuildExtensionTargets(targets_files_of_rules): 3286 def _GetMSBuildExtensionTargets(targets_files_of_rules):
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
3333 action_spec.extend( 3354 action_spec.extend(
3334 # TODO(jeanluc) 'Document' for all or just if as_sources? 3355 # TODO(jeanluc) 'Document' for all or just if as_sources?
3335 [['FileType', 'Document'], 3356 [['FileType', 'Document'],
3336 ['Command', command], 3357 ['Command', command],
3337 ['Message', description], 3358 ['Message', description],
3338 ['Outputs', outputs] 3359 ['Outputs', outputs]
3339 ]) 3360 ])
3340 if additional_inputs: 3361 if additional_inputs:
3341 action_spec.append(['AdditionalInputs', additional_inputs]) 3362 action_spec.append(['AdditionalInputs', additional_inputs])
3342 actions_spec.append(action_spec) 3363 actions_spec.append(action_spec)
OLDNEW
« no previous file with comments | « no previous file | pylib/gyp/win_tool.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698