Skip to content

Commit 48376e4

Browse files
committed
v.builder: make it easier to reproduce the exact specific stages of -usecache module compilation by logging the full CLI options for each
1 parent 974ff54 commit 48376e4

File tree

2 files changed

+12
-6
lines changed

2 files changed

+12
-6
lines changed

vlib/v/builder/cc.v

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -612,11 +612,10 @@ fn (mut v Builder) setup_output_name() {
612612
if v.pref.is_verbose {
613613
println('Building ${v.pref.path} to ${v.pref.out_name} ...')
614614
}
615-
v.pref.cache_manager.mod_save(v.pref.path, '.description.txt', v.pref.path, '${v.pref.path:-30} @ ${v.pref.cache_manager.vopts}\n') or {
615+
v.pref.cache_manager.mod_save(v.pref.path, '.output.description.txt', v.pref.path,
616+
get_dsc_content('PREF.PATH: ${v.pref.path}\nVOPTS: ${v.pref.cache_manager.vopts}\n')) or {
616617
panic(err)
617618
}
618-
// println('v.ast.imports:')
619-
// println(v.ast.imports)
620619
}
621620
if os.is_dir(v.pref.out_name) {
622621
verror('${os.quoted_path(v.pref.out_name)} is a directory')
@@ -1253,7 +1252,7 @@ fn (mut v Builder) build_thirdparty_obj_file(mod string, path string, moduleflag
12531252
verror(res.output)
12541253
return
12551254
}
1256-
v.pref.cache_manager.mod_save(mod, '.description.txt', obj_path, '${obj_path:-30} @ ${cmd}\n') or {
1255+
v.pref.cache_manager.mod_save(mod, '.thirdparty.description.txt', obj_path, get_dsc_content('OBJ_PATH: ${obj_path}\nCMD: ${cmd}\n')) or {
12571256
panic(err)
12581257
}
12591258
if v.pref.show_cc {
@@ -1330,3 +1329,10 @@ fn write_response_file(response_file string, response_file_content string) {
13301329
fn write_response_file_error(response_file string, err IError) {
13311330
verror('Unable to write to C response file "${response_file}", error: ${err}')
13321331
}
1332+
1333+
fn get_dsc_content(suffix string) string {
1334+
vargs := os.args.join(' ')
1335+
vjobs := os.getenv('VJOBS')
1336+
vflags := os.getenv('VFLAGS')
1337+
return 'CLI: ${vargs}\nVFLAGS="${vflags}"\nVJOBS=${vjobs}\n${suffix}'
1338+
}

vlib/v/vcache/vcache.v

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,11 @@ import hash
1616
// │ ├── README.md <-- a short description of the folder's purpose.
1717
// │ ├── 0f
1818
// │ │ ├── 0f004f983ab9c487b0d7c1a0a73840a5.txt
19-
// │ │ ├── 0f599edf5e16c2756fbcdd4c865087ac.description.txt <-- build details
19+
// │ │ ├── 0f599edf5e16c2756fbcdd4c865087ac.output.description.txt <-- build details
2020
// │ │ └── 0f599edf5e16c2756fbcdd4c865087ac.vh
2121
// │ ├── 29
2222
// │ │ ├── 294717dd02a1cca5f2a0393fca2c5c22.o
23-
// │ │ └── 294717dd02a1cca5f2a0393fca2c5c22.description.txt <-- build details
23+
// │ │ └── 294717dd02a1cca5f2a0393fca2c5c22.output.description.txt <-- build details
2424
// │ ├── 62
2525
// │ │ └── 620d60d6b81fdcb3cab030a37fd86996.h
2626
// │ └── 76

0 commit comments

Comments
 (0)