Compare commits
No commits in common. "5bed58e55cd9d5b1198853d2c418ccb3da370229" and "40eb9aa808134c8bb474fd75b186c19e074ad9d2" have entirely different histories.
5bed58e55c
...
40eb9aa808
105
vimrc
105
vimrc
|
@ -183,8 +183,7 @@ let g:campo_custom_ctags_args = ""
|
||||||
let g:campo_jai_path = ''
|
let g:campo_jai_path = ''
|
||||||
|
|
||||||
" Args to include when compiling a Jai file.
|
" Args to include when compiling a Jai file.
|
||||||
let g:campo_jai_compiler_args = ''
|
let g:campo_jai_build_args = ''
|
||||||
let g:campo_jai_metaprogram_args = ''
|
|
||||||
|
|
||||||
|
|
||||||
"|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
"|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
||||||
|
@ -1165,31 +1164,56 @@ function! Build(optimized=0, silent=0)
|
||||||
endif
|
endif
|
||||||
|
|
||||||
let l:is_jai = 0
|
let l:is_jai = 0
|
||||||
let l:has_jai_build_file = 0
|
|
||||||
|
|
||||||
let l:ext = tolower(expand('%:e'))
|
|
||||||
let l:current_dir = expand('%:p:h')
|
|
||||||
|
|
||||||
let l:cmd = ""
|
let l:cmd = ""
|
||||||
|
|
||||||
if l:ext == "jai"
|
let l:ext = tolower(expand('%:e'))
|
||||||
|
let l:current_dir = expand('%:h')
|
||||||
|
let l:parent_dir = expand('%:p:h')
|
||||||
|
|
||||||
|
" Check if this is a jai module with a build.jai one directory back. This
|
||||||
|
" only works when the file is directly inside the modules folder.
|
||||||
|
let l:jai_module_with_build = (tolower(l:current_dir) == "modules") && filereadable(l:current_dir . "/../build.jai")
|
||||||
|
|
||||||
|
if (l:jai_module_with_build == 1) || filereadable(l:parent_dir . "/build.jai")
|
||||||
|
" Jai build file
|
||||||
let l:is_jai = 1
|
let l:is_jai = 1
|
||||||
|
let l:cmd = "jai " . l:parent_dir . "/"
|
||||||
|
|
||||||
" Check for a build file in the current directory or one directory back
|
if l:jai_module_with_build == 1
|
||||||
" (e.g. we're in modules/ or src/, code/, etc)
|
let l:cmd .= "../build.jai"
|
||||||
if filereadable(l:current_dir . "/build.jai") || filereadable(l:current_dir . "/../build.jai")
|
|
||||||
let l:has_jai_build_file = 1
|
|
||||||
|
|
||||||
let l:cmd = "jai " . l:current_dir . "/"
|
|
||||||
|
|
||||||
if filereadable(l:current_dir . "/build.jai") == 1
|
|
||||||
let l:cmd .= "build.jai"
|
|
||||||
else
|
|
||||||
let l:cmd .= "../build.jai"
|
|
||||||
endif
|
|
||||||
else
|
else
|
||||||
let l:cmd = "jai % "
|
let l:cmd .= "build.jai"
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
if a:optimized == 1
|
||||||
|
echo "Compiling release build.jai"
|
||||||
|
" @note We pass 'release' as a user command arg for the build file
|
||||||
|
" to parse. -release is a compiler arg and we don't want to use
|
||||||
|
" that. Ideally the build script would ignore that completely.
|
||||||
|
let l:cmd .= " - release"
|
||||||
|
else
|
||||||
|
echo "Compiling debug build.jai"
|
||||||
|
endif
|
||||||
|
|
||||||
|
" @note We aren't importing the local modules because the build file
|
||||||
|
" should manage that sort of thing for us.
|
||||||
|
|
||||||
|
elseif l:ext == "jai"
|
||||||
|
let l:is_jai = 1
|
||||||
|
let l:cmd = "jai % "
|
||||||
|
|
||||||
|
if a:optimized == 1
|
||||||
|
echo "Compiling release " . expand('%:t')
|
||||||
|
let l:cmd .= " -release"
|
||||||
|
else
|
||||||
|
echo "Compiling debug " . expand('%:t')
|
||||||
|
endif
|
||||||
|
|
||||||
|
" If there's a local modules/ directory then we'll import it.
|
||||||
|
if isdirectory(l:parent_dir . "/modules")
|
||||||
|
let l:cmd .= " -import_dir modules"
|
||||||
|
endif
|
||||||
|
|
||||||
else
|
else
|
||||||
let l:cmd .= './build* '
|
let l:cmd .= './build* '
|
||||||
if a:optimized == 1
|
if a:optimized == 1
|
||||||
|
@ -1198,44 +1222,7 @@ function! Build(optimized=0, silent=0)
|
||||||
endif
|
endif
|
||||||
|
|
||||||
if l:is_jai
|
if l:is_jai
|
||||||
let l:cmd .= ' '.g:campo_jai_compiler_args
|
let l:cmd .= ' '.g:campo_jai_build_args
|
||||||
let l:set_metaprogram_args = 0
|
|
||||||
|
|
||||||
if l:has_jai_build_file
|
|
||||||
if a:optimized == 1
|
|
||||||
echo "Compiling release build.jai"
|
|
||||||
" @note We pass 'release' as a user metaprogram arg for the
|
|
||||||
" build file to parse. -release is a compiler arg and we don't
|
|
||||||
" want to use that. Ideally the build script would ignore that
|
|
||||||
" completely. Also we don't bother adding an import directory
|
|
||||||
" for local modules because the build file should manage that
|
|
||||||
" sort of thing for us.
|
|
||||||
let l:cmd .= " - release"
|
|
||||||
let l:set_metaprogram_args = 1
|
|
||||||
else
|
|
||||||
echo "Compiling debug build.jai"
|
|
||||||
endif
|
|
||||||
else
|
|
||||||
if a:optimized == 1
|
|
||||||
echo "Compiling release " . expand('%:t')
|
|
||||||
let l:cmd .= " -release"
|
|
||||||
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_compiler_args != ""
|
|
||||||
if l:set_metaprogram_args == 1
|
|
||||||
let l:cmd .= ' '.g:campo_jai_metaprogram_args
|
|
||||||
else
|
|
||||||
let l:cmd .= ' - '.g:campo_jai_metaprogram_args
|
|
||||||
endif
|
|
||||||
endif
|
|
||||||
endif
|
endif
|
||||||
|
|
||||||
" I was originally passing -save=2 to AsyncRun! in order to save all
|
" I was originally passing -save=2 to AsyncRun! in order to save all
|
||||||
|
|
Loading…
Reference in New Issue
Block a user