]> git.madduck.net Git - etc/vim.git/blob - autoload/ale/ant.vim

madduck's git repository

Every one of the projects in this repository is available at the canonical URL git://git.madduck.net/madduck/pub/<projectpath> — see each project's metadata for the exact URL.

All patches and comments are welcome. Please squash your changes to logical commits before using git-format-patch and git-send-email to patches@git.madduck.net. If you'd read over the Git project's submission guidelines and adhered to them, I'd be especially grateful.

SSH access, as well as push access can be individually arranged.

If you use my repositories frequently, consider adding the following snippet to ~/.gitconfig and using the third clone URL listed for each project:

[url "git://git.madduck.net/madduck/"]
  insteadOf = madduck:

Squashed '.vim/bundle/ale/' content from commit 22185c4c
[etc/vim.git] / autoload / ale / ant.vim
1 " Author: Andrew Lee <andrew.lambda@tuta.io>.
2 " Inspired by ale/gradle.vim by Michael Pardo <michael@michaelpardo.com>
3 " Description: Functions for working with Ant projects.
4
5 " Given a buffer number, find an Ant project root
6 function! ale#ant#FindProjectRoot(buffer) abort
7     let l:build_xml_path = ale#path#FindNearestFile(a:buffer, 'build.xml')
8
9     if !empty(l:build_xml_path)
10         return fnamemodify(l:build_xml_path, ':h')
11     endif
12
13     return ''
14 endfunction
15
16 " Given a buffer number, find the path to the `ant` executable. Returns an empty
17 " string if cannot find the executable.
18 function! ale#ant#FindExecutable(buffer) abort
19     if executable('ant')
20         return 'ant'
21     endif
22
23     return ''
24 endfunction
25
26 " Given a buffer number, get a working directory and command to print the
27 " classpath of the root project.
28 "
29 " Returns an empty string for the command if Ant is not detected.
30 function! ale#ant#BuildClasspathCommand(buffer) abort
31     let l:executable = ale#ant#FindExecutable(a:buffer)
32
33     if !empty(l:executable)
34         let l:project_root = ale#ant#FindProjectRoot(a:buffer)
35
36         if !empty(l:project_root)
37             return [
38             \   l:project_root,
39             \   ale#Escape(l:executable) .' classpath -S -q'
40             \]
41         endif
42     endif
43
44     return ['', '']
45 endfunction