ci: fix `v build-examples` and `v build-tools`
parent
8a49a06201
commit
2b92ccecb5
|
@ -42,7 +42,7 @@ fn main() {
|
|||
vexe := pref.vexe_path()
|
||||
vroot := os.dir(vexe)
|
||||
util.set_vroot_folder(vroot)
|
||||
os.chdir(vroot)
|
||||
os.chdir(vroot) ?
|
||||
cmd := diff.find_working_diff_command() or { '' }
|
||||
mut app := App{
|
||||
diff_cmd: cmd
|
||||
|
|
|
@ -215,7 +215,7 @@ fn (mut gen_vc GenVC) generate() {
|
|||
}
|
||||
}
|
||||
// cd to gen_vc dir
|
||||
os.chdir(gen_vc.options.work_dir)
|
||||
os.chdir(gen_vc.options.work_dir) or {}
|
||||
// if we are not running with the --serve flag (webhook server)
|
||||
// rather than deleting and re-downloading the repo each time
|
||||
// first check to see if the local v repo is behind master
|
||||
|
|
|
@ -85,7 +85,10 @@ fn modfn(mname string, fname string) string {
|
|||
|
||||
pub fn chdir(path string) {
|
||||
verbose_trace_strong(modfn(@MOD, @FN), 'cd $path')
|
||||
os.chdir(path)
|
||||
os.chdir(path) or {
|
||||
verbose_trace(modfn(@MOD, @FN), '## failed.')
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
pub fn mkdir(path string) ? {
|
||||
|
|
|
@ -22,12 +22,12 @@ fn get_v_build_output(is_verbose bool, is_yes bool, file_path string) string {
|
|||
mut vexe := os.getenv('VEXE')
|
||||
// prepare a V compiler with -g to have better backtraces if possible
|
||||
wd := os.getwd()
|
||||
os.chdir(vroot)
|
||||
os.chdir(vroot) or {}
|
||||
verbose_flag := if is_verbose { '-v' } else { '' }
|
||||
vdbg_path := $if windows { '$vroot/vdbg.exe' } $else { '$vroot/vdbg' }
|
||||
vdbg_compilation_cmd := '"$vexe" $verbose_flag -g -o "$vdbg_path" cmd/v'
|
||||
vdbg_result := os.execute(vdbg_compilation_cmd)
|
||||
os.chdir(wd)
|
||||
os.chdir(wd) or {}
|
||||
if vdbg_result.exit_code == 0 {
|
||||
vexe = vdbg_path
|
||||
} else {
|
||||
|
|
|
@ -23,7 +23,7 @@ fn main() {
|
|||
args_string := os.args[1..].join(' ')
|
||||
vexe := os.getenv('VEXE')
|
||||
vroot := os.dir(vexe)
|
||||
os.chdir(vroot)
|
||||
os.chdir(vroot) ?
|
||||
folder := os.join_path('cmd', 'tools')
|
||||
tfolder := os.join_path(vroot, 'cmd', 'tools')
|
||||
main_label := 'Building $folder ...'
|
||||
|
|
|
@ -45,7 +45,7 @@ fn test_v_init() ? {
|
|||
defer {
|
||||
os.rmdir_all(dir) or {}
|
||||
}
|
||||
os.chdir(dir)
|
||||
os.chdir(dir) ?
|
||||
|
||||
init_and_check() ?
|
||||
}
|
||||
|
@ -57,7 +57,7 @@ fn test_v_init_in_git_dir() ? {
|
|||
defer {
|
||||
os.rmdir_all(dir) or {}
|
||||
}
|
||||
os.chdir(dir)
|
||||
os.chdir(dir) ?
|
||||
os.execute_or_exit('git init .')
|
||||
init_and_check() ?
|
||||
}
|
||||
|
@ -70,7 +70,7 @@ fn test_v_init_no_overwrite_gitignore() ? {
|
|||
defer {
|
||||
os.rmdir_all(dir) or {}
|
||||
}
|
||||
os.chdir(dir)
|
||||
os.chdir(dir) ?
|
||||
|
||||
vexe := @VEXE
|
||||
os.execute_or_exit('$vexe init')
|
||||
|
|
|
@ -333,7 +333,7 @@ fn vpm_update(m []string) {
|
|||
mut errors := 0
|
||||
for name in module_names {
|
||||
final_module_path := valid_final_path_of_existing_module(name) or { continue }
|
||||
os.chdir(final_module_path)
|
||||
os.chdir(final_module_path) or {}
|
||||
println('Updating module "$name"...')
|
||||
verbose_println(' work folder: $final_module_path')
|
||||
vcs := vcs_used_in_dir(final_module_path) or { continue }
|
||||
|
@ -361,7 +361,7 @@ fn get_outdated() ?[]string {
|
|||
mut outdated := []string{}
|
||||
for name in module_names {
|
||||
final_module_path := valid_final_path_of_existing_module(name) or { continue }
|
||||
os.chdir(final_module_path)
|
||||
os.chdir(final_module_path) or {}
|
||||
vcs := vcs_used_in_dir(final_module_path) or { continue }
|
||||
vcs_cmd_steps := supported_vcs_outdated_steps[vcs[0]]
|
||||
mut outputs := []string{}
|
||||
|
|
|
@ -11,7 +11,7 @@ fn main() {
|
|||
vexe := pref.vexe_path()
|
||||
vroot := os.dir(vexe)
|
||||
recompilation.must_be_enabled(vroot, 'Please install V from source, to use `v self` .')
|
||||
os.chdir(vroot)
|
||||
os.chdir(vroot) ?
|
||||
os.setenv('VCOLORS', 'always', true)
|
||||
args := os.args[1..].filter(it != 'self')
|
||||
jargs := args.join(' ')
|
||||
|
|
|
@ -156,7 +156,7 @@ fn get_all_commands() []Command {
|
|||
fn (mut cmd Command) run() {
|
||||
// Changing the current directory is needed for some of the compiler tests,
|
||||
// vlib/v/tests/local_test.v and vlib/v/tests/repl/repl_test.v
|
||||
os.chdir(vroot)
|
||||
os.chdir(vroot) or {}
|
||||
if cmd.label != '' {
|
||||
println(term.header_left(cmd.label, '*'))
|
||||
}
|
||||
|
|
|
@ -64,7 +64,7 @@ fn main() {
|
|||
}
|
||||
|
||||
fn tsession(vargs string, tool_source string, tool_cmd string, tool_args string, flist []string, slist []string) testing.TestSession {
|
||||
os.chdir(vroot)
|
||||
os.chdir(vroot) or {}
|
||||
title_message := 'running $tool_cmd over most .v files'
|
||||
testing.eheader(title_message)
|
||||
mut test_session := testing.new_test_session('$vargs $tool_args', false)
|
||||
|
|
|
@ -6,7 +6,7 @@ import v.pref
|
|||
fn main() {
|
||||
vexe := pref.vexe_path()
|
||||
vroot := os.dir(vexe)
|
||||
os.chdir(vroot)
|
||||
os.chdir(vroot) ?
|
||||
os.setenv('VCOLORS', 'always', true)
|
||||
self_idx := os.args.index('tracev')
|
||||
args := os.args[1..self_idx]
|
||||
|
|
|
@ -21,14 +21,14 @@ fn test_vexe() {
|
|||
}
|
||||
|
||||
fn test_can_compile_library() {
|
||||
os.chdir(cfolder)
|
||||
os.chdir(cfolder) or {}
|
||||
os.rm(library_file_name) or {}
|
||||
v_compile('-d no_backtrace -o library -shared modules/library/library.v')
|
||||
assert os.is_file(library_file_name)
|
||||
}
|
||||
|
||||
fn test_can_compile_main_program() {
|
||||
os.chdir(cfolder)
|
||||
os.chdir(cfolder) or {}
|
||||
assert os.is_file(library_file_name)
|
||||
result := v_compile('run use.v')
|
||||
// dump(result)
|
||||
|
@ -37,7 +37,7 @@ fn test_can_compile_main_program() {
|
|||
}
|
||||
|
||||
fn test_can_compile_and_use_library_with_skip_unused() {
|
||||
os.chdir(cfolder)
|
||||
os.chdir(cfolder) or {}
|
||||
os.rm(library_file_name) or {}
|
||||
v_compile('-skip-unused -d no_backtrace -o library -shared modules/library/library.v')
|
||||
assert os.is_file(library_file_name)
|
||||
|
|
Loading…
Reference in New Issue