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

compiler: allow passing options to v run

This commit is contained in:
Delyan Angelov 2019-08-27 21:08:54 +03:00 committed by Alexander Medvednikov
parent 96747187b4
commit 2d87fea074
4 changed files with 22 additions and 14 deletions

View File

@ -39,14 +39,15 @@ script:
- |
if [[ "${TRAVIS_OS_NAME}" == "windows" ]]; then
git clone --depth=1 https://github.com/ubawurinna/freetype-windows-binaries thirdparty/freetype/
##echo "Just running ./make.bat to produce v.exe"
##./make.bat
echo "Just running ./make.bat to produce v.exe"
./make.bat
ls -la v.exe
echo "Running v test v..."
./v.exe test v
##echo "Running only the repl tests directly"
##./v.exe ./compiler/tests/repl/repl_test.v
echo "Testing msvc bootstrapping"
./make_msvc.bat
echo "Running v test v..."
v.exe test v
fi
- |
if [[ "${TRAVIS_OS_NAME}" != "windows" ]]; then

View File

@ -616,7 +616,11 @@ fn (v mut V) add_v_files_to_compile() {
}
fn get_arg(joined_args, arg, def string) string {
key := '-$arg '
return get_all_after(joined_args, '-$arg', def)
}
fn get_all_after(joined_args, arg, def string) string {
key := '$arg '
mut pos := joined_args.index(key)
if pos == -1 {
return def
@ -648,17 +652,18 @@ fn (v &V) log(s string) {
}
fn new_v(args[]string) *V {
mut dir := args.last()
if args.contains('run') {
dir = args[2]
}
// println('new compiler "$dir"')
if args.len < 2 {
dir = ''
}
joined_args := args.join(' ')
target_os := get_arg(joined_args, 'os', '')
mut out_name := get_arg(joined_args, 'o', 'a.out')
mut dir := args.last()
if args.contains('run') {
dir = get_all_after(joined_args, 'run', '')
}
if args.len < 2 {
dir = ''
}
// println('new compiler "$dir"')
// build mode
mut build_mode := BuildMode.default_mode
mut mod := ''

View File

@ -1,4 +1,5 @@
rd /s /q vc
git version
git clone --depth 1 --quiet https://github.com/vlang/vc
gcc -std=gnu11 -DUNICODE -D_UNICODE -w -o v2.exe vc/v_win.c
v2.exe -o v.exe compiler

View File

@ -28,11 +28,12 @@ if %ERRORLEVEL% GEQ 1 (
echo rebuild from source
v2.exe -os msvc -o v.exe compiler
if %ERRORLEVEL% GEQ 1 (
goto :compileerror
)
dir v_win.c v2.exe v.exe
del .v_win.c.obj
del v_win.c
del v2.exe