mirror of
https://github.com/vlang/v.git
synced 2023-08-10 21:13:21 +03:00
builder: a small -usecache fix, when v is run in subfolders
This commit is contained in:
parent
4b35495fbe
commit
6da8454b3b
@ -127,6 +127,10 @@ fn (mut v Builder) post_process_c_compiler_output(res os.Result) {
|
||||
fn (mut v Builder) rebuild_cached_module(vexe string, imp_path string) string {
|
||||
res := v.pref.cache_manager.exists('.o', imp_path) or {
|
||||
println('Cached $imp_path .o file not found... Building .o file for $imp_path')
|
||||
// do run `v build-module x` always in main vfolder; x can be a relative path
|
||||
pwd := os.getwd()
|
||||
vroot := os.dir(vexe)
|
||||
os.chdir(vroot)
|
||||
boptions := v.pref.build_options.join(' ')
|
||||
rebuild_cmd := '$vexe $boptions build-module $imp_path'
|
||||
// eprintln('>> rebuild_cmd: $rebuild_cmd')
|
||||
@ -134,6 +138,7 @@ fn (mut v Builder) rebuild_cached_module(vexe string, imp_path string) string {
|
||||
rebuilded_o := v.pref.cache_manager.exists('.o', imp_path) or {
|
||||
panic('could not rebuild cache module for $imp_path, error: $err')
|
||||
}
|
||||
os.chdir(pwd)
|
||||
return rebuilded_o
|
||||
}
|
||||
return res
|
||||
|
Loading…
Reference in New Issue
Block a user