v/cmd/tools/vbuild-tools.v

38 lines
913 B
V
Raw Normal View History

2019-12-01 10:50:13 +01:00
module main
2020-04-26 08:32:05 +02:00
import os
import testing
import v.util
2019-12-01 10:50:13 +01:00
2020-12-01 16:43:34 +01:00
fn p(s string) string {
println(s)
return s
}
2019-12-01 10:50:13 +01:00
fn main() {
2020-12-20 18:01:02 +01:00
args_string := os.args[1..].join(' ')
skips := []string{}
2020-12-01 16:43:34 +01:00
vexe := os.getenv('VEXE')
vroot := os.dir(vexe)
2020-12-20 18:01:02 +01:00
util.ensure_modules_for_all_tools_are_installed('-v' in os.args)
2020-12-01 16:43:34 +01:00
folder := 'cmd/tools'
main_label := 'Building $folder ...'
finish_label := 'building $folder'
2020-12-20 18:01:02 +01:00
mut session := testing.prepare_test_session(args_string.all_before('build-tools'),
folder, skips, main_label)
2020-12-01 16:43:34 +01:00
session.rm_binaries = false
session.test()
eprintln(session.benchmark.total_message(finish_label))
if session.failed {
2019-12-01 10:50:13 +01:00
exit(1)
}
2020-12-01 16:43:34 +01:00
//
2020-12-20 18:01:02 +01:00
mut executables := os.ls(session.vtmp_dir) ?
2020-12-01 16:43:34 +01:00
executables.sort()
executables = executables.filter(it !in ['gen1m', 'gen_vc', 'fast', 'wyhash'])
for exe in executables {
2020-12-20 18:01:02 +01:00
os.mv_by_cp(os.join_path(session.vtmp_dir, exe), os.join_path(vroot, 'cmd', 'tools',
exe))
2020-12-01 16:43:34 +01:00
}
2019-12-01 10:50:13 +01:00
}