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

Unified Diff: pylib/gyp/generator/msvs.py

Issue 23464051: Avoid MSB8012 in GYP (Closed) Base URL: https://chromium.googlesource.com/external/gyp.git@master
Patch Set: Add test Created 7 years, 3 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | pylib/gyp/input.py » ('j') | test/target/hello.c » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pylib/gyp/generator/msvs.py
diff --git a/pylib/gyp/generator/msvs.py b/pylib/gyp/generator/msvs.py
index bc3b4c2fb4481a389ae38fe2148c46ab7d9daa72..30f15e6f809d8a238464496ae49e97d0c28e038a 100644
--- a/pylib/gyp/generator/msvs.py
+++ b/pylib/gyp/generator/msvs.py
@@ -1203,6 +1203,23 @@ def _GetOutputFilePathAndTool(spec, msbuild):
return out_file, vc_tool, msbuild_tool
+def _GetOutputTargetExt(spec):
+ """Returns the extension for this target.
+
+ If target_extension is specified, will prepend "." and return it,
+ otherwise None.
+
+ Arguments:
+ spec: The target dictionary containing the properties of the target.
+ Returns:
+ A string with the extension, or None
+ """
+ target_extension = spec.get('target_extension')
+ if target_extension:
+ return '.' + target_extension
+ return None
+
+
def _GetDefines(config):
"""Returns the list of preprocessor definitions for this configuation.
@@ -2652,6 +2669,9 @@ def _GetMSBuildAttributes(spec, config, build_file):
out_file = msbuild_settings[msbuild_tool].get('OutputFile')
if out_file:
msbuild_attributes['TargetPath'] = _FixPath(out_file)
+ target_ext = msbuild_settings[msbuild_tool].get('TargetExt')
+ if target_ext:
+ msbuild_attributes['TargetExt'] = target_ext
return msbuild_attributes
@@ -2687,6 +2707,9 @@ def _GetMSBuildConfigurationGlobalProperties(spec, configurations, build_file):
if attributes.get('TargetPath'):
_AddConditionalProperty(properties, condition, 'TargetPath',
attributes['TargetPath'])
+ if attributes.get('TargetExt'):
+ _AddConditionalProperty(properties, condition, 'TargetExt',
+ attributes['TargetExt'])
if new_paths:
_AddConditionalProperty(properties, condition, 'ExecutablePath',
@@ -2807,6 +2830,7 @@ def _FinalizeMSBuildSettings(spec, configuration):
libraries = _GetLibraries(spec)
library_dirs = _GetLibraryDirs(configuration)
out_file, _, msbuild_tool = _GetOutputFilePathAndTool(spec, msbuild=True)
+ target_ext = _GetOutputTargetExt(spec)
defines = _GetDefines(configuration)
if converted:
# Visual Studio 2010 has TR1
@@ -2844,6 +2868,9 @@ def _FinalizeMSBuildSettings(spec, configuration):
if out_file:
_ToolAppend(msbuild_settings, msbuild_tool, 'OutputFile', out_file,
only_if_unset=True)
+ if target_ext:
+ _ToolAppend(msbuild_settings, msbuild_tool, 'TargetExt', target_ext,
+ only_if_unset=True)
# Add defines.
_ToolAppend(msbuild_settings, 'ClCompile',
'PreprocessorDefinitions', defines)
« no previous file with comments | « no previous file | pylib/gyp/input.py » ('j') | test/target/hello.c » ('J')

Powered by Google App Engine
This is Rietveld 408576698