@@ -28,9 +28,9 @@ use std::str;
2828
2929use build_helper:: ci:: { gha, CiEnv } ;
3030use build_helper:: exit;
31- use channel:: GitInfo ;
3231use config:: { DryRun , Target } ;
3332use filetime:: FileTime ;
33+ use misc:: channel:: GitInfo ;
3434use once_cell:: sync:: OnceCell ;
3535
3636use crate :: builder:: Kind ;
@@ -40,9 +40,6 @@ use crate::util::{
4040} ;
4141
4242mod builder;
43- mod cache;
44- mod cc_detect;
45- mod channel;
4643mod check;
4744mod clean;
4845mod compile;
@@ -55,6 +52,7 @@ mod format;
5552mod install;
5653mod llvm;
5754mod metadata;
55+ pub ( crate ) mod misc;
5856mod render_tests;
5957mod run;
6058mod sanity;
@@ -70,27 +68,10 @@ pub mod util;
7068#[ cfg( feature = "build-metrics" ) ]
7169mod metrics;
7270
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-
9071pub use crate :: builder:: PathSet ;
91- use crate :: cache:: { Interned , INTERNER } ;
9272pub use crate :: config:: Config ;
9373pub use crate :: flags:: Subcommand ;
74+ use crate :: misc:: cache:: { Interned , INTERNER } ;
9475use termcolor:: { ColorChoice , StandardStream , WriteColor } ;
9576
9677const LLVM_TOOLS : & [ & str ] = & [
@@ -211,12 +192,12 @@ pub struct Build {
211192 src : PathBuf ,
212193 out : PathBuf ,
213194 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 ,
220201 local_rebuild : bool ,
221202 fail_fast : bool ,
222203 doc_tests : DocTests ,
@@ -369,16 +350,15 @@ impl Build {
369350 let is_sudo = false ;
370351
371352 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" ) ) ;
379359
380360 // 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" ) ) ;
382362
383363 let initial_target_libdir_str = if config. dry_run ( ) {
384364 "/dummy/lib/path/to/lib/" . to_string ( )
@@ -490,7 +470,7 @@ impl Build {
490470 }
491471
492472 build. verbose ( "finding compilers" ) ;
493- cc_detect:: find ( & build) ;
473+ crate :: misc :: cc_detect:: find ( & build) ;
494474 // When running `setup`, the profile is about to change, so any requirements we have now may
495475 // be different on the next invocation. Don't check for them until the next time x.py is
496476 // 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 {
546526
547527 // NOTE: The check for the empty directory is here because when running x.py the first time,
548528 // 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 ( )
550530 && !dir_is_empty ( & absolute_path)
551531 {
552532 return ;
@@ -660,7 +640,7 @@ impl Build {
660640 // Sample output: `submodule.src/rust-installer.path src/tools/rust-installer`
661641 let submodule = Path :: new ( line. splitn ( 2 , ' ' ) . nth ( 1 ) . unwrap ( ) ) ;
662642 // 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 ( ) {
664644 self . update_submodule ( submodule) ;
665645 }
666646 }
@@ -669,7 +649,7 @@ impl Build {
669649 /// Executes the entire build, as configured by the flags and configuration.
670650 pub fn build ( & mut self ) {
671651 unsafe {
672- job:: setup ( self ) ;
652+ crate :: misc :: job:: setup ( self ) ;
673653 }
674654
675655 // Download rustfmt early so that it can be used in rust-analyzer configs.
0 commit comments