From 5aa6fae1182813de0dda6eb341f505e592280abc Mon Sep 17 00:00:00 2001 From: Haakon Sporsheim Date: Tue, 31 Jan 2017 16:02:28 +0100 Subject: [PATCH 1/3] Add support for waf build system. This patch also adds extra checking for bundled waf script. --- plugin/makeshift.vim | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/plugin/makeshift.vim b/plugin/makeshift.vim index a92bcc2..c5ba840 100644 --- a/plugin/makeshift.vim +++ b/plugin/makeshift.vim @@ -19,6 +19,7 @@ function! s:build_defaults() \'mix.exs': 'mix', \'pom.xml': 'mvn', \'build.ninja': 'ninja', + \'wscript': 'waf', \} endfunction @@ -87,6 +88,12 @@ function! s:makeshift() if len(l:program) == 0 let l:program = s:determine_build_system(expand('%:p:h')) endif + if l:program == 'waf' + let l:found = globpath(b:makeshift_root, l:program) + if filereadable(l:found) + let l:program = l:found + endif + endif call s:set_makeprg(l:program) call s:set_makedir(len(l:program) > 0) endfunction From 36da88d2d2ad386916ca545bd8123a8bf6d9720d Mon Sep 17 00:00:00 2001 From: Pete Johns Date: Wed, 1 Feb 2017 09:06:39 +0100 Subject: [PATCH 2/3] Add generic find_bundled support. This patch removes the specific find bundled waf functionality and rather adds generic support for finding bundled build program/script. Whether to find bundled make program is disabled by default, but can be enabled by adding `let g:makeshift_find_bundled = 1` to `vimrc`. --- plugin/makeshift.vim | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/plugin/makeshift.vim b/plugin/makeshift.vim index c5ba840..ca5a59e 100644 --- a/plugin/makeshift.vim +++ b/plugin/makeshift.vim @@ -58,9 +58,21 @@ function! s:determine_build_system(dir) return '' endfunction +function! s:find_bundled(program) + let l:bundled = globpath(b:makeshift_root, a:program) + if filereadable(l:bundled) + return l:bundled + endif + return a:program +endfunction + function! s:set_makeprg(program) if len(a:program) - let &l:makeprg=a:program + if exists('g:makeshift_find_bundled') && g:makeshift_find_bundled + let &l:makeprg = s:find_bundled(a:program) + else + let &l:makeprg = a:program + endif endif endfunction @@ -88,12 +100,6 @@ function! s:makeshift() if len(l:program) == 0 let l:program = s:determine_build_system(expand('%:p:h')) endif - if l:program == 'waf' - let l:found = globpath(b:makeshift_root, l:program) - if filereadable(l:found) - let l:program = l:found - endif - endif call s:set_makeprg(l:program) call s:set_makedir(len(l:program) > 0) endfunction From 72a95ea163e4fc54c71f8613f3f3ad8e4811d97c Mon Sep 17 00:00:00 2001 From: Haakon Sporsheim Date: Wed, 1 Feb 2017 09:22:22 +0100 Subject: [PATCH 3/3] Add documentation for g:makeshift_find_bundled. Also add WAF to the supported build systems list. See https://waf.io --- README.md | 5 +++++ doc/makeshift.txt | 14 +++++++++++--- 2 files changed, 16 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 630dcdc..a14051f 100644 --- a/README.md +++ b/README.md @@ -101,6 +101,10 @@ To try the build file in the current directory before searching from the file di let g:makeshift_use_pwd_first = 1 +To enable search for bundled build program/script: + + let g:makeshift_find_bundled = 1 + Build Systems ------------- @@ -116,6 +120,7 @@ Makeshift currently associates the following files with their build systems: * mix.exs: mix * pom.xml: mvn * build.ninja: ninja + * wscript: waf Adding a new build system ------------------------- diff --git a/doc/makeshift.txt b/doc/makeshift.txt index d8b754e..3f65473 100644 --- a/doc/makeshift.txt +++ b/doc/makeshift.txt @@ -95,10 +95,16 @@ To automatically change directory to 'b:makeshift_root' when it is discovered: *'makeshift_use_pwd_first'* To try the build file in the current directory before searching from the file -directory: -> +directory: > + let g:makeshift_use_pwd_first = 1 < + *'makeshift_find_bundled'* + +To enable search for bundled build program/script: > + + let g:makeshift_find_bundled = 1 + ============================================================================== BUILD SYSTEMS *makeshift-systems* @@ -113,6 +119,8 @@ Makeshift currently associates the following files with their build systems: * build.xml: ant * mix.exs: mix * pom.xml: mvn + * build.ninja: ninja + * wscript: waf ============================================================================== @@ -124,7 +132,7 @@ If Makeshift doesn't already know about your build system, or you wish to override the default program for a given file, you can define a dictionary, which has filenames as keys and corresponding programs as values. > let g:makeshift_systems = { - \'build.ninja ': 'ninja', + \'build.sbt ': 'sbt', \} <