v -watch: support for VWATCH_ADD_FILES
parent
a0963f4d74
commit
c44ec9cd97
|
@ -76,6 +76,7 @@ mut:
|
|||
v_cycles int // how many times the worker has restarted the V compiler
|
||||
scan_cycles int // how many times the worker has scanned for source file changes
|
||||
clear_terminal bool // whether to clear the terminal before each re-run
|
||||
add_files []string // path to additional files that have to be watched for changes
|
||||
}
|
||||
|
||||
[if debug_vwatch]
|
||||
|
@ -95,14 +96,18 @@ fn (mut context Context) get_stats_for_affected_vfiles() []VFileStat {
|
|||
copts := context.opts.join(' ')
|
||||
cmd := '"$context.vexe" -silent -print-v-files $copts'
|
||||
// context.elog('> cmd: $cmd')
|
||||
mut vfiles := os.execute(cmd)
|
||||
mut paths := []string{}
|
||||
if context.add_files.len > 0 && context.add_files[0] != '' {
|
||||
paths << context.add_files
|
||||
}
|
||||
vfiles := os.execute(cmd)
|
||||
if vfiles.exit_code == 0 {
|
||||
paths_trimmed := vfiles.output.trim_space()
|
||||
mut paths := paths_trimmed.split('\n')
|
||||
paths << paths_trimmed.split('\n')
|
||||
}
|
||||
for vf in paths {
|
||||
apaths[os.real_path(os.dir(vf))] = true
|
||||
}
|
||||
}
|
||||
context.affected_paths = apaths.keys()
|
||||
// context.elog('vfiles paths to be scanned: $context.affected_paths')
|
||||
}
|
||||
|
@ -252,6 +257,7 @@ fn main() {
|
|||
context.vexe = os.getenv('VEXE')
|
||||
context.is_worker = os.args.contains('-vwatchworker')
|
||||
context.clear_terminal = os.getenv('VWATCH_CLEAR_TERMINAL') != ''
|
||||
context.add_files = os.getenv('VWATCH_ADD_FILES').split(',')
|
||||
context.opts = os.args[1..].filter(it != '-vwatchworker')
|
||||
context.elog('>>> context.pid: $context.pid')
|
||||
context.elog('>>> context.vexe: $context.vexe')
|
||||
|
|
Loading…
Reference in New Issue