Also check for first.jai files when building

This commit is contained in:
Michael Campagnaro 2023-08-05 17:49:06 -04:00
parent e759f8c3cd
commit 90c312e954

22
.vimrc
View File

@ -1213,6 +1213,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:ext = tolower(expand('%:e'))
let l:current_dir = expand('%:p:h')
@ -1225,16 +1226,24 @@ fu! Build(optimized=0, silent=0)
" 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:one_dir_back . "/build.jai")
if filereadable(l:current_dir . "/build.jai") || filereadable(l:one_dir_back . "/build.jai") || filereadable(l:current_dir . "/first.jai") || filereadable(l:one_dir_back . "/first.jai")
let l:has_jai_build_file = 1
if filereadable(l:current_dir . "/build.jai") == 1
let l:cmd = "jai ". l:current_dir . "/build.jai"
elseif filereadable(l:current_dir . "/first.jai") == 1
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.
let l:cmd = "jai " . l:one_dir_back . "/build.jai"
if filereadable(l:one_dir_back . "/build.jai") == 1
let l:cmd = "jai " . l:one_dir_back . "/build.jai"
else
let l:cmd = "jai " . l:one_dir_back . "/first.jai"
let l:has_jai_first_file = 1
endif
endif
else
let l:cmd = "jai % "
@ -1251,8 +1260,13 @@ fu! Build(optimized=0, silent=0)
let l:set_metaprogram_args = 0
if l:has_jai_build_file
let l:filename = "build.jai"
if l:has_jai_first_file
let l:filename = "first.jai"
endif
if a:optimized == 1
echo "Compiling release build.jai"
echo "Compiling release " . l:filename
" @note We pass 'release' as a user metaprogram arg for the
" build file to parse in case it cares about that. -release is
" a compiler arg that we also include because some build
@ -1262,7 +1276,7 @@ fu! Build(optimized=0, silent=0)
let l:cmd .= " -release - -release"
let l:set_metaprogram_args = 1
else
echo "Compiling debug build.jai"
echo "Compiling debug " . l:filename
endif
else
if a:optimized == 1