live: always add os and time when compiling -live programs
Fixes fail when -live user programs do not use os and time.pull/3024/head
parent
7ffa315566
commit
f68d9d1a16
|
@ -91,7 +91,7 @@ fn (v &V) generate_hot_reload_code() {
|
||||||
}
|
}
|
||||||
|
|
||||||
so_debug_flag := if v.pref.is_debug { '-g' } else { '' }
|
so_debug_flag := if v.pref.is_debug { '-g' } else { '' }
|
||||||
cmd_compile_shared_library := '$vexe $msvc $so_debug_flag -o $file_base -shared $file'
|
cmd_compile_shared_library := '$vexe $msvc $so_debug_flag -o $file_base -solive -shared $file'
|
||||||
if v.pref.show_c_cmd {
|
if v.pref.show_c_cmd {
|
||||||
println(cmd_compile_shared_library)
|
println(cmd_compile_shared_library)
|
||||||
}
|
}
|
||||||
|
@ -187,7 +187,7 @@ void reload_so() {
|
||||||
#else
|
#else
|
||||||
sprintf(new_so_name, "%s.so", new_so_base);
|
sprintf(new_so_name, "%s.so", new_so_base);
|
||||||
#endif
|
#endif
|
||||||
sprintf(compile_cmd, "$vexe $msvc -o %s -shared $file", new_so_base);
|
sprintf(compile_cmd, "$vexe $msvc -o %s -solive -shared $file", new_so_base);
|
||||||
os__system(tos2(compile_cmd));
|
os__system(tos2(compile_cmd));
|
||||||
|
|
||||||
if( !os__exists(tos2(new_so_name)) ) {
|
if( !os__exists(tos2(new_so_name)) ) {
|
||||||
|
|
|
@ -85,8 +85,9 @@ pub mut:
|
||||||
//nofmt bool // disable vfmt
|
//nofmt bool // disable vfmt
|
||||||
is_test bool // `v test string_test.v`
|
is_test bool // `v test string_test.v`
|
||||||
is_script bool // single file mode (`v program.v`), main function can be skipped
|
is_script bool // single file mode (`v program.v`), main function can be skipped
|
||||||
is_live bool // for hot code reloading
|
is_live bool // main program that contains live/hot code
|
||||||
is_so bool
|
is_solive bool // a shared library, that will be used in a -live main program
|
||||||
|
is_so bool // an ordinary shared library, -shared, no matter if it is live or not
|
||||||
is_prof bool // benchmark every function
|
is_prof bool // benchmark every function
|
||||||
translated bool // `v translate doom.v` are we running V code translated from C? allow globals, ++ expressions, etc
|
translated bool // `v translate doom.v` are we running V code translated from C? allow globals, ++ expressions, etc
|
||||||
is_prod bool // use "-O2"
|
is_prod bool // use "-O2"
|
||||||
|
@ -731,13 +732,20 @@ pub fn (v &V) get_user_files() []string {
|
||||||
// libs, but we dont know which libs need to be added yet
|
// libs, but we dont know which libs need to be added yet
|
||||||
mut user_files := []string
|
mut user_files := []string
|
||||||
|
|
||||||
if v.pref.is_test {
|
preludes_path := filepath.join(v.pref.vlib_path,'compiler','preludes')
|
||||||
// TODO this somtimes fails on CI
|
|
||||||
user_files << filepath.join(v.pref.vlib_path,'compiler','preludes','tests_assertions.v')
|
if v.pref.is_live {
|
||||||
|
user_files << filepath.join(preludes_path,'live_main.v')
|
||||||
|
}
|
||||||
|
if v.pref.is_solive {
|
||||||
|
user_files << filepath.join(preludes_path,'live_shared.v')
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if v.pref.is_test {
|
||||||
|
user_files << filepath.join(preludes_path,'tests_assertions.v')
|
||||||
|
}
|
||||||
if v.pref.is_test && v.pref.is_stats {
|
if v.pref.is_test && v.pref.is_stats {
|
||||||
user_files << filepath.join(v.pref.vlib_path,'compiler','preludes','tests_with_stats.v')
|
user_files << filepath.join(preludes_path,'tests_with_stats.v')
|
||||||
}
|
}
|
||||||
|
|
||||||
// v volt/slack_test.v: compile all .v files to get the environment
|
// v volt/slack_test.v: compile all .v files to get the environment
|
||||||
|
@ -1027,6 +1035,7 @@ pub fn new_v(args[]string) &V {
|
||||||
is_test: is_test
|
is_test: is_test
|
||||||
is_script: is_script
|
is_script: is_script
|
||||||
is_so: '-shared' in args
|
is_so: '-shared' in args
|
||||||
|
is_solive: '-solive' in args
|
||||||
is_prod: '-prod' in args
|
is_prod: '-prod' in args
|
||||||
is_verbose: '-verbose' in args || '--verbose' in args
|
is_verbose: '-verbose' in args || '--verbose' in args
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,9 @@
|
||||||
|
module main
|
||||||
|
|
||||||
|
import os
|
||||||
|
import time
|
||||||
|
|
||||||
|
const (
|
||||||
|
os_used = os.MAX_PATH
|
||||||
|
time_used = time.now()
|
||||||
|
)
|
|
@ -0,0 +1,9 @@
|
||||||
|
module main
|
||||||
|
|
||||||
|
import os
|
||||||
|
import time
|
||||||
|
|
||||||
|
const (
|
||||||
|
os_used = os.MAX_PATH
|
||||||
|
time_used = time.now()
|
||||||
|
)
|
Loading…
Reference in New Issue