| Index: pylib/gyp/generator/msvs.py
|
| diff --git a/pylib/gyp/generator/msvs.py b/pylib/gyp/generator/msvs.py
|
| index c61142ea9748f9e6975d8cfb8ee3898be5c3983b..72896adede97fa3f927251cabfd3a187d5abdfa3 100644
|
| --- a/pylib/gyp/generator/msvs.py
|
| +++ b/pylib/gyp/generator/msvs.py
|
| @@ -880,6 +880,8 @@ def _GenerateMSVSProject(project, options, version, generator_flags):
|
| project_dir = os.path.split(project.path)[0]
|
| gyp_path = _NormalizedSource(project.build_file)
|
| relative_path_of_gyp_file = gyp.common.RelativePath(gyp_path, project_dir)
|
| + relative_path_of_vcproj_file = \
|
| + gyp.common.RelativePath(project.path, project_dir)
|
|
|
| config_type = _GetMSVSConfigurationType(spec, project.build_file)
|
| for config_name, config in spec['configurations'].iteritems():
|
| @@ -905,7 +907,8 @@ def _GenerateMSVSProject(project, options, version, generator_flags):
|
|
|
| _AddToolFilesToMSVS(p, spec)
|
| _HandlePreCompiledHeaders(p, sources, spec)
|
| - _AddActions(actions_to_add, spec, relative_path_of_gyp_file)
|
| + _AddActions(actions_to_add, spec, relative_path_of_gyp_file,
|
| + relative_path_of_vcproj_file)
|
| _AddCopies(actions_to_add, spec)
|
| _WriteMSVSUserFile(project.path, version, spec)
|
|
|
| @@ -1441,13 +1444,23 @@ def _HandlePreCompiledHeaders(p, sources, spec):
|
| DisableForSourceTree(sources)
|
|
|
|
|
| -def _AddActions(actions_to_add, spec, relative_path_of_gyp_file):
|
| +def _AddActions(actions_to_add, spec, relative_path_of_gyp_file,
|
| + relative_path_of_vcproj_file):
|
| # Add actions.
|
| actions = spec.get('actions', [])
|
| for a in actions:
|
| cmd = _BuildCommandLineForRule(spec, a, has_input_path=False)
|
| # Attach actions to the gyp file if nothing else is there.
|
| inputs = a.get('inputs') or [relative_path_of_gyp_file]
|
| + if relative_path_of_vcproj_file:
|
| + # Additionally, on MSVS 2008, we mark the project file as a
|
| + # dependency of the action so that when the action's command
|
| + # changes, the action will get re-run even if no other input
|
| + # files change. However, this will re-run unchanged actions
|
| + # unnecessarily when the project file changes. This is not
|
| + # necessary on MSVS 2010 which handles command changes for us.
|
| + # TODO(mseaborn): Detect changes at a finer granularity.
|
| + inputs = inputs + [relative_path_of_vcproj_file]
|
| # Add the action.
|
| _AddActionStep(actions_to_add,
|
| inputs=inputs,
|
| @@ -2892,9 +2905,6 @@ def _GenerateMSBuildProject(project, options, version, generator_flags):
|
| if msbuildproj_dir and not os.path.exists(msbuildproj_dir):
|
| os.makedirs(msbuildproj_dir)
|
| # Prepare list of sources and excluded sources.
|
| - gyp_path = _NormalizedSource(project.build_file)
|
| - relative_path_of_gyp_file = gyp.common.RelativePath(gyp_path, project_dir)
|
| -
|
| gyp_file = os.path.split(project.build_file)[1]
|
| sources, excluded_sources = _PrepareListOfSources(spec, gyp_file)
|
| # Add rules.
|
| @@ -2912,7 +2922,7 @@ def _GenerateMSBuildProject(project, options, version, generator_flags):
|
| project_dir, sources,
|
| excluded_sources,
|
| list_excluded))
|
| - _AddActions(actions_to_add, spec, project.build_file)
|
| + _AddActions(actions_to_add, spec, project.build_file, None)
|
| _AddCopies(actions_to_add, spec)
|
|
|
| # NOTE: this stanza must appear after all actions have been decided.
|
|
|