| Index: pylib/gyp/generator/ninja.py
|
| diff --git a/pylib/gyp/generator/ninja.py b/pylib/gyp/generator/ninja.py
|
| index 8809edb88bfe6dd6bd123f6e75261904e9b8b34c..9860f66ddc07a99f603e6d0f4cf2f5f6ede940ee 100644
|
| --- a/pylib/gyp/generator/ninja.py
|
| +++ b/pylib/gyp/generator/ninja.py
|
| @@ -493,13 +493,13 @@ class NinjaWriter:
|
| description = self.GenerateDescription('ACTION',
|
| action.get('message', None),
|
| name)
|
| - is_cygwin = (self.msvs_settings.IsRuleRunUnderCygwin(action)
|
| - if self.flavor == 'win' else False)
|
| + win_shell_flags = (self.msvs_settings.GetRuleShellFlags(action)
|
| + if self.flavor == 'win' else None)
|
| args = action['action']
|
| args = [self.msvs_settings.ConvertVSMacros(arg, self.base_to_build)
|
| for arg in args] if self.flavor == 'win' else args
|
| rule_name = self.WriteNewNinjaRule(name, args, description,
|
| - is_cygwin, env=env)
|
| + win_shell_flags, env=env)
|
|
|
| inputs = [self.GypPathToNinja(i, env) for i in action['inputs']]
|
| if int(action.get('process_outputs_as_sources', False)):
|
| @@ -528,11 +528,12 @@ class NinjaWriter:
|
| 'RULE',
|
| rule.get('message', None),
|
| ('%s ' + generator_default_variables['RULE_INPUT_PATH']) % name)
|
| - is_cygwin = (self.msvs_settings.IsRuleRunUnderCygwin(rule)
|
| - if self.flavor == 'win' else False)
|
| + win_shell_flags = (self.msvs_settings.GetRuleShellFlags(rule)
|
| + if self.flavor == 'win' else None)
|
| args = [self.msvs_settings.ConvertVSMacros(arg, self.base_to_build)
|
| for arg in args] if self.flavor == 'win' else args
|
| - rule_name = self.WriteNewNinjaRule(name, args, description, is_cygwin)
|
| + rule_name = self.WriteNewNinjaRule(
|
| + name, args, description, win_shell_flags)
|
|
|
| # TODO: if the command references the outputs directly, we should
|
| # simplify it to just use $out.
|
| @@ -548,7 +549,7 @@ class NinjaWriter:
|
| needed_variables.add(var)
|
|
|
| def cygwin_munge(path):
|
| - if is_cygwin:
|
| + if win_shell_flags and win_shell_flags.cygwin:
|
| return path.replace('\\', '/')
|
| return path
|
|
|
| @@ -1063,7 +1064,7 @@ class NinjaWriter:
|
| values = []
|
| self.ninja.variable(var, ' '.join(values))
|
|
|
| - def WriteNewNinjaRule(self, name, args, description, is_cygwin, env={}):
|
| + def WriteNewNinjaRule(self, name, args, description, win_shell_flags, env={}):
|
| """Write out a new ninja "rule" statement for a given command.
|
|
|
| Returns the name of the new rule."""
|
| @@ -1087,7 +1088,7 @@ class NinjaWriter:
|
| # the arguments to point to the proper locations.
|
| if self.flavor == 'win':
|
| cd = 'cmd /s /c "'
|
| - if not is_cygwin:
|
| + if not win_shell_flags.cygwin:
|
| # cd command added by BuildCygwinBashCommandLine in cygwin case.
|
| cd += 'cd %s && ' % self.build_to_base
|
| else:
|
| @@ -1095,12 +1096,13 @@ class NinjaWriter:
|
| args = [self.ExpandSpecial(arg, self.base_to_build) for arg in args]
|
| env = self.ComputeExportEnvString(env) if self.flavor != 'win' else ''
|
| if self.flavor == 'win':
|
| - if is_cygwin:
|
| + if win_shell_flags.cygwin:
|
| command = self.msvs_settings.BuildCygwinBashCommandLine(
|
| args, self.build_to_base)
|
| else:
|
| # If there's no command, fake one to match the dangling |&&| above.
|
| - command = gyp.msvs_emulation.EncodeRspFileList(args) or 'cmd /c'
|
| + command = gyp.msvs_emulation.EncodeRspFileList(
|
| + args, win_shell_flags.quote) or 'cmd /c'
|
| command += '"' # Close quote opened in |cd|.
|
| else:
|
| command = gyp.common.EncodePOSIXShellList(args)
|
|
|