diff options
Diffstat (limited to 'misc')
-rw-r--r-- | misc/bash-completion | 5 | ||||
-rw-r--r-- | misc/ninja.vim | 6 | ||||
-rw-r--r-- | misc/ninja_syntax.py | 12 | ||||
-rwxr-xr-x | misc/ninja_syntax_test.py | 13 | ||||
-rw-r--r-- | misc/packaging/ninja.spec | 2 | ||||
-rw-r--r-- | misc/zsh-completion | 6 |
6 files changed, 30 insertions, 14 deletions
diff --git a/misc/bash-completion b/misc/bash-completion index 0536760..e604cd4 100644 --- a/misc/bash-completion +++ b/misc/bash-completion @@ -49,9 +49,8 @@ _ninja_target() { C) eval dir="$OPTARG" ;; esac done; - targets_command="eval ninja -C \"${dir}\" -t targets all" - targets=$(${targets_command} 2>/dev/null | awk -F: '{print $1}') - COMPREPLY=($(compgen -W "$targets" -- "$cur")) + targets_command="eval ninja -C \"${dir}\" -t targets all 2>/dev/null | cut -d: -f1" + COMPREPLY=($(compgen -W '`${targets_command}`' -- "$cur")) fi return } diff --git a/misc/ninja.vim b/misc/ninja.vim index f34588f..190d9ce 100644 --- a/misc/ninja.vim +++ b/misc/ninja.vim @@ -1,6 +1,6 @@ " ninja build file syntax. " Language: ninja build file as described at -" http://martine.github.com/ninja/manual.html +" http://ninja-build.org/manual.html " Version: 1.4 " Last Change: 2014/05/13 " Maintainer: Nicolas Weber <nicolasweber@gmx.de> @@ -9,8 +9,8 @@ " upstream. " ninja lexer and parser are at -" https://github.com/martine/ninja/blob/master/src/lexer.in.cc -" https://github.com/martine/ninja/blob/master/src/manifest_parser.cc +" https://github.com/ninja-build/ninja/blob/master/src/lexer.in.cc +" https://github.com/ninja-build/ninja/blob/master/src/manifest_parser.cc if exists("b:current_syntax") finish diff --git a/misc/ninja_syntax.py b/misc/ninja_syntax.py index 8673518..5c52ea2 100644 --- a/misc/ninja_syntax.py +++ b/misc/ninja_syntax.py @@ -21,8 +21,9 @@ class Writer(object): def newline(self): self.output.write('\n') - def comment(self, text): - for line in textwrap.wrap(text, self.width - 2): + def comment(self, text, has_path=False): + for line in textwrap.wrap(text, self.width - 2, break_long_words=False, + break_on_hyphens=False): self.output.write('# ' + line + '\n') def variable(self, key, value, indent=0): @@ -59,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)] @@ -72,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 36b2e7b..07e3ed3 100755 --- a/misc/ninja_syntax_test.py +++ b/misc/ninja_syntax_test.py @@ -45,6 +45,12 @@ class TestLineWordWrap(unittest.TestCase): INDENT + 'y']) + '\n', self.out.getvalue()) + def test_comment_wrap(self): + # Filenames shoud not be wrapped + self.n.comment('Hello /usr/local/build-tools/bin') + self.assertEqual('# Hello\n# /usr/local/build-tools/bin\n', + self.out.getvalue()) + def test_short_words_indented(self): # Test that indent is taking into acount when breaking subsequent lines. # The second line should not be ' to tree', as that's longer than the @@ -148,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'} diff --git a/misc/packaging/ninja.spec b/misc/packaging/ninja.spec index fa244a6..05f5a07 100644 --- a/misc/packaging/ninja.spec +++ b/misc/packaging/ninja.spec @@ -4,7 +4,7 @@ Version: %{ver} Release: %{rel}%{?dist} Group: Development/Tools License: Apache 2.0 -URL: https://github.com/martine/ninja +URL: https://github.com/ninja-build/ninja Source0: %{name}-%{version}-%{rel}.tar.gz BuildRoot: %{_tmppath}/%{name}-%{version}-%{rel} diff --git a/misc/zsh-completion b/misc/zsh-completion index fd9b3a7..446e269 100644 --- a/misc/zsh-completion +++ b/misc/zsh-completion @@ -22,9 +22,8 @@ __get_targets() { then eval dir="${opt_args[-C]}" fi - targets_command="ninja -C \"${dir}\" -t targets" - eval ${targets_command} 2>/dev/null | while read -r a b; do echo $a | cut -d ':' -f1; done; - + targets_command="ninja -C \"${dir}\" -t targets all" + eval ${targets_command} 2>/dev/null | cut -d: -f1 } __get_tools() { @@ -66,4 +65,3 @@ _arguments \ '-d+[Enable debugging (use -d list to list modes)]:modes:__modes' \ '-t+[Run a subtool (use -t list to list subtools)]:tools:__tools' \ '*::targets:__targets' - |