pub struct Builder<'a> {
pub build: &'a Build,
pub top_stage: u32,
pub kind: Kind,
cache: Cache,
stack: RefCell<Vec<Box<dyn AnyDebug>>>,
time_spent_on_dependencies: Cell<Duration>,
pub paths: Vec<PathBuf>,
submodule_paths_cache: OnceLock<Vec<String>>,
}Expand description
Builds and performs different Self::kinds of stuff and actions, taking
into account build configuration from e.g. bootstrap.toml.
Fields§
§build: &'a BuildBuild configuration from e.g. bootstrap.toml.
top_stage: u32The stage to use. Either implicitly determined based on subcommand, or
explicitly specified with --stage N. Normally this is the stage we
use, but sometimes we want to run steps with a lower stage than this.
kind: KindWhat to build or what action to perform.
cache: CacheA cache of outputs of Steps so we can avoid running steps we already
ran.
stack: RefCell<Vec<Box<dyn AnyDebug>>>A stack of Steps to run before we can run this builder. The output
of steps is cached in Self::cache.
time_spent_on_dependencies: Cell<Duration>The total amount of time we spent running Steps in Self::stack.
paths: Vec<PathBuf>The paths passed on the command line. Used by steps to figure out what
to do. For example: with ./x check foo bar we get paths=["foo", "bar"].
submodule_paths_cache: OnceLock<Vec<String>>Cached list of submodules from self.build.src.
Implementations§
Source§impl Builder<'_>
impl Builder<'_>
pub(crate) fn msg_tool( &self, kind: Kind, mode: Mode, tool: &str, build_stage: u32, host: &TargetSelection, target: &TargetSelection, ) -> Option<Group>
Source§impl Builder<'_>
impl Builder<'_>
Sourcepub fn tool_cmd(&self, tool: Tool) -> BootstrapCommand
pub fn tool_cmd(&self, tool: Tool) -> BootstrapCommand
Gets a BootstrapCommand which is ready to run tool in stage built for
host.
Source§impl Builder<'_>
impl Builder<'_>
fn toolstates(&self) -> HashMap<Box<str>, ToolState>
Sourcepub fn save_toolstate(&self, tool: &str, state: ToolState)
pub fn save_toolstate(&self, tool: &str, state: ToolState)
Updates the actual toolstate of a tool.
The toolstates are saved to the file specified by the key
rust.save-toolstates in bootstrap.toml. If unspecified, nothing will be
done. The file is updated immediately after this function completes.
Source§impl Builder<'_>
impl Builder<'_>
Sourcepub fn bare_cargo(
&self,
compiler: Compiler,
mode: Mode,
target: TargetSelection,
cmd_kind: Kind,
) -> BootstrapCommand
pub fn bare_cargo( &self, compiler: Compiler, mode: Mode, target: TargetSelection, cmd_kind: Kind, ) -> BootstrapCommand
Like Builder::cargo, but only passes flags that are valid for all commands.
Sourcefn cargo(
&self,
compiler: Compiler,
mode: Mode,
source_type: SourceType,
target: TargetSelection,
cmd_kind: Kind,
) -> Cargo
fn cargo( &self, compiler: Compiler, mode: Mode, source_type: SourceType, target: TargetSelection, cmd_kind: Kind, ) -> Cargo
This will create a BootstrapCommand that represents a pending execution of cargo. This
cargo will be configured to use compiler as the actual rustc compiler, its output will be
scoped by mode’s output directory, it will pass the --target flag for the specified
target, and will be executing the Cargo command cmd. cmd can be miri-cmd for
commands to be run with Miri.
Source§impl<'a> Builder<'a>
impl<'a> Builder<'a>
fn get_step_descriptions(kind: Kind) -> Vec<StepDescription>
pub fn get_help(build: &Build, kind: Kind) -> Option<String>
fn new_internal(build: &Build, kind: Kind, paths: Vec<PathBuf>) -> Builder<'_>
pub fn new(build: &Build) -> Builder<'_>
pub fn execute_cli(&self)
pub fn default_doc(&self, paths: &[PathBuf])
pub fn doc_rust_lang_org_channel(&self) -> String
fn run_step_descriptions(&self, v: &[StepDescription], paths: &[PathBuf])
Sourcepub fn link_std_into_rustc_driver(&self, target: TargetSelection) -> bool
pub fn link_std_into_rustc_driver(&self, target: TargetSelection) -> bool
Returns if std should be statically linked into rustc_driver.
It’s currently not done on windows-gnu due to linker bugs.
Sourcepub fn compiler(&self, stage: u32, host: TargetSelection) -> Compiler
pub fn compiler(&self, stage: u32, host: TargetSelection) -> Compiler
Obtain a compiler at a given stage and for a given host (i.e., this is the target that the
compiler will run on, not the target it will build code for). Explicitly does not take
Compiler since all Compiler instances are meant to be obtained through this function,
since it ensures that they are valid (i.e., built and assembled).
Sourcepub fn compiler_for(
&self,
stage: u32,
host: TargetSelection,
target: TargetSelection,
) -> Compiler
pub fn compiler_for( &self, stage: u32, host: TargetSelection, target: TargetSelection, ) -> Compiler
Similar to compiler, except handles the full-bootstrap option to
silently use the stage1 compiler instead of a stage2 compiler if one is
requested.
Note that this does not have the side effect of creating
compiler(stage, host), unlike compiler above which does have such
a side effect. The returned compiler here can only be used to compile
new artifacts, it can’t be used to rely on the presence of a particular
sysroot.
See force_use_stage1 and force_use_stage2 for documentation on what each argument is.
FIXME: This function is unnecessary (and dangerous, see https://github.com/rust-lang/rust/issues/137469).
We already have uplifting logic for the compiler, so remove this.
Sourcepub fn std(&self, compiler: Compiler, target: TargetSelection)
pub fn std(&self, compiler: Compiler, target: TargetSelection)
Obtain a standard library for the given target that will be built by the passed compiler. The standard library will be linked to the sysroot of the passed compiler.
Prefer using this method rather than manually invoking Std::new.
pub fn sysroot(&self, compiler: Compiler) -> PathBuf
Sourcepub fn sysroot_target_bindir(
&self,
compiler: Compiler,
target: TargetSelection,
) -> PathBuf
pub fn sysroot_target_bindir( &self, compiler: Compiler, target: TargetSelection, ) -> PathBuf
Returns the bindir for a compiler’s sysroot.
Sourcepub fn sysroot_target_libdir(
&self,
compiler: Compiler,
target: TargetSelection,
) -> PathBuf
pub fn sysroot_target_libdir( &self, compiler: Compiler, target: TargetSelection, ) -> PathBuf
Returns the libdir where the standard library and other artifacts are found for a compiler’s sysroot.
pub fn sysroot_codegen_backends(&self, compiler: Compiler) -> PathBuf
Sourcepub fn rustc_libdir(&self, compiler: Compiler) -> PathBuf
pub fn rustc_libdir(&self, compiler: Compiler) -> PathBuf
Returns the compiler’s libdir where it stores the dynamic libraries that it itself links against.
For example this returns <sysroot>/lib on Unix and <sysroot>/bin on
Windows.
Sourcepub fn libdir_relative(&self, compiler: Compiler) -> &Path
pub fn libdir_relative(&self, compiler: Compiler) -> &Path
Returns the compiler’s relative libdir where it stores the dynamic libraries that it itself links against.
For example this returns lib on Unix and bin on
Windows.
Sourcepub fn sysroot_libdir_relative(&self, compiler: Compiler) -> &Path
pub fn sysroot_libdir_relative(&self, compiler: Compiler) -> &Path
Returns the compiler’s relative libdir where the standard library and other artifacts are found for a compiler’s sysroot.
For example this returns lib on Unix and Windows.
pub fn rustc_lib_paths(&self, compiler: Compiler) -> Vec<PathBuf>
Sourcepub fn add_rustc_lib_path(&self, compiler: Compiler, cmd: &mut BootstrapCommand)
pub fn add_rustc_lib_path(&self, compiler: Compiler, cmd: &mut BootstrapCommand)
Adds the compiler’s directory of dynamic libraries to cmd’s dynamic
library lookup path.
Sourcefn codegen_backends(&self, compiler: Compiler) -> impl Iterator<Item = PathBuf>
fn codegen_backends(&self, compiler: Compiler) -> impl Iterator<Item = PathBuf>
Gets the paths to all of the compiler’s codegen backends.
pub fn rustdoc(&self, compiler: Compiler) -> PathBuf
pub fn cargo_clippy_cmd(&self, run_compiler: Compiler) -> BootstrapCommand
pub fn cargo_miri_cmd(&self, run_compiler: Compiler) -> BootstrapCommand
pub fn rustdoc_cmd(&self, compiler: Compiler) -> BootstrapCommand
Sourcepub fn llvm_config(&self, target: TargetSelection) -> Option<PathBuf>
pub fn llvm_config(&self, target: TargetSelection) -> Option<PathBuf>
Return the path to llvm-config for the target, if it exists.
Note that this returns None if LLVM is disabled, or if we’re in a
check build or dry-run, where there’s no need to build all of LLVM.
FIXME(@kobzol) WARNING: This actually returns the HOST LLVM config, not LLVM config for the given target.
Sourcepub fn require_and_update_all_submodules(&self)
pub fn require_and_update_all_submodules(&self)
Updates all submodules, and exits with an error if submodule management is disabled and the submodule does not exist.
Sourcepub fn submodule_paths(&self) -> &[String]
pub fn submodule_paths(&self) -> &[String]
Get all submodules from the src directory.
Sourcepub fn ensure<S: Step>(&'a self, step: S) -> S::Output
pub fn ensure<S: Step>(&'a self, step: S) -> S::Output
Ensure that a given step is built, returning its output. This will cache the step, so it is safe (and good!) to call this as often as needed to ensure that all dependencies are built.
Sourcepub(crate) fn ensure_if_default<T, S: Step<Output = Option<T>>>(
&'a self,
step: S,
kind: Kind,
) -> S::Output
pub(crate) fn ensure_if_default<T, S: Step<Output = Option<T>>>( &'a self, step: S, kind: Kind, ) -> S::Output
Ensure that a given step is built only if it’s supposed to be built by default, returning its output. This will cache the step, so it’s safe (and good!) to call this as often as needed to ensure that all dependencies are build.
Sourcepub(crate) fn was_invoked_explicitly<S: Step>(&'a self, kind: Kind) -> bool
pub(crate) fn was_invoked_explicitly<S: Step>(&'a self, kind: Kind) -> bool
Checks if any of the “should_run” paths is in the Builder paths.
pub(crate) fn maybe_open_in_browser<S: Step>(&self, path: impl AsRef<Path>)
pub(crate) fn open_in_browser(&self, path: impl AsRef<Path>)
pub fn exec_ctx(&self) -> &ExecutionContext
Methods from Deref<Target = Build>§
pub(crate) fn verbose(&self, f: impl Fn())
pub(crate) fn is_verbose(&self) -> bool
pub(crate) fn create(&self, path: &Path, s: &str)
pub(crate) fn remove(&self, f: &Path)
pub(crate) fn tempdir(&self) -> PathBuf
pub(crate) fn download_rustc(&self) -> bool
Sourcepub fn require_submodule(&self, submodule: &str, err_hint: Option<&str>)
pub fn require_submodule(&self, submodule: &str, err_hint: Option<&str>)
Updates a submodule, and exits with a failure if submodule management is disabled and the submodule does not exist.
The given submodule name should be its path relative to the root of the main repository.
The given err_hint will be shown to the user if the submodule is not
checked out and submodule management is disabled.
Sourcepub(crate) fn update_existing_submodules(&self)
pub(crate) fn update_existing_submodules(&self)
If any submodule has been initialized already, sync it unconditionally. This avoids contributors checking in a submodule change by accident.
pub(crate) fn rust_info(&self) -> &GitInfo
Sourcepub(crate) fn std_features(&self, target: TargetSelection) -> String
pub(crate) fn std_features(&self, target: TargetSelection) -> String
Gets the space-separated set of activated features for the standard library.
This can be configured with the std-features key in bootstrap.toml.
Sourcepub(crate) fn rustc_features(
&self,
kind: Kind,
target: TargetSelection,
crates: &[String],
) -> String
pub(crate) fn rustc_features( &self, kind: Kind, target: TargetSelection, crates: &[String], ) -> String
Gets the space-separated set of activated features for the compiler.
Sourcepub(crate) fn cargo_dir(&self) -> &'static str
pub(crate) fn cargo_dir(&self) -> &'static str
Component directory that Cargo will produce output into (e.g. release/debug)
pub(crate) fn tools_dir(&self, compiler: Compiler) -> PathBuf
Sourcepub(crate) fn stage_out(&self, build_compiler: Compiler, mode: Mode) -> PathBuf
pub(crate) fn stage_out(&self, build_compiler: Compiler, mode: Mode) -> PathBuf
Returns the root directory for all output generated in a particular stage when running with a particular host compiler.
The mode indicates what the root directory is for.
Sourcepub(crate) fn cargo_out(
&self,
compiler: Compiler,
mode: Mode,
target: TargetSelection,
) -> PathBuf
pub(crate) fn cargo_out( &self, compiler: Compiler, mode: Mode, target: TargetSelection, ) -> PathBuf
Returns the root output directory for all Cargo output in a given stage, running a particular compiler, whether or not we’re building the standard library, and targeting the specified architecture.
Sourcepub(crate) fn llvm_out(&self, target: TargetSelection) -> PathBuf
pub(crate) fn llvm_out(&self, target: TargetSelection) -> PathBuf
Root output directory of LLVM for target
Note that if LLVM is configured externally then the directory returned will likely be empty.
pub(crate) fn enzyme_out(&self, target: TargetSelection) -> PathBuf
pub(crate) fn gcc_out(&self, target: TargetSelection) -> PathBuf
pub(crate) fn lld_out(&self, target: TargetSelection) -> PathBuf
Sourcepub(crate) fn doc_out(&self, target: TargetSelection) -> PathBuf
pub(crate) fn doc_out(&self, target: TargetSelection) -> PathBuf
Output directory for all documentation for a target
Sourcepub(crate) fn json_doc_out(&self, target: TargetSelection) -> PathBuf
pub(crate) fn json_doc_out(&self, target: TargetSelection) -> PathBuf
Output directory for all JSON-formatted documentation for a target
pub(crate) fn test_out(&self, target: TargetSelection) -> PathBuf
Sourcepub(crate) fn compiler_doc_out(&self, target: TargetSelection) -> PathBuf
pub(crate) fn compiler_doc_out(&self, target: TargetSelection) -> PathBuf
Output directory for all documentation for a target
Sourcepub(crate) fn md_doc_out(&self, target: TargetSelection) -> PathBuf
pub(crate) fn md_doc_out(&self, target: TargetSelection) -> PathBuf
Output directory for some generated md crate documentation for a target (temporary)
Sourcepub(crate) fn vendored_crates_path(&self) -> Option<PathBuf>
pub(crate) fn vendored_crates_path(&self) -> Option<PathBuf>
Path to the vendored Rust crates.
Sourcepub(crate) fn llvm_filecheck(&self, target: TargetSelection) -> PathBuf
pub(crate) fn llvm_filecheck(&self, target: TargetSelection) -> PathBuf
Returns the path to FileCheck binary for the specified target
Sourcepub(crate) fn native_dir(&self, target: TargetSelection) -> PathBuf
pub(crate) fn native_dir(&self, target: TargetSelection) -> PathBuf
Directory for libraries built from C/C++ code and shared between stages.
Sourcepub(crate) fn test_helpers_out(&self, target: TargetSelection) -> PathBuf
pub(crate) fn test_helpers_out(&self, target: TargetSelection) -> PathBuf
Root output directory for rust_test_helpers library compiled for
target
Sourcepub(crate) fn add_rust_test_threads(&self, cmd: &mut BootstrapCommand)
pub(crate) fn add_rust_test_threads(&self, cmd: &mut BootstrapCommand)
Adds the RUST_TEST_THREADS env var if necessary
Sourcepub(crate) fn rustc_snapshot_libdir(&self) -> PathBuf
pub(crate) fn rustc_snapshot_libdir(&self) -> PathBuf
Returns the libdir of the snapshot compiler.
Sourcepub(crate) fn rustc_snapshot_sysroot(&self) -> &Path
pub(crate) fn rustc_snapshot_sysroot(&self) -> &Path
Returns the sysroot of the snapshot compiler.
Sourcepub fn is_verbose_than(&self, level: usize) -> bool
pub fn is_verbose_than(&self, level: usize) -> bool
Check if verbosity is greater than the level
Sourcepub(crate) fn verbose_than(&self, level: usize, f: impl Fn())
pub(crate) fn verbose_than(&self, level: usize, f: impl Fn())
Runs a function if verbosity is greater than level.
pub(crate) fn info(&self, msg: &str)
pub(crate) fn msg_clippy( &self, what: impl Display, target: impl Into<Option<TargetSelection>>, ) -> Option<Group>
pub(crate) fn msg_check( &self, what: impl Display, target: impl Into<Option<TargetSelection>>, custom_stage: Option<u32>, ) -> Option<Group>
pub(crate) fn msg_doc( &self, compiler: Compiler, what: impl Display, target: impl Into<Option<TargetSelection>> + Copy, ) -> Option<Group>
pub(crate) fn msg_build( &self, compiler: Compiler, what: impl Display, target: impl Into<Option<TargetSelection>>, ) -> Option<Group>
Sourcepub(crate) fn msg(
&self,
action: impl Into<Kind>,
stage: u32,
what: impl Display,
host: impl Into<Option<TargetSelection>>,
target: impl Into<Option<TargetSelection>>,
) -> Option<Group>
pub(crate) fn msg( &self, action: impl Into<Kind>, stage: u32, what: impl Display, host: impl Into<Option<TargetSelection>>, target: impl Into<Option<TargetSelection>>, ) -> Option<Group>
Return a Group guard for a Step that is built for each --stage.
Sourcepub(crate) fn msg_unstaged(
&self,
action: impl Into<Kind>,
what: impl Display,
target: TargetSelection,
) -> Option<Group>
pub(crate) fn msg_unstaged( &self, action: impl Into<Kind>, what: impl Display, target: TargetSelection, ) -> Option<Group>
Return a Group guard for a Step that is only built once and isn’t affected by --stage.
pub(crate) fn msg_sysroot_tool( &self, action: impl Into<Kind>, stage: u32, what: impl Display, host: TargetSelection, target: TargetSelection, ) -> Option<Group>
pub(crate) fn group(&self, msg: &str) -> Option<Group>
Sourcepub(crate) fn jobs(&self) -> u32
pub(crate) fn jobs(&self) -> u32
Returns the number of parallel jobs that have been configured for this build.
pub(crate) fn debuginfo_map_to( &self, which: GitRepo, remap_scheme: RemapScheme, ) -> Option<String>
Sourcepub(crate) fn cc(&self, target: TargetSelection) -> PathBuf
pub(crate) fn cc(&self, target: TargetSelection) -> PathBuf
Returns the path to the C compiler for the target specified.
Sourcepub(crate) fn cc_tool(&self, target: TargetSelection) -> Tool
pub(crate) fn cc_tool(&self, target: TargetSelection) -> Tool
Returns the internal cc::Tool for the C compiler.
Sourcepub(crate) fn cxx_tool(&self, target: TargetSelection) -> Tool
pub(crate) fn cxx_tool(&self, target: TargetSelection) -> Tool
Returns the internal cc::Tool for the C++ compiler.
Sourcepub(crate) fn cc_handled_clags(
&self,
target: TargetSelection,
c: CLang,
) -> Vec<String>
pub(crate) fn cc_handled_clags( &self, target: TargetSelection, c: CLang, ) -> Vec<String>
Returns C flags that cc-rs thinks should be enabled for the
specified target by default.
Sourcepub(crate) fn cc_unhandled_cflags(
&self,
target: TargetSelection,
which: GitRepo,
c: CLang,
) -> Vec<String>
pub(crate) fn cc_unhandled_cflags( &self, target: TargetSelection, which: GitRepo, c: CLang, ) -> Vec<String>
Returns extra C flags that cc-rs doesn’t handle.
Sourcepub(crate) fn ar(&self, target: TargetSelection) -> Option<PathBuf>
pub(crate) fn ar(&self, target: TargetSelection) -> Option<PathBuf>
Returns the path to the ar archive utility for the target specified.
Sourcepub(crate) fn ranlib(&self, target: TargetSelection) -> Option<PathBuf>
pub(crate) fn ranlib(&self, target: TargetSelection) -> Option<PathBuf>
Returns the path to the ranlib utility for the target specified.
Sourcepub(crate) fn cxx(&self, target: TargetSelection) -> Result<PathBuf, String>
pub(crate) fn cxx(&self, target: TargetSelection) -> Result<PathBuf, String>
Returns the path to the C++ compiler for the target specified.
Sourcepub(crate) fn linker(&self, target: TargetSelection) -> Option<PathBuf>
pub(crate) fn linker(&self, target: TargetSelection) -> Option<PathBuf>
Returns the path to the linker for the given target if it needs to be overridden.
pub(crate) fn is_lld_direct_linker(&self, target: TargetSelection) -> bool
Sourcepub(crate) fn crt_static(&self, target: TargetSelection) -> Option<bool>
pub(crate) fn crt_static(&self, target: TargetSelection) -> Option<bool>
Returns if this target should statically link the C runtime, if specified
Sourcepub(crate) fn musl_root(&self, target: TargetSelection) -> Option<&Path>
pub(crate) fn musl_root(&self, target: TargetSelection) -> Option<&Path>
Returns the “musl root” for this target, if defined.
If this is a native target (host is also musl) and no musl-root is given, it falls back to the system toolchain in /usr.
Sourcepub(crate) fn musl_libdir(&self, target: TargetSelection) -> Option<PathBuf>
pub(crate) fn musl_libdir(&self, target: TargetSelection) -> Option<PathBuf>
Returns the “musl libdir” for this target.
Sourcepub(crate) fn wasi_libdir(&self, target: TargetSelection) -> Option<PathBuf>
pub(crate) fn wasi_libdir(&self, target: TargetSelection) -> Option<PathBuf>
Returns the lib directory for the WASI target specified, if
configured.
This first consults wasi-root as configured in per-target
configuration, and failing that it assumes that $WASI_SDK_PATH is
set in the environment, and failing that None is returned.
Sourcepub(crate) fn no_std(&self, target: TargetSelection) -> Option<bool>
pub(crate) fn no_std(&self, target: TargetSelection) -> Option<bool>
Returns true if this is a no-std target, if defined
Sourcepub(crate) fn remote_tested(&self, target: TargetSelection) -> bool
pub(crate) fn remote_tested(&self, target: TargetSelection) -> bool
Returns true if the target will be tested using the remote-test-client
and remote-test-server binaries.
Sourcepub(crate) fn runner(&self, target: TargetSelection) -> Option<String>
pub(crate) fn runner(&self, target: TargetSelection) -> Option<String>
Returns an optional “runner” to pass to compiletest when executing
test binaries.
An example of this would be a WebAssembly runtime when testing the wasm targets.
Sourcepub(crate) fn default_wasi_runner(
&self,
target: TargetSelection,
) -> Option<String>
pub(crate) fn default_wasi_runner( &self, target: TargetSelection, ) -> Option<String>
When a runner configuration is not provided and a WASI-looking target
is being tested this is consulted to prove the environment to see if
there’s a runtime already lying around that seems reasonable to use.
Sourcepub(crate) fn tool_enabled(&self, tool: &str) -> bool
pub(crate) fn tool_enabled(&self, tool: &str) -> bool
Returns whether the specified tool is configured as part of this build.
This requires that both the extended key is set and the tools key is
either unset or specifically contains the specified tool.
Sourcepub(crate) fn qemu_rootfs(&self, target: TargetSelection) -> Option<&Path>
pub(crate) fn qemu_rootfs(&self, target: TargetSelection) -> Option<&Path>
Returns the root of the “rootfs” image that this target will be using, if one was configured.
If Some is returned then that means that tests for this target are
emulated with QEMU and binaries will need to be shipped to the emulator.
Sourcepub(crate) fn extended_error_dir(&self) -> PathBuf
pub(crate) fn extended_error_dir(&self) -> PathBuf
Temporary directory that extended error information is emitted to.
Sourcepub(crate) fn force_use_stage1(
&self,
stage: u32,
target: TargetSelection,
) -> bool
pub(crate) fn force_use_stage1( &self, stage: u32, target: TargetSelection, ) -> bool
Tests whether the compiler compiling for target should be forced to
use a stage1 compiler instead.
Currently, by default, the build system does not perform a “full bootstrap” by default where we compile the compiler three times. Instead, we compile the compiler two times. The final stage (stage2) just copies the libraries from the previous stage, which is what this method detects.
Here we return true if:
- The build isn’t performing a full bootstrap
- The
compileris in the final stage, 2 - We’re not cross-compiling, so the artifacts are already available in stage1
When all of these conditions are met the build will lift artifacts from the previous stage forward.
Sourcepub(crate) fn force_use_stage2(&self, stage: u32) -> bool
pub(crate) fn force_use_stage2(&self, stage: u32) -> bool
Checks whether the compiler compiling for target should be forced to
use a stage2 compiler instead.
When we download the pre-compiled version of rustc and compiler stage is >= 2, it should be forced to use a stage2 compiler.
Sourcepub(crate) fn release(&self, num: &str) -> String
pub(crate) fn release(&self, num: &str) -> String
Given num in the form “a.b.c” return a “release string” which
describes the release version number.
For example on nightly this returns “a.b.c-nightly”, on beta it returns “a.b.c-beta.1” and on stable it just returns “a.b.c”.
pub(crate) fn beta_prerelease_version(&self) -> u32
Sourcepub(crate) fn rust_release(&self) -> String
pub(crate) fn rust_release(&self) -> String
Returns the value of release above for Rust itself.
Sourcepub(crate) fn package_vers(&self, num: &str) -> String
pub(crate) fn package_vers(&self, num: &str) -> String
Returns the “package version” for a component given the num release
number.
The package version is typically what shows up in the names of tarballs.
For channels like beta/nightly it’s just the channel name, otherwise
it’s the num provided.
Sourcepub(crate) fn rust_package_vers(&self) -> String
pub(crate) fn rust_package_vers(&self) -> String
Returns the value of package_vers above for Rust itself.
Sourcepub(crate) fn rust_version(&self) -> String
pub(crate) fn rust_version(&self) -> String
Returns the version string associated with this compiler for Rust
itself.
Note that this is a descriptive string which includes the commit date, sha, version, etc.
Sourcepub(crate) fn release_num(&self, package: &str) -> String
pub(crate) fn release_num(&self, package: &str) -> String
Returns the a.b.c version that the given package is at.
Sourcepub(crate) fn unstable_features(&self) -> bool
pub(crate) fn unstable_features(&self) -> bool
Returns true if unstable features should be enabled for the compiler
we’re building.
Sourcepub(crate) fn in_tree_crates(
&self,
root: &str,
target: Option<TargetSelection>,
) -> Vec<&Crate>
pub(crate) fn in_tree_crates( &self, root: &str, target: Option<TargetSelection>, ) -> Vec<&Crate>
Returns a Vec of all the dependencies of the given root crate, including transitive dependencies and the root itself. Only includes “local” crates (those in the local source tree, not from a registry).
pub(crate) fn read_stamp_file( &self, stamp: &BuildStamp, ) -> Vec<(PathBuf, DependencyType)>
Sourcepub fn resolve_symlink_and_copy(&self, src: &Path, dst: &Path)
pub fn resolve_symlink_and_copy(&self, src: &Path, dst: &Path)
Copies a file from src to dst.
If src is a symlink, src will be resolved to the actual path
and copied to dst instead of the symlink itself.
Sourcepub fn copy_link(&self, src: &Path, dst: &Path, file_type: FileType)
pub fn copy_link(&self, src: &Path, dst: &Path, file_type: FileType)
Links a file from src to dst.
Attempts to use hard links if possible, falling back to copying.
You can neither rely on this being a copy nor it being a link,
so do not write to dst.
pub(crate) fn copy_link_internal( &self, src: &Path, dst: &Path, dereference_symlinks: bool, )
Sourcepub fn cp_link_r(&self, src: &Path, dst: &Path)
pub fn cp_link_r(&self, src: &Path, dst: &Path)
Links the src directory recursively to dst. Both are assumed to exist
when this function is called.
Will attempt to use hard links if possible and fall back to copying.
Sourcepub fn cp_link_filtered(
&self,
src: &Path,
dst: &Path,
filter: &dyn Fn(&Path) -> bool,
)
pub fn cp_link_filtered( &self, src: &Path, dst: &Path, filter: &dyn Fn(&Path) -> bool, )
Copies the src directory recursively to dst. Both are assumed to exist
when this function is called.
Will attempt to use hard links if possible and fall back to copying.
Unwanted files or directories can be skipped
by returning false from the filter function.
pub(crate) fn cp_link_filtered_recurse( &self, src: &Path, dst: &Path, relative: &Path, filter: &dyn Fn(&Path) -> bool, )
pub(crate) fn copy_link_to_folder(&self, src: &Path, dest_folder: &Path)
pub(crate) fn install(&self, src: &Path, dstdir: &Path, file_type: FileType)
pub(crate) fn read(&self, path: &Path) -> String
pub(crate) fn create_dir(&self, dir: &Path)
pub(crate) fn remove_dir(&self, dir: &Path)
pub(crate) fn read_dir(&self, dir: &Path) -> impl Iterator<Item = DirEntry>
pub(crate) fn symlink_file<P: AsRef<Path>, Q: AsRef<Path>>( &self, src: P, link: Q, ) -> Result<()>
Sourcepub(crate) fn ninja(&self) -> bool
pub(crate) fn ninja(&self) -> bool
Returns if config.ninja is enabled, and checks for ninja existence, exiting with a nicer error message if not.
pub fn colored_stdout<R, F: FnOnce(&mut dyn WriteColor) -> R>(&self, f: F) -> R
pub fn colored_stderr<R, F: FnOnce(&mut dyn WriteColor) -> R>(&self, f: F) -> R
pub(crate) fn colored_stream_inner<R, F, C>( &self, constructor: C, is_tty: bool, f: F, ) -> R
pub fn exec_ctx(&self) -> &ExecutionContext
pub fn report_summary(&self, start_time: Instant)
Trait Implementations§
Source§impl<'a> AsRef<ExecutionContext> for Builder<'a>
impl<'a> AsRef<ExecutionContext> for Builder<'a>
Source§fn as_ref(&self) -> &ExecutionContext
fn as_ref(&self) -> &ExecutionContext
Auto Trait Implementations§
impl<'a> !Freeze for Builder<'a>
impl<'a> !RefUnwindSafe for Builder<'a>
impl<'a> !Send for Builder<'a>
impl<'a> !Sync for Builder<'a>
impl<'a> Unpin for Builder<'a>
impl<'a> !UnwindSafe for Builder<'a>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
§impl<T> Pointable for T
impl<T> Pointable for T
Layout§
Note: Most layout information is completely unstable and may even differ between compilations. The only exception is types with certain repr(...) attributes. Please see the Rust Reference's “Type Layout” chapter for details on type layout guarantees.
Size: 176 bytes