1
0
mirror of https://github.com/vlang/v.git synced 2023-08-10 21:13:21 +03:00

vself: add -prod options

This commit is contained in:
yuyi
2020-03-16 22:46:38 +08:00
committed by GitHub
parent 456c0250b0
commit cff6f4abd6
2 changed files with 13 additions and 4 deletions

View File

@ -6,22 +6,31 @@ import (
)
fn main() {
println('V Self Compiling...')
vexe := pref.vexe_path()
vroot := os.dir(vexe)
os.chdir(vroot)
s2 := os.exec('$vexe -o v2 cmd/v') or {
panic(err)
mut cmd := '$vexe -o v2 cmd/v'
if os.args.len >= 3 && os.args[2] == '-prod' {
cmd = '$vexe -o v2 -prod cmd/v'
println('V Self Compiling (-prod mode)...')
}
else {
println('V Self Compiling...')
}
s2 := os.exec(cmd) or { panic(err) }
if s2.output.len > 0 {
println(s2.output)
}
if s2.exit_code != 0 {
exit(1)
}
v_file := if os.user_os() == 'windows' { 'v.exe' } else { 'v' }
v2_file := if os.user_os() == 'windows' { 'v2.exe' } else { 'v2' }
bak_file := if os.user_os() == 'windows' { 'v_old.exe' } else { 'v_old' }
if os.exists(bak_file) {
os.rm(bak_file)
}