Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 21 additions & 8 deletions src/bootstrap/src/core/build_steps/check.rs
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@ impl Std {

impl Step for Std {
type Output = BuildStamp;
const DEFAULT: bool = true;

fn should_run(run: ShouldRun<'_>) -> ShouldRun<'_> {
let mut run = run;
Expand All @@ -48,6 +47,10 @@ impl Step for Std {
run.path("library")
}

fn is_default_step(_builder: &Builder<'_>) -> bool {
true
}

fn make_run(run: RunConfig<'_>) {
if !run.builder.download_rustc() && run.builder.config.skip_std_check_if_no_download_rustc {
eprintln!(
Expand Down Expand Up @@ -310,12 +313,15 @@ impl Rustc {
impl Step for Rustc {
type Output = BuildStamp;
const IS_HOST: bool = true;
const DEFAULT: bool = true;

fn should_run(run: ShouldRun<'_>) -> ShouldRun<'_> {
run.crate_or_deps("rustc-main").path("compiler")
}

fn is_default_step(_builder: &Builder<'_>) -> bool {
true
}

fn make_run(run: RunConfig<'_>) {
let crates = run.make_run_crates(Alias::Compiler);
run.builder.ensure(Rustc::new(run.builder, run.target, crates));
Expand Down Expand Up @@ -510,14 +516,16 @@ pub struct CraneliftCodegenBackend {

impl Step for CraneliftCodegenBackend {
type Output = ();

const IS_HOST: bool = true;
const DEFAULT: bool = true;

fn should_run(run: ShouldRun<'_>) -> ShouldRun<'_> {
run.alias("rustc_codegen_cranelift").alias("cg_clif")
}

fn is_default_step(_builder: &Builder<'_>) -> bool {
true
}

fn make_run(run: RunConfig<'_>) {
run.builder.ensure(CraneliftCodegenBackend {
build_compiler: prepare_compiler_for_check(run.builder, run.target, Mode::Codegen),
Expand Down Expand Up @@ -580,14 +588,16 @@ pub struct GccCodegenBackend {

impl Step for GccCodegenBackend {
type Output = ();

const IS_HOST: bool = true;
const DEFAULT: bool = true;

fn should_run(run: ShouldRun<'_>) -> ShouldRun<'_> {
run.alias("rustc_codegen_gcc").alias("cg_gcc")
}

fn is_default_step(_builder: &Builder<'_>) -> bool {
true
}

fn make_run(run: RunConfig<'_>) {
run.builder.ensure(GccCodegenBackend {
build_compiler: prepare_compiler_for_check(run.builder, run.target, Mode::Codegen),
Expand Down Expand Up @@ -665,13 +675,16 @@ macro_rules! tool_check_step {
impl Step for $name {
type Output = ();
const IS_HOST: bool = true;
/// Most of the tool-checks using this macro are run by default.
const DEFAULT: bool = true $( && $default )?;

fn should_run(run: ShouldRun<'_>) -> ShouldRun<'_> {
run.paths(&[ $path, $( $alt_path ),* ])
}

fn is_default_step(_builder: &Builder<'_>) -> bool {
// Most of the tool-checks using this macro are run by default.
true $( && const { $default } )?
}

fn make_run(run: RunConfig<'_>) {
let target = run.target;
let mode: Mode = $mode;
Expand Down
14 changes: 9 additions & 5 deletions src/bootstrap/src/core/build_steps/clean.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,17 @@ use crate::{Build, Compiler, Kind, Mode, Subcommand};
pub struct CleanAll {}

impl Step for CleanAll {
const DEFAULT: bool = true;
type Output = ();

fn should_run(run: ShouldRun<'_>) -> ShouldRun<'_> {
// Only runs as the default `./x clean` step; cannot be selected explicitly.
run.never()
}

fn is_default_step(_builder: &Builder<'_>) -> bool {
true
}

fn make_run(run: RunConfig<'_>) {
run.builder.ensure(CleanAll {})
}
Expand All @@ -36,10 +44,6 @@ impl Step for CleanAll {

clean(builder.build, all, stage)
}

fn should_run(run: ShouldRun<'_>) -> ShouldRun<'_> {
run.never() // handled by DEFAULT
}
}

macro_rules! clean_crate_tree {
Expand Down
22 changes: 17 additions & 5 deletions src/bootstrap/src/core/build_steps/clippy.rs
Original file line number Diff line number Diff line change
Expand Up @@ -170,12 +170,15 @@ impl Std {

impl Step for Std {
type Output = ();
const DEFAULT: bool = true;

fn should_run(run: ShouldRun<'_>) -> ShouldRun<'_> {
run.crate_or_deps("sysroot").path("library")
}

fn is_default_step(_builder: &Builder<'_>) -> bool {
true
}

fn make_run(run: RunConfig<'_>) {
let crates = std_crates_for_run_make(&run);
let config = LintConfig::new(run.builder);
Expand Down Expand Up @@ -253,12 +256,15 @@ impl Rustc {
impl Step for Rustc {
type Output = ();
const IS_HOST: bool = true;
const DEFAULT: bool = true;

fn should_run(run: ShouldRun<'_>) -> ShouldRun<'_> {
run.crate_or_deps("rustc-main").path("compiler")
}

fn is_default_step(_builder: &Builder<'_>) -> bool {
true
}

fn make_run(run: RunConfig<'_>) {
let builder = run.builder;
let crates = run.make_run_crates(Alias::Compiler);
Expand Down Expand Up @@ -398,7 +404,7 @@ macro_rules! lint_any {
$path:expr,
$readable_name:expr,
$mode:expr
$(,lint_by_default = $lint_by_default:expr)*
$(, lint_by_default = $lint_by_default:expr )?
;
)+) => {
$(
Expand All @@ -412,12 +418,15 @@ macro_rules! lint_any {

impl Step for $name {
type Output = ();
const DEFAULT: bool = if false $(|| $lint_by_default)* { true } else { false };

fn should_run(run: ShouldRun<'_>) -> ShouldRun<'_> {
run.path($path)
}

fn is_default_step(_builder: &Builder<'_>) -> bool {
false $( || const { $lint_by_default } )?
}

fn make_run(run: RunConfig<'_>) {
let config = LintConfig::new(run.builder);
run.builder.ensure($name {
Expand Down Expand Up @@ -510,12 +519,15 @@ pub struct CI {

impl Step for CI {
type Output = ();
const DEFAULT: bool = false;

fn should_run(run: ShouldRun<'_>) -> ShouldRun<'_> {
run.alias("ci")
}

fn is_default_step(_builder: &Builder<'_>) -> bool {
false
}

fn make_run(run: RunConfig<'_>) {
let config = LintConfig::new(run.builder);
run.builder.ensure(CI { target: run.target, config });
Expand Down
12 changes: 8 additions & 4 deletions src/bootstrap/src/core/build_steps/compile.rs
Original file line number Diff line number Diff line change
Expand Up @@ -113,12 +113,14 @@ impl Step for Std {
/// Build stamp of std, if it was indeed built or uplifted.
type Output = Option<BuildStamp>;

const DEFAULT: bool = true;

fn should_run(run: ShouldRun<'_>) -> ShouldRun<'_> {
run.crate_or_deps("sysroot").path("library")
}

fn is_default_step(_builder: &Builder<'_>) -> bool {
true
}

fn make_run(run: RunConfig<'_>) {
let crates = std_crates_for_run_make(&run);
let builder = run.builder;
Expand Down Expand Up @@ -1011,9 +1013,7 @@ impl Rustc {

impl Step for Rustc {
type Output = BuiltRustc;

const IS_HOST: bool = true;
const DEFAULT: bool = false;

fn should_run(run: ShouldRun<'_>) -> ShouldRun<'_> {
let mut crates = run.builder.in_tree_crates("rustc-main", None);
Expand All @@ -1028,6 +1028,10 @@ impl Step for Rustc {
run.crates(crates)
}

fn is_default_step(_builder: &Builder<'_>) -> bool {
false
}

fn make_run(run: RunConfig<'_>) {
// If only `compiler` was passed, do not run this step.
// Instead the `Assemble` step will take care of compiling Rustc.
Expand Down
Loading
Loading