tools: remove import v.pref, just for pref.vexe_path(), to compile tools faster (#17411)

This commit is contained in:
Delyan Angelov 2023-02-26 07:56:14 +02:00 committed by GitHub
parent 45d4849b0f
commit 9c511e03f6
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
9 changed files with 13 additions and 20 deletions

View file

@ -40,7 +40,7 @@ mut:
} }
fn main() { fn main() {
vexe := pref.vexe_path() vexe := os.real_path(os.getenv_opt('VEXE') or { @VEXE })
vroot := os.dir(vexe) vroot := os.dir(vexe)
util.set_vroot_folder(vroot) util.set_vroot_folder(vroot)
os.chdir(vroot)! os.chdir(vroot)!

View file

@ -8,14 +8,13 @@ import strings
import sync import sync
import runtime import runtime
import v.doc import v.doc
import v.pref
import v.vmod import v.vmod
import json import json
import term import term
const ( const (
allowed_formats = ['md', 'markdown', 'json', 'text', 'stdout', 'html', 'htm'] allowed_formats = ['md', 'markdown', 'json', 'text', 'stdout', 'html', 'htm']
vexe = pref.vexe_path() vexe = os.getenv_opt('VEXE') or { @VEXE }
vroot = os.dir(vexe) vroot = os.dir(vexe)
tabs = ['\t\t', '\t\t\t\t\t\t', '\t\t\t\t\t\t\t'] tabs = ['\t\t', '\t\t\t\t\t\t', '\t\t\t\t\t\t\t']
) )

View file

@ -1,7 +1,6 @@
module main module main
import os import os
import v.pref
const freetype_repo_url = 'https://github.com/ubawurinna/freetype-windows-binaries' const freetype_repo_url = 'https://github.com/ubawurinna/freetype-windows-binaries'
@ -10,7 +9,7 @@ const freetype_folder = os.join_path('thirdparty', 'freetype')
fn main() { fn main() {
$if windows { $if windows {
println('Setup freetype...') println('Setup freetype...')
vroot := os.dir(pref.vexe_path()) vroot := os.dir(os.real_path(os.getenv_opt('VEXE') or { @VEXE }))
os.chdir(vroot)! os.chdir(vroot)!
if os.is_dir(freetype_folder) { if os.is_dir(freetype_folder) {
println('Thirdparty "freetype" is already installed.') println('Thirdparty "freetype" is already installed.')

View file

@ -1,5 +1,4 @@
import os import os
import v.pref
$if windows { $if windows {
$if tinyc { $if tinyc {
@ -15,11 +14,9 @@ fn main() {
print('usage: v symlink [OPTIONS]') print('usage: v symlink [OPTIONS]')
exit(1) exit(1)
} }
vexe := os.real_path(os.getenv_opt('VEXE') or { @VEXE })
ci_mode := '-githubci' in os.args if '-githubci' in os.args {
vexe := os.real_path(pref.vexe_path())
if ci_mode {
setup_symlink_github() setup_symlink_github()
} else { } else {
$if windows { $if windows {

View file

@ -7,7 +7,7 @@ import v.ast
import v.pref import v.pref
const ( const (
vexe = pref.vexe_path() vexe = os.real_path(os.getenv_opt('VEXE') or { @VEXE })
vroot = os.dir(vexe) vroot = os.dir(vexe)
support_color = term.can_show_color_on_stderr() && term.can_show_color_on_stdout() support_color = term.can_show_color_on_stderr() && term.can_show_color_on_stdout()
ecode_timeout = 101 ecode_timeout = 101

View file

@ -2,7 +2,6 @@ module main
import os import os
import testing import testing
import v.pref
const github_job = os.getenv('GITHUB_JOB') const github_job = os.getenv('GITHUB_JOB')
@ -292,7 +291,7 @@ const (
// Note: musl misses openssl, thus the http tests can not be done there // Note: musl misses openssl, thus the http tests can not be done there
// Note: http_httpbin_test.v: fails with 'cgen error: json: map_string_string is not struct' // Note: http_httpbin_test.v: fails with 'cgen error: json: map_string_string is not struct'
fn main() { fn main() {
vexe := pref.vexe_path() vexe := os.real_path(os.getenv_opt('VEXE') or { @VEXE })
vroot := os.dir(vexe) vroot := os.dir(vexe)
os.chdir(vroot) or { panic(err) } os.chdir(vroot) or { panic(err) }
args := os.args.clone() args := os.args.clone()

View file

@ -1,10 +1,9 @@
module main module main
import os import os
import v.pref
fn main() { fn main() {
vexe := pref.vexe_path() vexe := os.real_path(os.getenv_opt('VEXE') or { @VEXE })
vroot := os.dir(vexe) vroot := os.dir(vexe)
os.chdir(vroot)! os.chdir(vroot)!
os.setenv('VCOLORS', 'always', true) os.setenv('VCOLORS', 'always', true)

View file

@ -1,10 +1,13 @@
module main module main
import os import os
import v.pref
import v.util.version import v.util.version
import v.util.recompilation import v.util.recompilation
const vexe = os.real_path(os.getenv_opt('VEXE') or { @VEXE })
const vroot = os.dir(vexe)
struct App { struct App {
is_verbose bool is_verbose bool
is_prod bool is_prod bool
@ -13,8 +16,6 @@ struct App {
} }
fn new_app() App { fn new_app() App {
vexe := os.real_path(pref.vexe_path())
vroot := os.dir(vexe)
return App{ return App{
is_verbose: '-v' in os.args is_verbose: '-v' in os.args
is_prod: '-prod' in os.args is_prod: '-prod' in os.args

View file

@ -2,7 +2,6 @@ module main
import os import os
import term import term
import v.pref
import os.cmdline import os.cmdline
// Symbol type to search // Symbol type to search
@ -56,7 +55,7 @@ const (
'yes': .yes 'yes': .yes
'not': .not 'not': .not
} }
vexe = pref.vexe_path() vexe = os.real_path(os.getenv_opt('VEXE') or { @VEXE })
vlib_dir = os.join_path(os.dir(vexe), 'vlib') vlib_dir = os.join_path(os.dir(vexe), 'vlib')
vmod_dir = os.vmodules_dir() vmod_dir = os.vmodules_dir()
vmod_paths = os.vmodules_paths()[1..] vmod_paths = os.vmodules_paths()[1..]