Skip to content

Commit

Permalink
Merge pull request #16 from ieei/waf
Browse files Browse the repository at this point in the history
Add support for [waf](https://github.com/waf-project/waf) build system and bundled build programs. Thanks @ieei.
  • Loading branch information
johnsyweb committed Feb 1, 2017
2 parents 5013501 + 72a95ea commit e2ab206
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 4 deletions.
5 changes: 5 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
-------------

Expand All @@ -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
-------------------------
Expand Down
14 changes: 11 additions & 3 deletions doc/makeshift.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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*
Expand All @@ -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

==============================================================================

Expand All @@ -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',
\}
<

Expand Down
15 changes: 14 additions & 1 deletion plugin/makeshift.vim
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ function! s:build_defaults()
\'mix.exs': 'mix',
\'pom.xml': 'mvn',
\'build.ninja': 'ninja',
\'wscript': 'waf',
\}
endfunction

Expand Down Expand Up @@ -57,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

Expand Down

0 comments on commit e2ab206

Please # to comment.