From 2c3f54ac0d398493616f6db53d10d0f1b1eb9b99 Mon Sep 17 00:00:00 2001 From: James Garbutt <43081j@users.noreply.github.com> Date: Tue, 21 Apr 2026 14:21:18 +0100 Subject: [PATCH 1/2] feat: watch sources of dependencies This changes the watch logic to watch sources of the chosen task's dependencies as well as its own sources. If you set `skip_deps`, we follow the old behaviour and only watch the task's own sources. --- src/cli/watch.rs | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/cli/watch.rs b/src/cli/watch.rs index 69652b22ec..0dba7b0c4b 100644 --- a/src/cli/watch.rs +++ b/src/cli/watch.rs @@ -5,6 +5,7 @@ use crate::cmd; use crate::config::Config; use crate::env; use crate::exit::exit; +use crate::task::Deps; use crate::toolset::ToolsetBuilder; use clap::{CommandFactory, ValueEnum, ValueHint}; use console::style; @@ -179,13 +180,18 @@ impl Watch { args.push("--watch-file".to_string()); args.push(watch_file.to_string_lossy().to_string()); } - let globs = if self.glob.is_empty() { + let globs = if !self.glob.is_empty() { + self.glob.clone() + } else if self.skip_deps { tasks .iter() .flat_map(|t| t.sources.clone()) .collect::>() } else { - self.glob.clone() + let deps = Deps::new(&config, tasks.clone()).await?; + deps.all() + .flat_map(|t| t.sources.clone()) + .collect::>() }; if !globs.is_empty() { args.push("-f".to_string()); From 5f169a64b2e3a23f015f77f5b812dd25dba0cf8a Mon Sep 17 00:00:00 2001 From: James Garbutt <43081j@users.noreply.github.com> Date: Mon, 27 Apr 2026 19:20:26 +0100 Subject: [PATCH 2/2] perf: filter out duplicate tasks and clone iter instead of full vec --- src/cli/watch.rs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/cli/watch.rs b/src/cli/watch.rs index 0dba7b0c4b..08377a3715 100644 --- a/src/cli/watch.rs +++ b/src/cli/watch.rs @@ -185,12 +185,14 @@ impl Watch { } else if self.skip_deps { tasks .iter() - .flat_map(|t| t.sources.clone()) + .flat_map(|t| t.sources.iter().cloned()) + .unique() .collect::>() } else { let deps = Deps::new(&config, tasks.clone()).await?; deps.all() - .flat_map(|t| t.sources.clone()) + .flat_map(|t| t.sources.iter().cloned()) + .unique() .collect::>() }; if !globs.is_empty() {