mirror of
https://github.com/vlang/v.git
synced 2023-08-10 21:13:21 +03:00
tools: build examples/viewer
as a project folder
This commit is contained in:
parent
d3b769d1bc
commit
23be53e2de
@ -417,10 +417,6 @@ pub fn vlib_should_be_present(parent_dir string) {
|
||||
}
|
||||
}
|
||||
|
||||
pub fn v_build_failing(zargs string, folder string) bool {
|
||||
return v_build_failing_skipped(zargs, folder, [])
|
||||
}
|
||||
|
||||
pub fn prepare_test_session(zargs string, folder string, oskipped []string, main_label string) TestSession {
|
||||
vexe := pref.vexe_path()
|
||||
parent_dir := os.dir(vexe)
|
||||
@ -470,10 +466,13 @@ pub fn prepare_test_session(zargs string, folder string, oskipped []string, main
|
||||
return session
|
||||
}
|
||||
|
||||
pub fn v_build_failing_skipped(zargs string, folder string, oskipped []string) bool {
|
||||
pub type FnTestSetupCb = fn (mut session TestSession)
|
||||
|
||||
pub fn v_build_failing_skipped(zargs string, folder string, oskipped []string, cb FnTestSetupCb) bool {
|
||||
main_label := 'Building $folder ...'
|
||||
finish_label := 'building $folder'
|
||||
mut session := prepare_test_session(zargs, folder, oskipped, main_label)
|
||||
cb(mut session)
|
||||
session.test()
|
||||
eprintln(session.benchmark.total_message(finish_label))
|
||||
return session.failed
|
||||
|
@ -3,13 +3,28 @@ module main
|
||||
import os
|
||||
import testing
|
||||
|
||||
const vroot = @VMODROOT
|
||||
|
||||
const efolders = [
|
||||
'examples/viewer',
|
||||
]
|
||||
|
||||
fn main() {
|
||||
args_string := os.args[1..].join(' ')
|
||||
params := args_string.all_before('build-examples')
|
||||
if testing.v_build_failing(params, 'examples') {
|
||||
skip_prefixes := efolders.map(os.join_path(vroot, it))
|
||||
res := testing.v_build_failing_skipped(params, 'examples', skip_prefixes, fn (mut session testing.TestSession) {
|
||||
for x in efolders {
|
||||
pathsegments := x.split_any('/')
|
||||
session.add(os.join_path(vroot, ...pathsegments))
|
||||
}
|
||||
})
|
||||
if res {
|
||||
exit(1)
|
||||
}
|
||||
if testing.v_build_failing(params + '-live', os.join_path('examples', 'hot_reload')) {
|
||||
if testing.v_build_failing_skipped(params + '-live', os.join_path('examples', 'hot_reload'),
|
||||
skip_prefixes, fn (mut session testing.TestSession) {})
|
||||
{
|
||||
exit(1)
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user