1
0
mirror of https://github.com/vlang/v.git synced 2023-08-10 21:13:21 +03:00

tools: add v test-vet

This commit is contained in:
Delyan Angelov
2020-10-24 16:36:26 +03:00
parent 296a6095a4
commit 23ee3018c3
5 changed files with 117 additions and 68 deletions

View File

@@ -4,6 +4,7 @@
module util
import os
import time
import v.pref
import v.vmod
@@ -390,3 +391,23 @@ pub fn no_cur_mod(typename string, cur_mod string) string {
}
return res
}
pub fn prepare_tool_when_needed(source_name string) {
vexe := os.getenv('VEXE')
vroot := os.dir(vexe)
stool := os.join_path(vroot, 'cmd', 'tools', source_name)
if should_recompile_tool(vexe, stool) {
time.sleep_ms(1001) // TODO: remove this when we can get mtime with a better resolution
recompile_file(vexe, stool)
}
}
pub fn recompile_file(vexe string, file string) {
cmd := '$vexe $file'
println('recompilation command: $cmd')
recompile_result := os.system(cmd)
if recompile_result != 0 {
eprintln('could not recompile $file')
exit(2)
}
}