diff options
-rw-r--r-- | misc/ninja_syntax.py | 7 | ||||
-rwxr-xr-x | misc/ninja_syntax_test.py | 7 |
2 files changed, 13 insertions, 1 deletions
diff --git a/misc/ninja_syntax.py b/misc/ninja_syntax.py index 73d2209..5c52ea2 100644 --- a/misc/ninja_syntax.py +++ b/misc/ninja_syntax.py @@ -60,7 +60,7 @@ class Writer(object): self.variable('deps', deps, indent=1) def build(self, outputs, rule, inputs=None, implicit=None, order_only=None, - variables=None): + variables=None, implicit_outputs=None): outputs = as_list(outputs) out_outputs = [escape_path(x) for x in outputs] all_inputs = [escape_path(x) for x in as_list(inputs)] @@ -73,6 +73,11 @@ class Writer(object): order_only = [escape_path(x) for x in as_list(order_only)] all_inputs.append('||') all_inputs.extend(order_only) + if implicit_outputs: + implicit_outputs = [escape_path(x) + for x in as_list(implicit_outputs)] + out_outputs.append('|') + out_outputs.extend(implicit_outputs) self._line('build %s: %s' % (' '.join(out_outputs), ' '.join([rule] + all_inputs))) diff --git a/misc/ninja_syntax_test.py b/misc/ninja_syntax_test.py index c9755b8..07e3ed3 100755 --- a/misc/ninja_syntax_test.py +++ b/misc/ninja_syntax_test.py @@ -154,6 +154,13 @@ build out: cc in ''', self.out.getvalue()) + def test_implicit_outputs(self): + self.n.build('o', 'cc', 'i', implicit_outputs='io') + self.assertEqual('''\ +build o | io: cc i +''', + self.out.getvalue()) + class TestExpand(unittest.TestCase): def test_basic(self): vars = {'x': 'X'} |