mirror of
https://github.com/vlang/v.git
synced 2025-09-13 22:42:26 +03:00
tools: support v run cmd/tools/oldv.v --show_VC_commit weekly.2024.03
This commit is contained in:
parent
66ba112726
commit
20fd795b64
2 changed files with 18 additions and 3 deletions
|
@ -137,12 +137,14 @@ pub mut:
|
|||
vexepath string // the full absolute path to the prepared v/v.exe
|
||||
vvlocation string // v.v or compiler/ or cmd/v, depending on v version
|
||||
make_fresh_tcc bool // whether to do 'make fresh_tcc' before compiling an old V.
|
||||
show_vccommit bool // show the V and VC commits, corresponding to the V commit-ish, that can be used to build V
|
||||
}
|
||||
|
||||
pub fn (mut vgit_context VGitContext) compile_oldv_if_needed() {
|
||||
vgit_context.vexename = if os.user_os() == 'windows' { 'v.exe' } else { 'v' }
|
||||
vgit_context.vexepath = os.real_path(os.join_path_single(vgit_context.path_v, vgit_context.vexename))
|
||||
if os.is_dir(vgit_context.path_v) && os.is_executable(vgit_context.vexepath) {
|
||||
if os.is_dir(vgit_context.path_v) && os.is_executable(vgit_context.vexepath)
|
||||
&& !vgit_context.show_vccommit {
|
||||
// already compiled, no need to compile that specific v executable again
|
||||
vgit_context.commit_v__hash = get_current_folder_commit_hash()
|
||||
return
|
||||
|
@ -152,7 +154,8 @@ pub fn (mut vgit_context VGitContext) compile_oldv_if_needed() {
|
|||
clone_or_pull(vgit_context.vc_repo_url, vgit_context.path_vc)
|
||||
scripting.chdir(vgit_context.path_v)
|
||||
scripting.run('git checkout --quiet ${vgit_context.commit_v}')
|
||||
if os.is_dir(vgit_context.path_v) && os.exists(vgit_context.vexepath) {
|
||||
if os.is_dir(vgit_context.path_v) && os.exists(vgit_context.vexepath)
|
||||
&& !vgit_context.show_vccommit {
|
||||
// already compiled, so no need to compile v again
|
||||
vgit_context.commit_v__hash = get_current_folder_commit_hash()
|
||||
return
|
||||
|
@ -162,6 +165,13 @@ pub fn (mut vgit_context VGitContext) compile_oldv_if_needed() {
|
|||
vgit_context.commit_v__hash = v_commithash
|
||||
vgit_context.commit_v__ts = v_timestamp
|
||||
vgit_context.commit_vc_hash = vccommit_before
|
||||
|
||||
if vgit_context.show_vccommit {
|
||||
println('VHASH=${vgit_context.commit_v__hash}')
|
||||
println('VCHASH=${vgit_context.commit_vc_hash}')
|
||||
exit(0)
|
||||
}
|
||||
|
||||
if os.exists('cmd/v') {
|
||||
vgit_context.vvlocation = 'cmd/v'
|
||||
} else {
|
||||
|
|
|
@ -39,6 +39,7 @@ mut:
|
|||
use_cache bool // use local cached copies for --vrepo and --vcrepo in
|
||||
fresh_tcc bool // do use `make fresh_tcc`
|
||||
is_bisect bool // bisect mode; usage: `cmd/tools/oldv -b -c './v run bug.v'`
|
||||
show_vccommit bool // show the V and VC commits, corresponding to the V commit-ish, that can be used to build V
|
||||
}
|
||||
|
||||
fn (mut c Context) compile_oldv_if_needed() {
|
||||
|
@ -51,6 +52,7 @@ fn (mut c Context) compile_oldv_if_needed() {
|
|||
path_v: c.path_v
|
||||
path_vc: c.path_vc
|
||||
make_fresh_tcc: c.fresh_tcc
|
||||
show_vccommit: c.show_vccommit
|
||||
}
|
||||
c.vgcontext.compile_oldv_if_needed()
|
||||
c.commit_v_hash = c.vgcontext.commit_v__hash
|
||||
|
@ -133,6 +135,7 @@ fn main() {
|
|||
context.cleanup = fp.bool('clean', 0, false, 'Clean before running (slower).')
|
||||
context.fresh_tcc = fp.bool('fresh_tcc', 0, true, 'Do `make fresh_tcc` when preparing a V compiler.')
|
||||
context.cmd_to_run = fp.string('command', `c`, '', 'Command to run in the old V repo.\n')
|
||||
context.show_vccommit = fp.bool('show_VC_commit', 0, false, 'Show the VC commit, that can be used to compile the given V commit, and exit.\n')
|
||||
commits := vgit.add_common_tool_options(mut context.vgo, mut fp)
|
||||
if should_sync {
|
||||
sync_cache()
|
||||
|
@ -152,7 +155,9 @@ fn main() {
|
|||
} else {
|
||||
context.commit_v = scripting.run('git rev-list -n1 HEAD')
|
||||
}
|
||||
scripting.cprintln('################# context.commit_v: ${context.commit_v} #####################')
|
||||
if !context.show_vccommit {
|
||||
scripting.cprintln('################# context.commit_v: ${context.commit_v} #####################')
|
||||
}
|
||||
context.path_v = vgit.normalized_workpath_for_commit(context.vgo.workdir, context.commit_v)
|
||||
context.path_vc = vgit.normalized_workpath_for_commit(context.vgo.workdir, 'vc')
|
||||
if !os.is_dir(context.vgo.workdir) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue