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

Side by Side Diff: pylib/gyp/ninja_syntax.py

Issue 9460049: Next level of changes to get more of Chrome building (Closed) Base URL: https://gyp.googlecode.com/svn/trunk
Patch Set: wip Created 8 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 | « pylib/gyp/msvs_emulation.py ('k') | 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 # This file comes from 1 # This file comes from
2 # https://github.com/martine/ninja/blob/master/misc/ninja_syntax.py 2 # https://github.com/martine/ninja/blob/master/misc/ninja_syntax.py
3 # Do not edit! Edit the upstream one instead. 3 # Do not edit! Edit the upstream one instead.
4 4
5 """Python module for generating .ninja files. 5 """Python module for generating .ninja files.
6 6
7 Note that this is emphatically not a required piece of Ninja; it's 7 Note that this is emphatically not a required piece of Ninja; it's
8 just a helpful utility for build-file-generation systems that already 8 just a helpful utility for build-file-generation systems that already
9 use Python. 9 use Python.
10 """ 10 """
(...skipping 17 matching lines...) Expand all
28 self.output.write('# ' + line + '\n') 28 self.output.write('# ' + line + '\n')
29 29
30 def variable(self, key, value, indent=0): 30 def variable(self, key, value, indent=0):
31 if value is None: 31 if value is None:
32 return 32 return
33 if isinstance(value, list): 33 if isinstance(value, list):
34 value = ' '.join(filter(None, value)) # Filter out empty strings. 34 value = ' '.join(filter(None, value)) # Filter out empty strings.
35 self._line('%s = %s' % (key, value), indent) 35 self._line('%s = %s' % (key, value), indent)
36 36
37 def rule(self, name, command, description=None, depfile=None, 37 def rule(self, name, command, description=None, depfile=None,
38 generator=False, restat=False, deplist=None): 38 generator=False, restat=False, deplist=None, rspfile=None,
39 rspfile_content=None, depdb=None):
39 self._line('rule %s' % name) 40 self._line('rule %s' % name)
40 self.variable('command', command, indent=1) 41 self.variable('command', command, indent=1)
41 if description: 42 if description:
42 self.variable('description', description, indent=1) 43 self.variable('description', description, indent=1)
43 if depfile: 44 if depfile:
44 self.variable('depfile', depfile, indent=1) 45 self.variable('depfile', depfile, indent=1)
45 if deplist: 46 if deplist:
46 self.variable('deplist', deplist, indent=1) 47 self.variable('deplist', deplist, indent=1)
48 if depdb:
49 self.variable('depdb', depdb, indent=1)
47 if generator: 50 if generator:
48 self.variable('generator', '1', indent=1) 51 self.variable('generator', '1', indent=1)
49 if restat: 52 if restat:
50 self.variable('restat', '1', indent=1) 53 self.variable('restat', '1', indent=1)
54 if rspfile:
55 self.variable('rspfile', rspfile, indent=1)
56 if rspfile_content:
57 self.variable('rspfile_content', rspfile_content, indent=1)
51 58
52 def build(self, outputs, rule, inputs=None, implicit=None, order_only=None, 59 def build(self, outputs, rule, inputs=None, implicit=None, order_only=None,
53 variables=None): 60 variables=None):
54 outputs = self._as_list(outputs) 61 outputs = self._as_list(outputs)
55 all_inputs = self._as_list(inputs)[:] 62 all_inputs = self._as_list(inputs)[:]
56 out_outputs = map(escape_spaces, outputs) 63 out_outputs = map(escape_spaces, outputs)
57 all_inputs = map(escape_spaces, all_inputs) 64 all_inputs = map(escape_spaces, all_inputs)
58 65
59 if implicit: 66 if implicit:
60 implicit = map(escape_spaces, self._as_list(implicit)) 67 implicit = map(escape_spaces, self._as_list(implicit))
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
136 return input 143 return input
137 return [input] 144 return [input]
138 145
139 146
140 def escape(string): 147 def escape(string):
141 """Escape a string such that it can be embedded into a Ninja file without 148 """Escape a string such that it can be embedded into a Ninja file without
142 further interpretation.""" 149 further interpretation."""
143 assert '\n' not in string, 'Ninja syntax does not allow newlines' 150 assert '\n' not in string, 'Ninja syntax does not allow newlines'
144 # We only have one special metacharacter: '$'. 151 # We only have one special metacharacter: '$'.
145 return string.replace('$', '$$') 152 return string.replace('$', '$$')
OLDNEW
« no previous file with comments | « pylib/gyp/msvs_emulation.py ('k') | pylib/gyp/win_tool.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698