vup: fix unnecessary recompiles

fixes #4441
pull/4552/head
JalonSolov 2020-04-22 13:54:39 -04:00 committed by GitHub
parent de182d5809
commit 54c382f6f1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 15 additions and 5 deletions

View File

@ -36,20 +36,30 @@ fn main() {
} }
$if windows { $if windows {
v_backup_file := 'v_old.exe' backup('v.exe')
if os.exists(v_backup_file) {
os.rm(v_backup_file)
}
os.mv('v.exe', v_backup_file)
make_result := os.exec('make.bat') or { make_result := os.exec('make.bat') or {
panic(err) panic(err)
} }
println(make_result.output) println(make_result.output)
backup('cmd/tools/vup.exe')
} $else { } $else {
make_result := os.exec('make') or { make_result := os.exec('make') or {
panic(err) panic(err)
} }
println(make_result.output) println(make_result.output)
} }
_ := os.exec('v cmd/tools/vup') or {
panic(err)
}
}
fn backup(file string) {
backup_file := '${file}_old.exe'
if os.exists(backup_file) {
os.rm(backup_file)
}
os.mv(file, backup_file)
} }