2019-12-01 12:50:13 +03:00
|
|
|
module main
|
|
|
|
|
2020-04-26 09:32:05 +03:00
|
|
|
import os
|
|
|
|
import testing
|
2019-12-01 12:50:13 +03:00
|
|
|
|
2023-03-01 00:58:53 +03:00
|
|
|
const vroot = os.dir(os.real_path(os.getenv_opt('VEXE') or { @VEXE }))
|
2021-12-12 00:20:08 +03:00
|
|
|
|
2022-10-22 19:12:54 +03:00
|
|
|
// build as a project folder
|
2021-12-12 00:20:08 +03:00
|
|
|
const efolders = [
|
|
|
|
'examples/viewer',
|
2022-07-24 13:02:57 +03:00
|
|
|
'examples/vweb_orm_jwt',
|
2023-01-06 04:36:42 +03:00
|
|
|
'examples/vweb_fullstack',
|
2021-12-12 00:20:08 +03:00
|
|
|
]
|
|
|
|
|
2023-03-01 00:58:53 +03:00
|
|
|
pub fn normalised_vroot_path(path string) string {
|
|
|
|
return os.real_path(os.join_path_single(vroot, path)).replace('\\', '/')
|
|
|
|
}
|
|
|
|
|
2019-12-01 12:50:13 +03:00
|
|
|
fn main() {
|
2020-12-20 20:01:02 +03:00
|
|
|
args_string := os.args[1..].join(' ')
|
2019-12-05 14:22:54 +03:00
|
|
|
params := args_string.all_before('build-examples')
|
2023-03-01 00:58:53 +03:00
|
|
|
mut skip_prefixes := efolders.map(normalised_vroot_path(it))
|
2021-12-12 00:20:08 +03:00
|
|
|
res := testing.v_build_failing_skipped(params, 'examples', skip_prefixes, fn (mut session testing.TestSession) {
|
|
|
|
for x in efolders {
|
|
|
|
pathsegments := x.split_any('/')
|
2021-12-12 02:20:21 +03:00
|
|
|
session.add(os.real_path(os.join_path(vroot, ...pathsegments)))
|
2021-12-12 00:20:08 +03:00
|
|
|
}
|
|
|
|
})
|
|
|
|
if res {
|
2019-12-05 00:14:23 +03:00
|
|
|
exit(1)
|
|
|
|
}
|
2021-12-12 02:20:21 +03:00
|
|
|
if testing.v_build_failing_skipped(params + '-live', os.join_path_single('examples',
|
|
|
|
'hot_reload'), skip_prefixes, fn (mut session testing.TestSession) {})
|
2021-12-12 00:20:08 +03:00
|
|
|
{
|
2019-12-01 12:50:13 +03:00
|
|
|
exit(1)
|
|
|
|
}
|
|
|
|
}
|