@@ -180,50 +180,55 @@ fn compile<'gctx>(
180
180
return Ok ( ( ) ) ;
181
181
}
182
182
183
- // Build up the work to be done to compile this unit, enqueuing it once
184
- // we've got everything constructed.
185
- fingerprint:: prepare_init ( build_runner, unit) ?;
186
-
187
- let job = if unit. mode . is_run_custom_build ( ) {
188
- custom_build:: prepare ( build_runner, unit) ?
189
- } else if unit. mode . is_doc_test ( ) {
190
- // We run these targets later, so this is just a no-op for now.
191
- Job :: new_fresh ( )
192
- } else if build_plan {
193
- Job :: new_dirty (
194
- rustc ( build_runner, unit, & exec. clone ( ) ) ?,
195
- DirtyReason :: FreshBuild ,
196
- )
197
- } else {
198
- let force = exec. force_rebuild ( unit) || force_rebuild;
199
- let mut job = fingerprint:: prepare_target ( build_runner, unit, force) ?;
200
- job. before ( if job. freshness ( ) . is_dirty ( ) {
201
- let work = if unit. mode . is_doc ( ) || unit. mode . is_doc_scrape ( ) {
202
- rustdoc ( build_runner, unit) ?
203
- } else {
204
- rustc ( build_runner, unit, exec) ?
205
- } ;
206
- work. then ( link_targets ( build_runner, unit, false ) ?)
183
+ // If we are in `--compile-time-deps` and the given unit is not a compile time
184
+ // dependency, skip compling the unit and jumps to dependencies, which still
185
+ // have chances to be compile time dependencies
186
+ if !unit. skip_non_compile_time_dep {
187
+ // Build up the work to be done to compile this unit, enqueuing it once
188
+ // we've got everything constructed.
189
+ fingerprint:: prepare_init ( build_runner, unit) ?;
190
+
191
+ let job = if unit. mode . is_run_custom_build ( ) {
192
+ custom_build:: prepare ( build_runner, unit) ?
193
+ } else if unit. mode . is_doc_test ( ) {
194
+ // We run these targets later, so this is just a no-op for now.
195
+ Job :: new_fresh ( )
196
+ } else if build_plan {
197
+ Job :: new_dirty (
198
+ rustc ( build_runner, unit, & exec. clone ( ) ) ?,
199
+ DirtyReason :: FreshBuild ,
200
+ )
207
201
} else {
208
- // We always replay the output cache,
209
- // since it might contain future-incompat-report messages
210
- let show_diagnostics = unit. show_warnings ( bcx. gctx )
211
- && build_runner. bcx . gctx . warning_handling ( ) ? != WarningHandling :: Allow ;
212
- let work = replay_output_cache (
213
- unit. pkg . package_id ( ) ,
214
- PathBuf :: from ( unit. pkg . manifest_path ( ) ) ,
215
- & unit. target ,
216
- build_runner. files ( ) . message_cache_path ( unit) ,
217
- build_runner. bcx . build_config . message_format ,
218
- show_diagnostics,
219
- ) ;
220
- // Need to link targets on both the dirty and fresh.
221
- work. then ( link_targets ( build_runner, unit, true ) ?)
222
- } ) ;
223
-
224
- job
225
- } ;
226
- jobs. enqueue ( build_runner, unit, job) ?;
202
+ let force = exec. force_rebuild ( unit) || force_rebuild;
203
+ let mut job = fingerprint:: prepare_target ( build_runner, unit, force) ?;
204
+ job. before ( if job. freshness ( ) . is_dirty ( ) {
205
+ let work = if unit. mode . is_doc ( ) || unit. mode . is_doc_scrape ( ) {
206
+ rustdoc ( build_runner, unit) ?
207
+ } else {
208
+ rustc ( build_runner, unit, exec) ?
209
+ } ;
210
+ work. then ( link_targets ( build_runner, unit, false ) ?)
211
+ } else {
212
+ // We always replay the output cache,
213
+ // since it might contain future-incompat-report messages
214
+ let show_diagnostics = unit. show_warnings ( bcx. gctx )
215
+ && build_runner. bcx . gctx . warning_handling ( ) ? != WarningHandling :: Allow ;
216
+ let work = replay_output_cache (
217
+ unit. pkg . package_id ( ) ,
218
+ PathBuf :: from ( unit. pkg . manifest_path ( ) ) ,
219
+ & unit. target ,
220
+ build_runner. files ( ) . message_cache_path ( unit) ,
221
+ build_runner. bcx . build_config . message_format ,
222
+ show_diagnostics,
223
+ ) ;
224
+ // Need to link targets on both the dirty and fresh.
225
+ work. then ( link_targets ( build_runner, unit, true ) ?)
226
+ } ) ;
227
+
228
+ job
229
+ } ;
230
+ jobs. enqueue ( build_runner, unit, job) ?;
231
+ }
227
232
228
233
// Be sure to compile all dependencies of this target as well.
229
234
let deps = Vec :: from ( build_runner. unit_deps ( unit) ) ; // Create vec due to mutable borrow.
0 commit comments