Compare commits
2 Commits
40eb9aa808
...
5bed58e55c
Author | SHA1 | Date | |
---|---|---|---|
5bed58e55c | |||
6800f7ccc4 |
101
vimrc
101
vimrc
|
@ -183,7 +183,8 @@ let g:campo_custom_ctags_args = ""
|
|||
let g:campo_jai_path = ''
|
||||
|
||||
" Args to include when compiling a Jai file.
|
||||
let g:campo_jai_build_args = ''
|
||||
let g:campo_jai_compiler_args = ''
|
||||
let g:campo_jai_metaprogram_args = ''
|
||||
|
||||
|
||||
"|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
||||
|
@ -1164,56 +1165,31 @@ function! Build(optimized=0, silent=0)
|
|||
endif
|
||||
|
||||
let l:is_jai = 0
|
||||
let l:cmd = ""
|
||||
let l:has_jai_build_file = 0
|
||||
|
||||
let l:ext = tolower(expand('%:e'))
|
||||
let l:current_dir = expand('%:h')
|
||||
let l:parent_dir = expand('%:p:h')
|
||||
let l:current_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")
|
||||
let l:cmd = ""
|
||||
|
||||
if (l:jai_module_with_build == 1) || filereadable(l:parent_dir . "/build.jai")
|
||||
" Jai build file
|
||||
if l:ext == "jai"
|
||||
let l:is_jai = 1
|
||||
let l:cmd = "jai " . l:parent_dir . "/"
|
||||
|
||||
if l:jai_module_with_build == 1
|
||||
let l:cmd .= "../build.jai"
|
||||
" Check for a build file in the current directory or one directory back
|
||||
" (e.g. we're in modules/ or src/, code/, etc)
|
||||
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
|
||||
let l:cmd .= "build.jai"
|
||||
let l:cmd = "jai % "
|
||||
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
|
||||
let l:cmd .= './build* '
|
||||
if a:optimized == 1
|
||||
|
@ -1222,7 +1198,44 @@ function! Build(optimized=0, silent=0)
|
|||
endif
|
||||
|
||||
if l:is_jai
|
||||
let l:cmd .= ' '.g:campo_jai_build_args
|
||||
let l:cmd .= ' '.g:campo_jai_compiler_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
|
||||
|
||||
" I was originally passing -save=2 to AsyncRun! in order to save all
|
||||
|
|
Loading…
Reference in New Issue
Block a user