Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Add support for waf build system. #16

Merged
merged 3 commits into from
Feb 1, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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',
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

\}
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