@@ -98,9 +98,10 @@ impl FilterFactory for BuildFilterFactory {
98
98
filterers. push ( Box :: new ( manifest_filterer) ) ;
99
99
100
100
for ( cid, c) in & manifest. components {
101
- let build_globs = create_source_globs ( cid. as_ref ( ) , c) ;
102
- let build_filterer = globset_filter ( manifest_dir, build_globs) . await ?;
103
- filterers. push ( Box :: new ( build_filterer) ) ;
101
+ if let Some ( build_globs) = create_source_globs ( cid. as_ref ( ) , c) {
102
+ let build_filterer = globset_filter ( manifest_dir, build_globs) . await ?;
103
+ filterers. push ( Box :: new ( build_filterer) ) ;
104
+ }
104
105
}
105
106
106
107
let filterer = CompositeFilterer { filterers } ;
@@ -109,17 +110,15 @@ impl FilterFactory for BuildFilterFactory {
109
110
}
110
111
}
111
112
112
- fn create_source_globs ( cid : & str , c : & v2:: Component ) -> Vec < String > {
113
- let Some ( build) = & c. build else {
114
- return vec ! [ ] ;
115
- } ;
113
+ fn create_source_globs ( cid : & str , c : & v2:: Component ) -> Option < Vec < String > > {
114
+ let build = c. build . as_ref ( ) ?;
116
115
if build. watch . is_empty ( ) {
117
116
eprintln ! (
118
117
"You haven't configured what to watch for the component: '{cid}'. Learn how to configure Spin watch at https://developer.fermyon.com/common/cli-reference#watch"
119
118
) ;
120
- return vec ! [ ] ;
119
+ return None ;
121
120
} ;
122
- build
121
+ let globs = build
123
122
. workdir
124
123
. as_deref ( )
125
124
. map ( |workdir| {
@@ -129,7 +128,13 @@ fn create_source_globs(cid: &str, c: &v2::Component) -> Vec<String> {
129
128
. filter_map ( |w| Path :: new ( workdir) . join ( w) . to_str ( ) . map ( String :: from) )
130
129
. collect ( )
131
130
} )
132
- . unwrap_or_else ( || build. watch . clone ( ) )
131
+ . unwrap_or_else ( || build. watch . clone ( ) ) ;
132
+ if globs. is_empty ( ) {
133
+ // watchexec misinterprets empty list as "match all"
134
+ None
135
+ } else {
136
+ Some ( globs)
137
+ }
133
138
}
134
139
135
140
#[ async_trait]
0 commit comments