mirror of
https://github.com/vlang/v.git
synced 2025-09-13 14:32:26 +03:00
tools: make fast.v and fast_job.v more self sufficient
This commit is contained in:
parent
24088a7ca4
commit
9a0f4d8461
2 changed files with 22 additions and 11 deletions
|
@ -14,11 +14,11 @@ const discard_highest_samples = 16
|
|||
|
||||
const voptions = ' -skip-unused -show-timings -stats '
|
||||
|
||||
const fast_dir = os.dir(@FILE)
|
||||
const fast_dir = os.real_path(os.dir(@FILE))
|
||||
|
||||
const fast_log_path = os.join_path(fast_dir, 'fast.log')
|
||||
const fast_log_path = os.real_path(os.join_path(fast_dir, 'fast.log'))
|
||||
|
||||
const vdir = os.dir(os.dir(os.dir(fast_dir)))
|
||||
const vdir = os.real_path(os.dir(os.dir(os.dir(fast_dir))))
|
||||
|
||||
fn elog(msg string) {
|
||||
line := '${time.now().format_ss_micro()} ${msg}\n'
|
||||
|
@ -40,6 +40,9 @@ fn lexec(cmd string) string {
|
|||
}
|
||||
|
||||
fn main() {
|
||||
// ensure all log messages will be visible to the observers, even if the program panics
|
||||
log.set_always_flush(true)
|
||||
|
||||
total_sw := time.new_stopwatch()
|
||||
elog('fast.html generator start')
|
||||
defer {
|
||||
|
|
|
@ -31,6 +31,17 @@ fn delay() {
|
|||
time.sleep(sleep_period * time.second)
|
||||
}
|
||||
|
||||
fn check_output_repo(url string, branch string, folder string) {
|
||||
if os.exists(folder) {
|
||||
elog('Note: ${folder} already exists; using it.')
|
||||
return
|
||||
}
|
||||
cmd := 'git clone --filter=blob:none --branch=${branch} ${url} ${folder}'
|
||||
elog('Note: ${folder} is missing. Cloning to `${folder}`, with: `${cmd}` ...')
|
||||
res := os.system(cmd)
|
||||
elog('... cloning done, result: ${res}')
|
||||
}
|
||||
|
||||
fn main() {
|
||||
elog('fast_job start setup ...')
|
||||
// ensure a more stable working environment for the used tools, independent on how this executable was started:
|
||||
|
@ -48,14 +59,11 @@ fn main() {
|
|||
elog('fast_job end')
|
||||
}
|
||||
|
||||
if !os.exists('fast.vlang.io/') {
|
||||
println('cloning the fast.vlang.io/ repo...')
|
||||
os.system('git clone git@github.com:/vlang/website.git fast.vlang.io/')
|
||||
}
|
||||
if !os.exists('docs.vlang.io') {
|
||||
println('cloning the docs.vlang.io/ repo...')
|
||||
os.system('git clone git@github.com:/vlang/docs.git docs.vlang.io/')
|
||||
}
|
||||
elog('fast_job clone output repos...')
|
||||
check_output_repo('https://github.com/vlang/website', 'gh-pages', 'fast.vlang.io/')
|
||||
check_output_repo('https://github.com/vlang/docs/', 'main', 'docs.vlang.io/')
|
||||
check_output_repo('https://github.com/vlang/docs/', 'generator', 'docs.vlang.io/docs_generator/')
|
||||
|
||||
mut i := 0
|
||||
for {
|
||||
i++
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue