@@ -83,6 +83,12 @@ pub trait Executor: Send + Sync + 'static {
83
83
cmd. exec_with_streaming ( handle_stdout, handle_stderr, false ) ?;
84
84
Ok ( ( ) )
85
85
}
86
+
87
+ /// Queried when queuing each unit of work. If it returns true, then the
88
+ /// unit will always be rebuilt, independent of whether it needs to be.
89
+ fn force_rebuild ( & self , _unit : & Unit ) -> bool {
90
+ false
91
+ }
86
92
}
87
93
88
94
/// A DefaultExecutor calls rustc without doing anything else. It is Cargo's
@@ -230,7 +236,7 @@ fn compile<'a, 'cfg: 'a>(cx: &mut Context<'a, 'cfg>,
230
236
// we run these targets later, so this is just a noop for now
231
237
( Work :: new ( |_| Ok ( ( ) ) ) , Work :: new ( |_| Ok ( ( ) ) ) , Freshness :: Fresh )
232
238
} else {
233
- let ( freshness, dirty, fresh) = fingerprint:: prepare_target ( cx, unit) ?;
239
+ let ( mut freshness, dirty, fresh) = fingerprint:: prepare_target ( cx, unit) ?;
234
240
let work = if unit. profile . doc {
235
241
rustdoc ( cx, unit) ?
236
242
} else {
@@ -239,6 +245,11 @@ fn compile<'a, 'cfg: 'a>(cx: &mut Context<'a, 'cfg>,
239
245
// Need to link targets on both the dirty and fresh
240
246
let dirty = work. then ( link_targets ( cx, unit, false ) ?) . then ( dirty) ;
241
247
let fresh = link_targets ( cx, unit, true ) ?. then ( fresh) ;
248
+
249
+ if exec. force_rebuild ( unit) {
250
+ freshness = Freshness :: Dirty ;
251
+ }
252
+
242
253
( dirty, fresh, freshness)
243
254
} ;
244
255
jobs. enqueue ( cx, unit, Job :: new ( dirty, fresh) , freshness) ?;
0 commit comments