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

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

Issue 9406030: More slash fixes for Windows ninja, and some work on actions. (Closed) Base URL: http://gyp.googlecode.com/svn/trunk/
Patch Set: Created 8 years, 10 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 | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pylib/gyp/generator/ninja.py
===================================================================
--- pylib/gyp/generator/ninja.py (revision 1202)
+++ pylib/gyp/generator/ninja.py (working copy)
@@ -77,7 +77,7 @@
# Only need to handle relative paths into subdirectories for now.
assert '..' not in path, path
depth = len(path.split(os.path.sep))
- return '/'.join(['..'] * depth)
+ return os.path.sep.join(['..'] * depth)
class Target:
@@ -201,6 +201,7 @@
path = path.replace(PRODUCT_DIR, product_dir)
else:
path = path.replace(PRODUCT_DIR + '/', '')
+ path = path.replace(PRODUCT_DIR + '\\', '')
path = path.replace(PRODUCT_DIR, '.')
INTERMEDIATE_DIR = '$!INTERMEDIATE_DIR'
@@ -911,7 +912,7 @@
elif type == 'shared_library':
libdir = 'lib'
if self.toolset != 'target':
- libdir = 'lib/%s' % self.toolset
+ libdir = os.path.join('lib', '%s' % self.toolset)
return os.path.join(libdir, filename)
else:
return self.GypPathToUniqueOutput(filename, qualified=False)
@@ -940,10 +941,19 @@
# gyp dictates that commands are run from the base directory.
# cd into the directory before running, and adjust paths in
# the arguments to point to the proper locations.
- cd = 'cd %s; ' % self.build_to_base
+ if self.flavor == 'win':
+ cd = 'cmd /s /c "cd %s && ' % self.build_to_base
+ else:
+ cd = 'cd %s; ' % self.build_to_base
args = [self.ExpandSpecial(arg, self.base_to_build) for arg in args]
env = self.ComputeExportEnvString(env)
- command = gyp.common.EncodePOSIXShellList(args)
+ if self.flavor == 'win':
+ # TODO(scottmg): Really don't want encourage cygwin, but I'm not sure
+ # how much sh is depended upon. For now, double quote args to make most
+ # things work.
Evan Martin 2012/02/16 16:10:33 I think there's a gyp attribute related to whether
+ command = args[0] + ' "' + '" "'.join(args[1:]) + '""'
+ else:
+ command = gyp.common.EncodePOSIXShellList(args)
if env:
# If an environment is passed in, variables in the command should be
# read from it, instead of from ninja's internal variables.
@@ -995,7 +1005,8 @@
operating_system = 'linux' # Keep this legacy behavior for now.
default_variables.setdefault('OS', operating_system)
default_variables.setdefault('SHARED_LIB_SUFFIX', '.so')
- default_variables.setdefault('SHARED_LIB_DIR', '$!PRODUCT_DIR/lib')
+ default_variables.setdefault('SHARED_LIB_DIR',
+ os.path.join('$!PRODUCT_DIR', 'lib'))
default_variables.setdefault('LIB_DIR', '')
@@ -1110,7 +1121,7 @@
master_ninja.rule(
'alink',
description='AR $out',
- command='lib /nologo /OUT:$out.lib $in')
+ command='lib /nologo /OUT:$out $in')
master_ninja.rule(
'solink',
description='SOLINK $out',
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698