tools: support `v -prod up`

pull/8926/head
Delyan Angelov 2021-02-23 10:05:59 +02:00
parent 302baaa7b4
commit 977a625a45
No known key found for this signature in database
GPG Key ID: 66886C0F12D595ED
1 changed files with 4 additions and 1 deletions

View File

@ -7,6 +7,7 @@ import v.util.recompilation
struct App { struct App {
is_verbose bool is_verbose bool
is_prod bool
vexe string vexe string
vroot string vroot string
} }
@ -16,6 +17,7 @@ fn new_app() App {
vroot := os.dir(vexe) vroot := os.dir(vexe)
return App{ return App{
is_verbose: '-v' in os.args is_verbose: '-v' in os.args
is_prod: '-prod' in os.args
vexe: vexe vexe: vexe
vroot: vroot vroot: vroot
} }
@ -66,7 +68,8 @@ fn (app App) update_from_master() {
fn (app App) recompile_v() { fn (app App) recompile_v() {
// NB: app.vexe is more reliable than just v (which may be a symlink) // NB: app.vexe is more reliable than just v (which may be a symlink)
vself := '"$app.vexe" self' opts := if app.is_prod { '-prod' } else { '' }
vself := '"$app.vexe" $opts self'
app.vprintln('> recompiling v itself with `$vself` ...') app.vprintln('> recompiling v itself with `$vself` ...')
if self_result := os.exec(vself) { if self_result := os.exec(vself) {
if self_result.exit_code == 0 { if self_result.exit_code == 0 {