@@ -28,9 +28,9 @@ use std::str;
28
28
29
29
use build_helper:: ci:: { gha, CiEnv } ;
30
30
use build_helper:: exit;
31
- use channel:: GitInfo ;
32
31
use config:: { DryRun , Target } ;
33
32
use filetime:: FileTime ;
33
+ use misc:: channel:: GitInfo ;
34
34
use once_cell:: sync:: OnceCell ;
35
35
36
36
use crate :: builder:: Kind ;
@@ -40,9 +40,6 @@ use crate::util::{
40
40
} ;
41
41
42
42
mod builder;
43
- mod cache;
44
- mod cc_detect;
45
- mod channel;
46
43
mod check;
47
44
mod clean;
48
45
mod compile;
@@ -55,6 +52,7 @@ mod format;
55
52
mod install;
56
53
mod llvm;
57
54
mod metadata;
55
+ pub ( crate ) mod misc;
58
56
mod render_tests;
59
57
mod run;
60
58
mod sanity;
@@ -70,27 +68,10 @@ pub mod util;
70
68
#[ cfg( feature = "build-metrics" ) ]
71
69
mod metrics;
72
70
73
- #[ cfg( windows) ]
74
- mod job;
75
-
76
- #[ cfg( all( unix, not( target_os = "haiku" ) ) ) ]
77
- mod job {
78
- pub unsafe fn setup ( build : & mut crate :: Build ) {
79
- if build. config . low_priority {
80
- libc:: setpriority ( libc:: PRIO_PGRP as _ , 0 , 10 ) ;
81
- }
82
- }
83
- }
84
-
85
- #[ cfg( any( target_os = "haiku" , target_os = "hermit" , not( any( unix, windows) ) ) ) ]
86
- mod job {
87
- pub unsafe fn setup ( _build : & mut crate :: Build ) { }
88
- }
89
-
90
71
pub use crate :: builder:: PathSet ;
91
- use crate :: cache:: { Interned , INTERNER } ;
92
72
pub use crate :: config:: Config ;
93
73
pub use crate :: flags:: Subcommand ;
74
+ use crate :: misc:: cache:: { Interned , INTERNER } ;
94
75
use termcolor:: { ColorChoice , StandardStream , WriteColor } ;
95
76
96
77
const LLVM_TOOLS : & [ & str ] = & [
@@ -211,12 +192,12 @@ pub struct Build {
211
192
src : PathBuf ,
212
193
out : PathBuf ,
213
194
bootstrap_out : PathBuf ,
214
- cargo_info : channel :: GitInfo ,
215
- rust_analyzer_info : channel :: GitInfo ,
216
- clippy_info : channel :: GitInfo ,
217
- miri_info : channel :: GitInfo ,
218
- rustfmt_info : channel :: GitInfo ,
219
- in_tree_llvm_info : channel :: GitInfo ,
195
+ cargo_info : GitInfo ,
196
+ rust_analyzer_info : GitInfo ,
197
+ clippy_info : GitInfo ,
198
+ miri_info : GitInfo ,
199
+ rustfmt_info : GitInfo ,
200
+ in_tree_llvm_info : GitInfo ,
220
201
local_rebuild : bool ,
221
202
fail_fast : bool ,
222
203
doc_tests : DocTests ,
@@ -369,16 +350,15 @@ impl Build {
369
350
let is_sudo = false ;
370
351
371
352
let omit_git_hash = config. omit_git_hash ;
372
- let rust_info = channel:: GitInfo :: new ( omit_git_hash, & src) ;
373
- let cargo_info = channel:: GitInfo :: new ( omit_git_hash, & src. join ( "src/tools/cargo" ) ) ;
374
- let rust_analyzer_info =
375
- channel:: GitInfo :: new ( omit_git_hash, & src. join ( "src/tools/rust-analyzer" ) ) ;
376
- let clippy_info = channel:: GitInfo :: new ( omit_git_hash, & src. join ( "src/tools/clippy" ) ) ;
377
- let miri_info = channel:: GitInfo :: new ( omit_git_hash, & src. join ( "src/tools/miri" ) ) ;
378
- let rustfmt_info = channel:: GitInfo :: new ( omit_git_hash, & src. join ( "src/tools/rustfmt" ) ) ;
353
+ let rust_info = GitInfo :: new ( omit_git_hash, & src) ;
354
+ let cargo_info = GitInfo :: new ( omit_git_hash, & src. join ( "src/tools/cargo" ) ) ;
355
+ let rust_analyzer_info = GitInfo :: new ( omit_git_hash, & src. join ( "src/tools/rust-analyzer" ) ) ;
356
+ let clippy_info = GitInfo :: new ( omit_git_hash, & src. join ( "src/tools/clippy" ) ) ;
357
+ let miri_info = GitInfo :: new ( omit_git_hash, & src. join ( "src/tools/miri" ) ) ;
358
+ let rustfmt_info = GitInfo :: new ( omit_git_hash, & src. join ( "src/tools/rustfmt" ) ) ;
379
359
380
360
// we always try to use git for LLVM builds
381
- let in_tree_llvm_info = channel :: GitInfo :: new ( false , & src. join ( "src/llvm-project" ) ) ;
361
+ let in_tree_llvm_info = GitInfo :: new ( false , & src. join ( "src/llvm-project" ) ) ;
382
362
383
363
let initial_target_libdir_str = if config. dry_run ( ) {
384
364
"/dummy/lib/path/to/lib/" . to_string ( )
@@ -490,7 +470,7 @@ impl Build {
490
470
}
491
471
492
472
build. verbose ( "finding compilers" ) ;
493
- cc_detect:: find ( & build) ;
473
+ crate :: misc :: cc_detect:: find ( & build) ;
494
474
// When running `setup`, the profile is about to change, so any requirements we have now may
495
475
// be different on the next invocation. Don't check for them until the next time x.py is
496
476
// run. This is ok because `setup` never runs any build commands, so it won't fail if commands are missing.
@@ -546,7 +526,7 @@ impl Build {
546
526
547
527
// NOTE: The check for the empty directory is here because when running x.py the first time,
548
528
// the submodule won't be checked out. Check it out now so we can build it.
549
- if !channel :: GitInfo :: new ( false , & absolute_path) . is_managed_git_subrepository ( )
529
+ if !GitInfo :: new ( false , & absolute_path) . is_managed_git_subrepository ( )
550
530
&& !dir_is_empty ( & absolute_path)
551
531
{
552
532
return ;
@@ -660,7 +640,7 @@ impl Build {
660
640
// Sample output: `submodule.src/rust-installer.path src/tools/rust-installer`
661
641
let submodule = Path :: new ( line. splitn ( 2 , ' ' ) . nth ( 1 ) . unwrap ( ) ) ;
662
642
// Don't update the submodule unless it's already been cloned.
663
- if channel :: GitInfo :: new ( false , submodule) . is_managed_git_subrepository ( ) {
643
+ if GitInfo :: new ( false , submodule) . is_managed_git_subrepository ( ) {
664
644
self . update_submodule ( submodule) ;
665
645
}
666
646
}
@@ -669,7 +649,7 @@ impl Build {
669
649
/// Executes the entire build, as configured by the flags and configuration.
670
650
pub fn build ( & mut self ) {
671
651
unsafe {
672
- job:: setup ( self ) ;
652
+ crate :: misc :: job:: setup ( self ) ;
673
653
}
674
654
675
655
// Download rustfmt early so that it can be used in rust-analyzer configs.
0 commit comments