summaryrefslogtreecommitdiff
path: root/ale_linters/kotlin
diff options
context:
space:
mode:
authorw0rp <devw0rp@gmail.com>2021-03-01 20:11:10 +0000
committerw0rp <devw0rp@gmail.com>2021-03-01 20:11:10 +0000
commit9fe7b1fe6a23fb55e6d782293585d58193123f59 (patch)
tree0403deb70011aee7be08e586b10b5828cf69499e /ale_linters/kotlin
parent48fab99a0ab793e1b9607795c21659f12bd6947f (diff)
downloadale-9fe7b1fe6a23fb55e6d782293585d58193123f59.zip
Close #2281 - Separate cwd commands from commands
Working directories are now set seperately from the commands so they can later be swapped out when running linters over projects is supported, and also better support filename mapping for running linters on other machines in future.
Diffstat (limited to 'ale_linters/kotlin')
-rw-r--r--ale_linters/kotlin/kotlinc.vim14
1 files changed, 5 insertions, 9 deletions
diff --git a/ale_linters/kotlin/kotlinc.vim b/ale_linters/kotlin/kotlinc.vim
index 66c075be..e8bc924d 100644
--- a/ale_linters/kotlin/kotlinc.vim
+++ b/ale_linters/kotlin/kotlinc.vim
@@ -15,20 +15,15 @@ function! ale_linters#kotlin#kotlinc#RunWithImportPaths(buffer) abort
let l:command = ''
" exec maven/gradle only if classpath is not set
- if ale#Var(a:buffer, 'kotlin_kotlinc_classpath') isnot# ''
+ if !empty(ale#Var(a:buffer, 'kotlin_kotlinc_classpath'))
return ale_linters#kotlin#kotlinc#GetCommand(a:buffer, [], {})
endif
- let l:pom_path = ale#path#FindNearestFile(a:buffer, 'pom.xml')
-
- if !empty(l:pom_path) && executable('mvn')
- let l:command = ale#path#CdString(fnamemodify(l:pom_path, ':h'))
- \ . 'mvn dependency:build-classpath'
- endif
+ let [l:cwd, l:command] = ale#maven#BuildClasspathCommand(a:buffer)
" Try to use Gradle if Maven isn't available.
if empty(l:command)
- let l:command = ale#gradle#BuildClasspathCommand(a:buffer)
+ let [l:cwd, l:command] = ale#gradle#BuildClasspathCommand(a:buffer)
endif
if empty(l:command)
@@ -38,7 +33,8 @@ function! ale_linters#kotlin#kotlinc#RunWithImportPaths(buffer) abort
return ale#command#Run(
\ a:buffer,
\ l:command,
- \ function('ale_linters#kotlin#kotlinc#GetCommand')
+ \ function('ale_linters#kotlin#kotlinc#GetCommand'),
+ \ {'cwd': l:cwd},
\)
endfunction