Improve jai build function
This commit is contained in:
parent
a2c5c8a4d6
commit
65500a66ea
31
.vimrc
31
.vimrc
|
@ -1170,7 +1170,14 @@ fu! StopRunTask()
|
|||
call HideAsyncResults()
|
||||
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! "
|
||||
if a:silent
|
||||
let l:async_cmd .= "-post=call\\ HideAsyncResults() "
|
||||
|
@ -1178,7 +1185,7 @@ fu! Build(optimized=0, silent=0)
|
|||
|
||||
let l:is_jai = 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: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")))
|
||||
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"
|
||||
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:has_jai_first_file = 1
|
||||
else
|
||||
" It's one directory back. We don't want to include '../' in
|
||||
" the cmd because then our reported paths in the program get
|
||||
" 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"
|
||||
else
|
||||
let l:cmd = "jai " . l:one_dir_back . "/first.jai"
|
||||
|
@ -1213,8 +1220,17 @@ fu! Build(optimized=0, silent=0)
|
|||
else
|
||||
let l:cmd = "jai % "
|
||||
endif
|
||||
else
|
||||
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
|
||||
let l:cmd .= ' -o'
|
||||
endif
|
||||
|
@ -1250,11 +1266,6 @@ fu! Build(optimized=0, silent=0)
|
|||
else
|
||||
echo "Compiling debug " . expand('%:t')
|
||||
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
|
||||
|
||||
if g:campo_jai_metaprogram_args != ""
|
||||
|
|
Loading…
Reference in New Issue
Block a user