tools: v self compiler
parent
f5fdbfd004
commit
8c43644301
|
@ -0,0 +1,36 @@
|
||||||
|
module main
|
||||||
|
|
||||||
|
import (
|
||||||
|
os
|
||||||
|
filepath
|
||||||
|
v.pref
|
||||||
|
)
|
||||||
|
|
||||||
|
fn main() {
|
||||||
|
println('V Self Compiling...')
|
||||||
|
vroot := filepath.dir(pref.vexe_path())
|
||||||
|
os.chdir(vroot)
|
||||||
|
|
||||||
|
s2 := os.exec('v -o v2 cmd/v') or {
|
||||||
|
panic(err)
|
||||||
|
}
|
||||||
|
println(s2.output)
|
||||||
|
|
||||||
|
$if windows {
|
||||||
|
bak_file := 'v_old.exe'
|
||||||
|
if os.exists(bak_file) {
|
||||||
|
os.rm(bak_file)
|
||||||
|
}
|
||||||
|
os.mv('v.exe', bak_file)
|
||||||
|
os.mv('v2.exe', 'v.exe')
|
||||||
|
|
||||||
|
|
||||||
|
} $else {
|
||||||
|
bak_file := 'v_old'
|
||||||
|
if os.exists(bak_file) {
|
||||||
|
os.rm(bak_file)
|
||||||
|
}
|
||||||
|
os.mv('v', bak_file)
|
||||||
|
os.mv('v2', 'v')
|
||||||
|
}
|
||||||
|
}
|
|
@ -20,6 +20,7 @@ The commands are:
|
||||||
symlink create a symbolic link for V
|
symlink create a symbolic link for V
|
||||||
translate translate C code to V (coming soon in 0.3)
|
translate translate C code to V (coming soon in 0.3)
|
||||||
up run the V self-updater
|
up run the V self-updater
|
||||||
|
self run the V self-compiler
|
||||||
version prints the version text and exits
|
version prints the version text and exits
|
||||||
|
|
||||||
install installs a module from VPM
|
install installs a module from VPM
|
||||||
|
@ -110,6 +111,7 @@ Commands:
|
||||||
up Update V. Run `v up` at least once per day, since V development is rapid and features/bugfixes are added constantly.
|
up Update V. Run `v up` at least once per day, since V development is rapid and features/bugfixes are added constantly.
|
||||||
run <file.v> Build and execute the V program in file.v. You can add arguments for the V program *after* the file name.
|
run <file.v> Build and execute the V program in file.v. You can add arguments for the V program *after* the file name.
|
||||||
build <module> Compile a module into an object file.
|
build <module> Compile a module into an object file.
|
||||||
|
self Self-compile V from local source files.
|
||||||
repl Run the V REPL. If V is running in a tty terminal, the REPL is interactive, otherwise it just reads from stdin.
|
repl Run the V REPL. If V is running in a tty terminal, the REPL is interactive, otherwise it just reads from stdin.
|
||||||
symlink Useful on Unix systems. Symlinks the current V executable to /usr/local/bin/v, so that V is globally available.
|
symlink Useful on Unix systems. Symlinks the current V executable to /usr/local/bin/v, so that V is globally available.
|
||||||
test-compiler Run all V test files, and compile all V examples.
|
test-compiler Run all V test files, and compile all V examples.
|
||||||
|
|
Loading…
Reference in New Issue