summaryrefslogtreecommitdiff
path: root/autoload
diff options
context:
space:
mode:
authorw0rp <devw0rp@gmail.com>2017-10-23 01:26:31 +0100
committerw0rp <devw0rp@gmail.com>2017-10-23 01:26:31 +0100
commit231398dddc59b01bc83f5a333af1ae741d31ed51 (patch)
tree1e5dab4cca104a01d11c7428e3c802296cb3bf31 /autoload
parentc4579e1809d2ca40f917a4ccd665693ba0a33dcb (diff)
downloadale-231398dddc59b01bc83f5a333af1ae741d31ed51.zip
Get more of the tests to pass on Windows
Diffstat (limited to 'autoload')
-rw-r--r--autoload/ale/gradle.vim15
1 files changed, 14 insertions, 1 deletions
diff --git a/autoload/ale/gradle.vim b/autoload/ale/gradle.vim
index 89b56a82..dc377fb9 100644
--- a/autoload/ale/gradle.vim
+++ b/autoload/ale/gradle.vim
@@ -2,20 +2,30 @@
" Description: Functions for working with Gradle projects.
let s:script_path = fnamemodify(resolve(expand('<sfile>:p')), ':h')
+let s:init_path = has('win32')
+\ ? s:script_path . '\gradle\init.gradle'
+\ : s:script_path . '/gradle/init.gradle'
+
+function! ale#gradle#GetInitPath() abort
+ return s:init_path
+endfunction
" Given a buffer number, find a Gradle project root.
function! ale#gradle#FindProjectRoot(buffer) abort
let l:gradlew_path = ale#path#FindNearestFile(a:buffer, 'gradlew')
+
if !empty(l:gradlew_path)
return fnamemodify(l:gradlew_path, ':h')
endif
let l:settings_path = ale#path#FindNearestFile(a:buffer, 'settings.gradle')
+
if !empty(l:settings_path)
return fnamemodify(l:settings_path, ':h')
endif
let l:build_path = ale#path#FindNearestFile(a:buffer, 'build.gradle')
+
if !empty(l:build_path)
return fnamemodify(l:build_path, ':h')
endif
@@ -28,6 +38,7 @@ endfunction
" command. Returns an empty string if cannot find the executable.
function! ale#gradle#FindExecutable(buffer) abort
let l:gradlew_path = ale#path#FindNearestFile(a:buffer, 'gradlew')
+
if !empty(l:gradlew_path)
return l:gradlew_path
endif
@@ -47,7 +58,9 @@ function! ale#gradle#BuildClasspathCommand(buffer) abort
if !empty(l:executable) && !empty(l:project_root)
return ale#path#CdString(l:project_root)
- \ . l:executable . ' -I ' . s:script_path . '/gradle/init.gradle -q printClasspath'
+ \ . ale#Escape(l:executable)
+ \ . ' -I ' . ale#Escape(s:init_path)
+ \ . ' -q printClasspath'
endif
return ''