From 10788ac8d78bec29f6662a1b40a75e2b94eaaa31 Mon Sep 17 00:00:00 2001 From: LCD 47 Date: Thu, 26 Nov 2015 11:37:44 +0200 Subject: [PATCH] Javac checker: cleanup. --- plugin/syntastic.vim | 2 +- syntax_checkers/java/javac.vim | 43 ++++++++-------------------------- 2 files changed, 11 insertions(+), 34 deletions(-) diff --git a/plugin/syntastic.vim b/plugin/syntastic.vim index 4a7aa4ae..4529af52 100644 --- a/plugin/syntastic.vim +++ b/plugin/syntastic.vim @@ -19,7 +19,7 @@ if has('reltime') lockvar! g:_SYNTASTIC_START endif -let g:_SYNTASTIC_VERSION = '3.7.0-34' +let g:_SYNTASTIC_VERSION = '3.7.0-37' lockvar g:_SYNTASTIC_VERSION " Sanity checks {{{1 diff --git a/syntax_checkers/java/javac.vim b/syntax_checkers/java/javac.vim index 74804e3d..415691cd 100644 --- a/syntax_checkers/java/javac.vim +++ b/syntax_checkers/java/javac.vim @@ -377,16 +377,10 @@ function! s:GetMavenClasspath() " {{{2 let mvn_properties = s:GetMavenProperties() let sep = syntastic#util#Slash() - let output_dir = join(['target', 'classes'], sep) - if has_key(mvn_properties, 'project.build.outputDirectory') - let output_dir = mvn_properties['project.build.outputDirectory'] - endif + let output_dir = get(mvn_properties, 'project.build.outputDirectory', join(['target', 'classes'], sep)) let mvn_classpath = s:AddToClasspath(mvn_classpath, output_dir) - let test_output_dir = join(['target', 'test-classes'], sep) - if has_key(mvn_properties, 'project.build.testOutputDirectory') - let test_output_dir = mvn_properties['project.build.testOutputDirectory'] - endif + let test_output_dir = get(mvn_properties, 'project.build.testOutputDirectory', join(['target', 'test-classes'], sep)) let mvn_classpath = s:AddToClasspath(mvn_classpath, test_output_dir) let g:syntastic_java_javac_maven_pom_ftime[pom] = getftime(pom) @@ -401,33 +395,16 @@ function! s:MavenOutputDirectory() " {{{2 let pom = syntastic#util#findFileInParent('pom.xml', expand('%:p:h', 1)) if s:has_maven && filereadable(pom) let mvn_properties = s:GetMavenProperties() - let output_dir = getcwd() - let sep = syntastic#util#Slash() - if has_key(mvn_properties, 'project.properties.build.dir') - let output_dir = mvn_properties['project.properties.build.dir'] - endif - if has_key(mvn_properties,'project.build.sourceDirectory') - let src_dir = mvn_properties['project.build.sourceDirectory'] - else - let src_dir = join(['src', 'main', 'java'], sep) - endif - if has_key(mvn_properties,'project.build.testsourceDirectory') - let test_src_dir = mvn_properties['project.build.testsourceDirectory'] - else - let test_src_dir = join(['src', 'test', 'java'], sep) - endif + let output_dir = get(mvn_properties, 'project.properties.build.dir', getcwd()) - if stridx(expand('%:p:h', 1), src_dir) >= 0 - let output_dir = join ([output_dir, 'target', 'classes'], sep) - if has_key(mvn_properties, 'project.build.outputDirectory') - let output_dir = mvn_properties['project.build.outputDirectory'] - endif + let sep = syntastic#util#Slash() + let src_main_dir = get(mvn_properties, 'project.build.sourceDirectory', join(['src', 'main', 'java'], sep)) + let src_test_dir = get(mvn_properties, 'project.build.testsourceDirectory', join(['src', 'test', 'java'], sep)) + if stridx(expand('%:p:h', 1), src_main_dir) >= 0 + let output_dir = get(mvn_properties, 'project.build.outputDirectory', join ([output_dir, 'target', 'classes'], sep)) endif - if stridx(expand('%:p:h', 1), test_src_dir) >= 0 - let output_dir = join([output_dir, 'target', 'test-classes'], sep) - if has_key(mvn_properties, 'project.build.testOutputDirectory') - let output_dir = mvn_properties['project.build.testOutputDirectory'] - endif + if stridx(expand('%:p:h', 1), src_test_dir) >= 0 + let output_dir = get(mvn_properties, 'project.build.testOutputDirectory', join([output_dir, 'target', 'test-classes'], sep)) endif if has('win32unix')