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

tools: make v watch webserver.v monitor files used through $tmpl as well

This commit is contained in:
Delyan Angelov
2023-04-06 00:44:52 +03:00
parent 7334f673a0
commit dce65c7f46
6 changed files with 43 additions and 19 deletions

View File

@ -112,8 +112,8 @@ fn (mut context Context) get_stats_for_affected_vfiles() []VFileStat {
// The next command will make V parse the program, and print all .v files,
// needed for its compilation, without actually compiling it.
copts := context.opts.join(' ')
cmd := '"${context.vexe}" -silent -print-v-files ${copts}'
// context.elog('> cmd: $cmd')
cmd := '"${context.vexe}" -silent -print-watched-files ${copts}'
// context.elog('> cmd: ${cmd}')
mut paths := []string{}
if context.add_files.len > 0 && context.add_files[0] != '' {
paths << context.add_files
@ -121,7 +121,11 @@ fn (mut context Context) get_stats_for_affected_vfiles() []VFileStat {
vfiles := os.execute(cmd)
if vfiles.exit_code == 0 {
paths_trimmed := vfiles.output.trim_space()
paths << paths_trimmed.split('\n')
reported_used_files := paths_trimmed.split('\n')
$if trace_reported_used_files ? {
context.elog('reported_used_files: ${reported_used_files}')
}
paths << reported_used_files
}
for vf in paths {
apaths[os.real_path(os.dir(vf))] = true