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

vup: fix unnecessary recompiles

fixes #4441
This commit is contained in:
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

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)
} }