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