Improve jai build function
This commit is contained in:
parent
a2c5c8a4d6
commit
65500a66ea
33
.vimrc
33
.vimrc
|
@ -1170,7 +1170,14 @@ fu! StopRunTask()
|
||||||
call HideAsyncResults()
|
call HideAsyncResults()
|
||||||
endfu
|
endfu
|
||||||
|
|
||||||
fu! Build(optimized=0, silent=0)
|
" @incomplete use the same path searching from RunProgram
|
||||||
|
" @incomplete use the same path searching from RunProgram
|
||||||
|
" @incomplete use the same path searching from RunProgram
|
||||||
|
" @incomplete use the same path searching from RunProgram
|
||||||
|
" @incomplete use the same path searching from RunProgram
|
||||||
|
" @incomplete use the same path searching from RunProgram
|
||||||
|
" @incomplete use the same path searching from RunProgram
|
||||||
|
fu! Build(optimized=0, silent=0) abort
|
||||||
let l:async_cmd = "AsyncRun! "
|
let l:async_cmd = "AsyncRun! "
|
||||||
if a:silent
|
if a:silent
|
||||||
let l:async_cmd .= "-post=call\\ HideAsyncResults() "
|
let l:async_cmd .= "-post=call\\ HideAsyncResults() "
|
||||||
|
@ -1178,7 +1185,7 @@ fu! Build(optimized=0, silent=0)
|
||||||
|
|
||||||
let l:is_jai = 0
|
let l:is_jai = 0
|
||||||
let l:has_jai_build_file = 0
|
let l:has_jai_build_file = 0
|
||||||
let l:has_jai_first_file = 1
|
let l:has_jai_first_file = 0
|
||||||
|
|
||||||
let l:ext = tolower(expand('%:e'))
|
let l:ext = tolower(expand('%:e'))
|
||||||
let l:current_dir = expand('%:p:h')
|
let l:current_dir = expand('%:p:h')
|
||||||
|
@ -1194,16 +1201,16 @@ fu! Build(optimized=0, silent=0)
|
||||||
if filereadable(l:current_dir . "/build.jai") || filereadable(l:current_dir . "/first.jai") || ((l:one_dir_back != "/") && (filereadable(l:one_dir_back . "/build.jai") || filereadable(l:one_dir_back . "/first.jai")))
|
if filereadable(l:current_dir . "/build.jai") || filereadable(l:current_dir . "/first.jai") || ((l:one_dir_back != "/") && (filereadable(l:one_dir_back . "/build.jai") || filereadable(l:one_dir_back . "/first.jai")))
|
||||||
let l:has_jai_build_file = 1
|
let l:has_jai_build_file = 1
|
||||||
|
|
||||||
if filereadable(l:current_dir . "/build.jai") == 1
|
if filereadable(l:current_dir . "/build.jai")
|
||||||
let l:cmd = "jai ". l:current_dir . "/build.jai"
|
let l:cmd = "jai ". l:current_dir . "/build.jai"
|
||||||
elseif filereadable(l:current_dir . "/first.jai") == 1
|
elseif filereadable(l:current_dir . "/first.jai")
|
||||||
let l:cmd = "jai ". l:current_dir . "/first.jai"
|
let l:cmd = "jai ". l:current_dir . "/first.jai"
|
||||||
let l:has_jai_first_file = 1
|
let l:has_jai_first_file = 1
|
||||||
else
|
else
|
||||||
" It's one directory back. We don't want to include '../' in
|
" It's one directory back. We don't want to include '../' in
|
||||||
" the cmd because then our reported paths in the program get
|
" the cmd because then our reported paths in the program get
|
||||||
" botched, e.g. path shown in an assert error.
|
" botched, e.g. path shown in an assert error.
|
||||||
if filereadable(l:one_dir_back . "/build.jai") == 1
|
if filereadable(l:one_dir_back . "/build.jai")
|
||||||
let l:cmd = "jai " . l:one_dir_back . "/build.jai"
|
let l:cmd = "jai " . l:one_dir_back . "/build.jai"
|
||||||
else
|
else
|
||||||
let l:cmd = "jai " . l:one_dir_back . "/first.jai"
|
let l:cmd = "jai " . l:one_dir_back . "/first.jai"
|
||||||
|
@ -1214,7 +1221,16 @@ fu! Build(optimized=0, silent=0)
|
||||||
let l:cmd = "jai % "
|
let l:cmd = "jai % "
|
||||||
endif
|
endif
|
||||||
else
|
else
|
||||||
let l:cmd .= './build* '
|
if filereadable("build") && !isdirectory("build")
|
||||||
|
let l:cmd .= './build '
|
||||||
|
elseif filereadable("build.sh")
|
||||||
|
let l:cmd .= './build.sh '
|
||||||
|
elseif filereadable("build.bat")
|
||||||
|
let l:cmd .= './build.bat '
|
||||||
|
else
|
||||||
|
let l:cmd .= './build* '
|
||||||
|
endif
|
||||||
|
|
||||||
if a:optimized == 1
|
if a:optimized == 1
|
||||||
let l:cmd .= ' -o'
|
let l:cmd .= ' -o'
|
||||||
endif
|
endif
|
||||||
|
@ -1250,11 +1266,6 @@ fu! Build(optimized=0, silent=0)
|
||||||
else
|
else
|
||||||
echo "Compiling debug " . expand('%:t')
|
echo "Compiling debug " . expand('%:t')
|
||||||
endif
|
endif
|
||||||
|
|
||||||
" If there's a local modules/ directory then we'll import it.
|
|
||||||
if isdirectory(l:current_dir . "/modules")
|
|
||||||
let l:cmd .= " -import_dir modules"
|
|
||||||
endif
|
|
||||||
endif
|
endif
|
||||||
|
|
||||||
if g:campo_jai_metaprogram_args != ""
|
if g:campo_jai_metaprogram_args != ""
|
||||||
|
|
Loading…
Reference in New Issue
Block a user