v / cmd / tools
Raw file | 37 loc (32 sloc) | 837 bytes | Latest commit hash 014650951
1module main
2
3import os
4import testing
5
6const vroot = os.dir(os.real_path(os.getenv_opt('VEXE') or { @VEXE }))
7
8// build as a project folder
9const efolders = [
10 'examples/viewer',
11 'examples/vweb_orm_jwt',
12 'examples/vweb_fullstack',
13]
14
15pub fn normalised_vroot_path(path string) string {
16 return os.real_path(os.join_path_single(vroot, path)).replace('\\', '/')
17}
18
19fn main() {
20 args_string := os.args[1..].join(' ')
21 params := args_string.all_before('build-examples')
22 mut skip_prefixes := efolders.map(normalised_vroot_path(it))
23 res := testing.v_build_failing_skipped(params, 'examples', skip_prefixes, fn (mut session testing.TestSession) {
24 for x in efolders {
25 pathsegments := x.split_any('/')
26 session.add(os.real_path(os.join_path(vroot, ...pathsegments)))
27 }
28 })
29 if res {
30 exit(1)
31 }
32 if testing.v_build_failing_skipped(params + '-live', os.join_path_single('examples',
33 'hot_reload'), skip_prefixes, fn (mut session testing.TestSession) {})
34 {
35 exit(1)
36 }
37}