spacevim/bundle/vim-javacomplete2/autoload/javacomplete/classpath/classpath.vim
JIe 2bb7059579
Some checks failed
Detach Plugins / check (FlyGrep.vim) (push) Has been cancelled
Detach Plugins / check (GitHub.vim) (push) Has been cancelled
Detach Plugins / check (JavaUnit.vim) (push) Has been cancelled
Detach Plugins / check (SourceCounter.vim) (push) Has been cancelled
Detach Plugins / check (cpicker.nvim) (push) Has been cancelled
Detach Plugins / check (dein-ui.vim) (push) Has been cancelled
Detach Plugins / check (git.vim) (push) Has been cancelled
Detach Plugins / check (iedit.vim) (push) Has been cancelled
Detach Plugins / check (scrollbar.vim) (push) Has been cancelled
Detach Plugins / check (vim-chat) (push) Has been cancelled
Detach Plugins / check (vim-cheat) (push) Has been cancelled
Detach Plugins / check (vim-todo) (push) Has been cancelled
Detach Plugins / check (xmake.vim) (push) Has been cancelled
test / Linux (nvim, nightly) (push) Has been cancelled
test / Linux (nvim, v0.3.8) (push) Has been cancelled
test / Linux (nvim, v0.4.0) (push) Has been cancelled
test / Linux (nvim, v0.4.2) (push) Has been cancelled
test / Linux (nvim, v0.4.3) (push) Has been cancelled
test / Linux (nvim, v0.4.4) (push) Has been cancelled
test / Linux (nvim, v0.5.0) (push) Has been cancelled
test / Linux (nvim, v0.5.1) (push) Has been cancelled
test / Linux (nvim, v0.6.0) (push) Has been cancelled
test / Linux (nvim, v0.6.1) (push) Has been cancelled
test / Linux (nvim, v0.7.0) (push) Has been cancelled
test / Linux (nvim, v0.7.2) (push) Has been cancelled
test / Linux (nvim, v0.8.0) (push) Has been cancelled
test / Linux (nvim, v0.8.1) (push) Has been cancelled
test / Linux (nvim, v0.8.2) (push) Has been cancelled
test / Linux (nvim, v0.8.3) (push) Has been cancelled
test / Linux (nvim, v0.9.0) (push) Has been cancelled
test / Linux (nvim, v0.9.1) (push) Has been cancelled
test / Linux (true, vim, v7.4.052) (push) Has been cancelled
test / Linux (true, vim, v7.4.1689) (push) Has been cancelled
test / Linux (true, vim, v7.4.629) (push) Has been cancelled
test / Linux (true, vim, v8.0.0027) (push) Has been cancelled
test / Linux (true, vim, v8.0.0183) (push) Has been cancelled
test / Linux (vim, nightly) (push) Has been cancelled
test / Linux (vim, v8.0.0184) (push) Has been cancelled
test / Linux (vim, v8.0.1453) (push) Has been cancelled
test / Linux (vim, v8.1.2269) (push) Has been cancelled
test / Linux (vim, v8.2.2434) (push) Has been cancelled
test / Linux (vim, v8.2.3995) (push) Has been cancelled
test / Windows (nvim, nightly) (push) Has been cancelled
test / Windows (nvim, v0.3.8) (push) Has been cancelled
test / Windows (nvim, v0.4.2) (push) Has been cancelled
test / Windows (nvim, v0.4.3) (push) Has been cancelled
test / Windows (nvim, v0.4.4) (push) Has been cancelled
test / Windows (nvim, v0.5.0) (push) Has been cancelled
test / Windows (nvim, v0.5.1) (push) Has been cancelled
test / Windows (nvim, v0.6.0) (push) Has been cancelled
test / Windows (nvim, v0.6.1) (push) Has been cancelled
test / Windows (nvim, v0.7.0) (push) Has been cancelled
test / Windows (nvim, v0.7.2) (push) Has been cancelled
test / Windows (nvim, v0.8.0) (push) Has been cancelled
test / Windows (nvim, v0.8.1) (push) Has been cancelled
test / Windows (nvim, v0.8.2) (push) Has been cancelled
test / Windows (nvim, v0.8.3) (push) Has been cancelled
test / Windows (nvim, v0.9.0) (push) Has been cancelled
test / Windows (nvim, v0.9.1) (push) Has been cancelled
test / Windows (vim, nightly) (push) Has been cancelled
test / Windows (vim, v7.4.1185) (push) Has been cancelled
test / Windows (vim, v7.4.1689) (push) Has been cancelled
test / Windows (vim, v8.0.0027) (push) Has been cancelled
test / Windows (vim, v8.0.1453) (push) Has been cancelled
test / Windows (vim, v8.1.2269) (push) Has been cancelled
test / Windows (vim, v8.2.2434) (push) Has been cancelled
test / Windows (vim, v8.2.3995) (push) Has been cancelled
docker / docker (push) Has been cancelled
mirror / check (coding) (push) Has been cancelled
mirror / check (gitee) (push) Has been cancelled
mirror / check (gitlab) (push) Has been cancelled
init
2024-08-21 14:17:26 +08:00

122 lines
3.6 KiB
VimL

function! s:Log(log)
let log = type(a:log) == type("") ? a:log : string(a:log)
call javacomplete#logger#Log("[classpath] ". log)
endfunction
function! javacomplete#classpath#classpath#BuildClassPath()
call s:BuildClassPath(0)
endfunction
function! javacomplete#classpath#classpath#RebuildClassPath()
call s:BuildClassPath(1)
endfunction
function! s:BuildClassPath(force)
if !g:JavaComplete_MavenRepositoryDisabled
if empty('g:JavaComplete_PomPath')
let g:JavaComplete_PomPath = javacomplete#util#FindFile('pom.xml')
if g:JavaComplete_PomPath != ""
let g:JavaComplete_PomPath = fnamemodify(g:JavaComplete_PomPath, ':p')
call s:Log("found maven file: ". g:JavaComplete_PomPath)
endif
endif
endif
if !get(g:, 'JavaComplete_GradleRepositoryDisabled', 0)
if !exists('g:JavaComplete_GradlePath')
if filereadable(getcwd(). g:FILE_SEP. "build.gradle")
let g:JavaComplete_GradlePath = getcwd(). g:FILE_SEP. "build.gradle"
else
let g:JavaComplete_GradlePath = javacomplete#util#FindFile('build.gradle', '**3')
endif
if g:JavaComplete_GradlePath != ""
let g:JavaComplete_GradlePath = fnamemodify(g:JavaComplete_GradlePath, ':p')
call s:Log("found gradle file: ". g:JavaComplete_GradlePath)
endif
endif
endif
if !get(g:, 'JavaComplete_AntRepositoryDisabled', 0)
if !exists('g:JavaComplete_AntPath')
if filereadable(getcwd(). g:FILE_SEP. "build.xml")
let g:JavaComplete_AntPath = getcwd(). g:FILE_SEP. "build.xml"
else
let g:JavaComplete_AntPath = javacomplete#util#FindFile('build.xml', '**3')
endif
if g:JavaComplete_AntPath != ""
let g:JavaComplete_AntPath = fnamemodify(g:JavaComplete_AntPath, ':p')
call s:Log("found ant file: ". g:JavaComplete_AntPath)
endif
endif
endif
let found_classpath = s:FindClassPath(a:force)
if found_classpath != '.' || g:JavaComplete_LibsPath != '.'
let g:JavaComplete_LibsPath .= found_classpath
endif
call s:Log("libs found: ". g:JavaComplete_LibsPath)
endfunction
function! s:ReadClassPathFile(classpathFile)
let cp = ''
let file = g:JavaComplete_Home. join(['', 'autoload', 'classpath.py'], g:FILE_SEP)
execute "JavacompletePyfile" file
JavacompletePy import vim
JavacompletePy vim.command("let cp = '%s'" % os.pathsep.join(ReadClasspathFile(vim.eval('a:classpathFile'))).replace('\\', '/'))
return cp
endfunction
function! s:UseEclipse(force)
if has('python') || has('python3')
let classpathFile = fnamemodify(findfile('.classpath', escape(expand('.'), '*[]?{}, ') . ';'), ':p')
if !empty(classpathFile) && filereadable(classpathFile)
return s:ReadClassPathFile(classpathFile)
endif
endif
return ""
endf
function! s:UseMaven(force)
if javacomplete#classpath#maven#IfMaven()
return javacomplete#classpath#maven#Generate(a:force)
endif
return ""
endf
function! s:UseGradle(force)
if javacomplete#classpath#gradle#IfGradle()
return javacomplete#classpath#gradle#Generate(a:force)
endif
return ""
endf
function! s:UseAnt(force)
if javacomplete#classpath#ant#IfAnt()
return javacomplete#classpath#ant#Generate(a:force)
endif
return ""
endf
function! s:FindClassPath(force) abort
for classpathSourceType in g:JavaComplete_ClasspathGenerationOrder
try
let cp = ''
exec "let cp .= s:Use". classpathSourceType. "(". a:force. ")"
if !empty(cp)
call s:Log("found ". classpathSourceType. " project")
return '.' . g:PATH_SEP . cp
endif
catch
endtry
endfor
return '.'
endfunction
" vim:set fdm=marker sw=2 nowrap: