File tree Expand file tree Collapse file tree 9 files changed +37
-26
lines changed Expand file tree Collapse file tree 9 files changed +37
-26
lines changed Original file line number Diff line number Diff line change @@ -11,22 +11,22 @@ doctest = false
1111
1212[[bin ]]
1313name = " bootstrap"
14- path = " src/bins /main.rs"
14+ path = " src/bin /main.rs"
1515test = false
1616
1717[[bin ]]
1818name = " rustc"
19- path = " src/bins /rustc.rs"
19+ path = " src/bin /rustc.rs"
2020test = false
2121
2222[[bin ]]
2323name = " rustdoc"
24- path = " src/bins /rustdoc.rs"
24+ path = " src/bin /rustdoc.rs"
2525test = false
2626
2727[[bin ]]
2828name = " sccache-plus-cl"
29- path = " src/bins /sccache-plus-cl.rs"
29+ path = " src/bin /sccache-plus-cl.rs"
3030test = false
3131
3232[dependencies ]
File renamed without changes.
Original file line number Diff line number Diff line change 1515//! switching compilers for the bootstrap and for build scripts will probably
1616//! never get replaced.
1717
18- include ! ( "../utils/dylib_util.rs" ) ;
19- include ! ( "./_helper.rs" ) ;
20-
2118use std:: env;
2219use std:: path:: PathBuf ;
23- use std:: process:: { exit , Child , Command } ;
20+ use std:: process:: { Child , Command } ;
2421use std:: time:: Instant ;
2522
23+ use dylib_util:: { dylib_path, dylib_path_var} ;
24+
25+ #[ path = "../utils/bin_helpers.rs" ]
26+ mod bin_helpers;
27+
28+ #[ path = "../utils/dylib_util.rs" ]
29+ mod dylib_util;
30+
2631fn main ( ) {
2732 let args = env:: args_os ( ) . skip ( 1 ) . collect :: < Vec < _ > > ( ) ;
2833 let arg = |name| args. windows ( 2 ) . find ( |args| args[ 0 ] == name) . and_then ( |args| args[ 1 ] . to_str ( ) ) ;
2934
30- let stage = parse_rustc_stage ( ) ;
31- let verbose = parse_rustc_verbose ( ) ;
35+ let stage = bin_helpers :: parse_rustc_stage ( ) ;
36+ let verbose = bin_helpers :: parse_rustc_verbose ( ) ;
3237
3338 // Detect whether or not we're a build script depending on whether --target
3439 // is passed (a bit janky...)
Original file line number Diff line number Diff line change 55use std:: env;
66use std:: ffi:: OsString ;
77use std:: path:: PathBuf ;
8- use std:: process:: { exit , Command } ;
8+ use std:: process:: Command ;
99
10- include ! ( "../utils/ dylib_util.rs" ) ;
10+ use dylib_util:: { dylib_path , dylib_path_var } ;
1111
12- include ! ( "./_helper.rs" ) ;
12+ #[ path = "../utils/bin_helpers.rs" ]
13+ mod bin_helpers;
14+
15+ #[ path = "../utils/dylib_util.rs" ]
16+ mod dylib_util;
1317
1418fn main ( ) {
1519 let args = env:: args_os ( ) . skip ( 1 ) . collect :: < Vec < _ > > ( ) ;
1620
17- let stage = parse_rustc_stage ( ) ;
18- let verbose = parse_rustc_verbose ( ) ;
21+ let stage = bin_helpers :: parse_rustc_stage ( ) ;
22+ let verbose = bin_helpers :: parse_rustc_verbose ( ) ;
1923
2024 let rustdoc = env:: var_os ( "RUSTDOC_REAL" ) . expect ( "RUSTDOC_REAL was not set" ) ;
2125 let libdir = env:: var_os ( "RUSTDOC_LIBDIR" ) . expect ( "RUSTDOC_LIBDIR was not set" ) ;
File renamed without changes.
Original file line number Diff line number Diff line change 1+ //! This file is meant to be included directly from bootstrap shims to avoid a
2+ //! dependency on the bootstrap library. This reduces the binary size and
3+ //! improves compilation time by reducing the linking time.
4+
15/// Parses the value of the "RUSTC_VERBOSE" environment variable and returns it as a `usize`.
26/// If it was not defined, returns 0 by default.
37///
48/// Panics if "RUSTC_VERBOSE" is defined with the value that is not an unsigned integer.
5- fn parse_rustc_verbose ( ) -> usize {
9+ pub ( crate ) fn parse_rustc_verbose ( ) -> usize {
610 use std:: str:: FromStr ;
711
812 match std:: env:: var ( "RUSTC_VERBOSE" ) {
@@ -14,11 +18,11 @@ fn parse_rustc_verbose() -> usize {
1418/// Parses the value of the "RUSTC_STAGE" environment variable and returns it as a `String`.
1519///
1620/// If "RUSTC_STAGE" was not set, the program will be terminated with 101.
17- fn parse_rustc_stage ( ) -> String {
21+ pub ( crate ) fn parse_rustc_stage ( ) -> String {
1822 std:: env:: var ( "RUSTC_STAGE" ) . unwrap_or_else ( |_| {
1923 // Don't panic here; it's reasonable to try and run these shims directly. Give a helpful error instead.
2024 eprintln ! ( "rustc shim: fatal: RUSTC_STAGE was not set" ) ;
2125 eprintln ! ( "rustc shim: note: use `x.py build -vvv` to see all environment variables set by bootstrap" ) ;
22- exit ( 101 ) ;
26+ std :: process :: exit ( 101 ) ;
2327 } )
2428}
Original file line number Diff line number Diff line change 1- // Various utilities for working with dylib paths.
2- //
3- // This file is meant to be included directly to avoid a dependency on the bootstrap library from
4- // the rustc and rustdoc wrappers. This improves compilation time by reducing the linking time.
1+ //! Various utilities for working with dylib paths.
52
63/// Returns the environment variable which the dynamic library lookup path
74/// resides in for this platform.
@@ -21,10 +18,10 @@ pub fn dylib_path_var() -> &'static str {
2118
2219/// Parses the `dylib_path_var()` environment variable, returning a list of
2320/// paths that are members of this lookup path.
24- pub fn dylib_path ( ) -> Vec < PathBuf > {
25- let var = match env:: var_os ( dylib_path_var ( ) ) {
21+ pub fn dylib_path ( ) -> Vec < std :: path :: PathBuf > {
22+ let var = match std :: env:: var_os ( dylib_path_var ( ) ) {
2623 Some ( v) => v,
2724 None => return vec ! [ ] ,
2825 } ;
29- env:: split_paths ( & var) . collect ( )
26+ std :: env:: split_paths ( & var) . collect ( )
3027}
Original file line number Diff line number Diff line change @@ -16,7 +16,7 @@ use crate::core::builder::Builder;
1616use crate :: core:: config:: { Config , TargetSelection } ;
1717use crate :: OnceCell ;
1818
19- include ! ( " dylib_util.rs" ) ;
19+ pub use crate :: utils :: dylib_util:: { dylib_path , dylib_path_var } ;
2020
2121/// A helper macro to `unwrap` a result except also print out details like:
2222///
Original file line number Diff line number Diff line change 55pub ( crate ) mod cache;
66pub ( crate ) mod cc_detect;
77pub ( crate ) mod channel;
8+ pub ( crate ) mod dylib_util;
89pub ( crate ) mod helpers;
910pub ( crate ) mod job;
1011#[ cfg( feature = "build-metrics" ) ]
You can’t perform that action at this time.
0 commit comments