@@ -18,7 +18,7 @@ use tracing::{debug, instrument, trace};
1818
1919pub struct CommandBuilder < ' task > {
2020 app : & ' task AppContext ,
21- node : & ' task ActionNode ,
21+ node : Option < & ' task ActionNode > ,
2222 project : & ' task Project ,
2323 task : & ' task Task ,
2424 working_dir : & ' task Path ,
@@ -29,12 +29,7 @@ pub struct CommandBuilder<'task> {
2929}
3030
3131impl < ' task > CommandBuilder < ' task > {
32- pub fn new (
33- app : & ' task AppContext ,
34- project : & ' task Project ,
35- task : & ' task Task ,
36- node : & ' task ActionNode ,
37- ) -> Self {
32+ pub fn new ( app : & ' task AppContext , project : & ' task Project , task : & ' task Task ) -> Self {
3833 let working_dir = if task. options . run_from_workspace_root {
3934 & app. workspace_root
4035 } else {
@@ -43,7 +38,7 @@ impl<'task> CommandBuilder<'task> {
4338
4439 Self {
4540 app,
46- node,
41+ node : None ,
4742 project,
4843 task,
4944 working_dir,
@@ -57,7 +52,14 @@ impl<'task> CommandBuilder<'task> {
5752 }
5853
5954 #[ instrument( name = "build_command" , skip_all) ]
60- pub async fn build ( mut self , context : & ActionContext , hash : & str ) -> miette:: Result < Command > {
55+ pub async fn build (
56+ mut self ,
57+ context : & ActionContext ,
58+ node : & ' task ActionNode ,
59+ hash : & str ,
60+ ) -> miette:: Result < Command > {
61+ self . node = Some ( node) ;
62+
6163 debug ! (
6264 task_target = self . task. target. as_str( ) ,
6365 working_dir = ?self . working_dir,
@@ -116,7 +118,7 @@ impl<'task> CommandBuilder<'task> {
116118 #[ instrument( skip_all) ]
117119 fn inject_args ( & mut self , context : & ActionContext ) {
118120 // Must be first!
119- if let ActionNode :: RunTask ( inner) = & self . node
121+ if let Some ( ActionNode :: RunTask ( inner) ) = & self . node
120122 && !inner. args . is_empty ( )
121123 {
122124 trace ! (
@@ -148,7 +150,7 @@ impl<'task> CommandBuilder<'task> {
148150 let mut moon_env = FxHashMap :: < String , Option < String > > :: default ( ) ;
149151
150152 // Inherit task dependent variables
151- if let ActionNode :: RunTask ( inner) = & self . node
153+ if let Some ( ActionNode :: RunTask ( inner) ) = & self . node
152154 && !inner. env . is_empty ( )
153155 {
154156 trace ! (
0 commit comments