Skip to content
Draft
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
104 changes: 72 additions & 32 deletions src/bootstrap/src/core/build_steps/dist.rs
Original file line number Diff line number Diff line change
Expand Up @@ -66,8 +66,11 @@ impl Step for Docs {
const DEFAULT: bool = true;

fn should_run(run: ShouldRun<'_>) -> ShouldRun<'_> {
let default = run.builder.config.docs;
run.alias("rust-docs").default_condition(default)
run.alias("rust-docs")
}

fn is_really_default(builder: &Builder<'_>) -> bool {
builder.config.docs
}

fn make_run(run: RunConfig<'_>) {
Expand Down Expand Up @@ -110,8 +113,11 @@ impl Step for JsonDocs {
const DEFAULT: bool = true;

fn should_run(run: ShouldRun<'_>) -> ShouldRun<'_> {
let default = run.builder.config.docs;
run.alias("rust-docs-json").default_condition(default)
run.alias("rust-docs-json")
}

fn is_really_default(builder: &Builder<'_>) -> bool {
builder.config.docs
}

fn make_run(run: RunConfig<'_>) {
Expand Down Expand Up @@ -161,8 +167,11 @@ impl Step for RustcDocs {
const IS_HOST: bool = true;

fn should_run(run: ShouldRun<'_>) -> ShouldRun<'_> {
let builder = run.builder;
run.alias("rustc-docs").default_condition(builder.config.compiler_docs)
run.alias("rustc-docs")
}

fn is_really_default(builder: &Builder<'_>) -> bool {
builder.config.compiler_docs
}

fn make_run(run: RunConfig<'_>) {
Expand Down Expand Up @@ -931,8 +940,11 @@ impl Step for Analysis {
const DEFAULT: bool = true;

fn should_run(run: ShouldRun<'_>) -> ShouldRun<'_> {
let default = should_build_extended_tool(run.builder, "analysis");
run.alias("rust-analysis").default_condition(default)
run.alias("rust-analysis")
}

fn is_really_default(builder: &Builder<'_>) -> bool {
should_build_extended_tool(builder, "analysis")
}

fn make_run(run: RunConfig<'_>) {
Expand Down Expand Up @@ -1165,8 +1177,11 @@ impl Step for PlainSourceTarball {
const IS_HOST: bool = true;

fn should_run(run: ShouldRun<'_>) -> ShouldRun<'_> {
let builder = run.builder;
run.alias("rustc-src").default_condition(builder.config.rust_dist_src)
run.alias("rustc-src")
}

fn is_really_default(builder: &Builder<'_>) -> bool {
builder.config.rust_dist_src
}

fn make_run(run: RunConfig<'_>) {
Expand Down Expand Up @@ -1313,8 +1328,11 @@ impl Step for Cargo {
const IS_HOST: bool = true;

fn should_run(run: ShouldRun<'_>) -> ShouldRun<'_> {
let default = should_build_extended_tool(run.builder, "cargo");
run.alias("cargo").default_condition(default)
run.alias("cargo")
}

fn is_really_default(builder: &Builder<'_>) -> bool {
should_build_extended_tool(builder, "cargo")
}

fn make_run(run: RunConfig<'_>) {
Expand Down Expand Up @@ -1371,8 +1389,11 @@ impl Step for RustAnalyzer {
const IS_HOST: bool = true;

fn should_run(run: ShouldRun<'_>) -> ShouldRun<'_> {
let default = should_build_extended_tool(run.builder, "rust-analyzer");
run.alias("rust-analyzer").default_condition(default)
run.alias("rust-analyzer")
}

fn is_really_default(builder: &Builder<'_>) -> bool {
should_build_extended_tool(builder, "rust-analyzer")
}

fn make_run(run: RunConfig<'_>) {
Expand Down Expand Up @@ -1414,8 +1435,11 @@ impl Step for Clippy {
const IS_HOST: bool = true;

fn should_run(run: ShouldRun<'_>) -> ShouldRun<'_> {
let default = should_build_extended_tool(run.builder, "clippy");
run.alias("clippy").default_condition(default)
run.alias("clippy")
}

fn is_really_default(builder: &Builder<'_>) -> bool {
should_build_extended_tool(builder, "clippy")
}

fn make_run(run: RunConfig<'_>) {
Expand Down Expand Up @@ -1460,8 +1484,11 @@ impl Step for Miri {
const IS_HOST: bool = true;

fn should_run(run: ShouldRun<'_>) -> ShouldRun<'_> {
let default = should_build_extended_tool(run.builder, "miri");
run.alias("miri").default_condition(default)
run.alias("miri")
}

fn is_really_default(builder: &Builder<'_>) -> bool {
should_build_extended_tool(builder, "miri")
}

fn make_run(run: RunConfig<'_>) {
Expand Down Expand Up @@ -1508,16 +1535,18 @@ impl Step for CraneliftCodegenBackend {
const IS_HOST: bool = true;

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

fn is_really_default(builder: &Builder<'_>) -> bool {
// We only want to build the cranelift backend in `x dist` if the backend was enabled
// in rust.codegen-backends.
// Sadly, we don't have access to the actual target for which we're disting clif here..
// So we just use the host target.
let clif_enabled_by_default = run
.builder
builder
.config
.enabled_codegen_backends(run.builder.host_target)
.contains(&CodegenBackendKind::Cranelift);
run.alias("rustc_codegen_cranelift").default_condition(clif_enabled_by_default)
.enabled_codegen_backends(builder.host_target)
.contains(&CodegenBackendKind::Cranelift)
}

fn make_run(run: RunConfig<'_>) {
Expand Down Expand Up @@ -1594,8 +1623,11 @@ impl Step for Rustfmt {
const IS_HOST: bool = true;

fn should_run(run: ShouldRun<'_>) -> ShouldRun<'_> {
let default = should_build_extended_tool(run.builder, "rustfmt");
run.alias("rustfmt").default_condition(default)
run.alias("rustfmt")
}

fn is_really_default(builder: &Builder<'_>) -> bool {
should_build_extended_tool(builder, "rustfmt")
}

fn make_run(run: RunConfig<'_>) {
Expand Down Expand Up @@ -1636,8 +1668,11 @@ impl Step for Extended {
const IS_HOST: bool = true;

fn should_run(run: ShouldRun<'_>) -> ShouldRun<'_> {
let builder = run.builder;
run.alias("extended").default_condition(builder.config.extended)
run.alias("extended")
}

fn is_really_default(builder: &Builder<'_>) -> bool {
builder.config.extended
}

fn make_run(run: RunConfig<'_>) {
Expand Down Expand Up @@ -2382,14 +2417,16 @@ impl Step for LlvmTools {
const DEFAULT: bool = true;

fn should_run(run: ShouldRun<'_>) -> ShouldRun<'_> {
let default = should_build_extended_tool(run.builder, "llvm-tools");

let mut run = run.alias("llvm-tools");
for tool in LLVM_TOOLS {
run = run.alias(tool);
}

run.default_condition(default)
run
}

fn is_really_default(builder: &Builder<'_>) -> bool {
should_build_extended_tool(builder, "llvm-tools")
}

fn make_run(run: RunConfig<'_>) {
Expand Down Expand Up @@ -2486,8 +2523,11 @@ impl Step for LlvmBitcodeLinker {
const IS_HOST: bool = true;

fn should_run(run: ShouldRun<'_>) -> ShouldRun<'_> {
let default = should_build_extended_tool(run.builder, "llvm-bitcode-linker");
run.alias("llvm-bitcode-linker").default_condition(default)
run.alias("llvm-bitcode-linker")
}

fn is_really_default(builder: &Builder<'_>) -> bool {
should_build_extended_tool(builder, "llvm-bitcode-linker")
}

fn make_run(run: RunConfig<'_>) {
Expand Down
86 changes: 60 additions & 26 deletions src/bootstrap/src/core/build_steps/doc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,11 @@ macro_rules! book {
const DEFAULT: bool = true;

fn should_run(run: ShouldRun<'_>) -> ShouldRun<'_> {
let builder = run.builder;
run.path($path).default_condition(builder.config.docs)
run.path($path)
}

fn is_really_default(builder: &Builder<'_>) -> bool {
builder.config.docs
}

fn make_run(run: RunConfig<'_>) {
Expand Down Expand Up @@ -88,8 +91,11 @@ impl Step for UnstableBook {
const DEFAULT: bool = true;

fn should_run(run: ShouldRun<'_>) -> ShouldRun<'_> {
let builder = run.builder;
run.path("src/doc/unstable-book").default_condition(builder.config.docs)
run.path("src/doc/unstable-book")
}

fn is_really_default(builder: &Builder<'_>) -> bool {
builder.config.docs
}

fn make_run(run: RunConfig<'_>) {
Expand Down Expand Up @@ -216,8 +222,11 @@ impl Step for TheBook {
const DEFAULT: bool = true;

fn should_run(run: ShouldRun<'_>) -> ShouldRun<'_> {
let builder = run.builder;
run.path("src/doc/book").default_condition(builder.config.docs)
run.path("src/doc/book")
}

fn is_really_default(builder: &Builder<'_>) -> bool {
builder.config.docs
}

fn make_run(run: RunConfig<'_>) {
Expand Down Expand Up @@ -340,8 +349,11 @@ impl Step for Standalone {
const DEFAULT: bool = true;

fn should_run(run: ShouldRun<'_>) -> ShouldRun<'_> {
let builder = run.builder;
run.path("src/doc").alias("standalone").default_condition(builder.config.docs)
run.path("src/doc").alias("standalone")
}

fn is_really_default(builder: &Builder<'_>) -> bool {
builder.config.docs
}

fn make_run(run: RunConfig<'_>) {
Expand Down Expand Up @@ -450,8 +462,11 @@ impl Step for Releases {
const DEFAULT: bool = true;

fn should_run(run: ShouldRun<'_>) -> ShouldRun<'_> {
let builder = run.builder;
run.path("RELEASES.md").alias("releases").default_condition(builder.config.docs)
run.path("RELEASES.md").alias("releases")
}

fn is_really_default(builder: &Builder<'_>) -> bool {
builder.config.docs
}

fn make_run(run: RunConfig<'_>) {
Expand Down Expand Up @@ -634,8 +649,11 @@ impl Step for Std {
const DEFAULT: bool = true;

fn should_run(run: ShouldRun<'_>) -> ShouldRun<'_> {
let builder = run.builder;
run.crate_or_deps("sysroot").path("library").default_condition(builder.config.docs)
run.crate_or_deps("sysroot").path("library")
}

fn is_really_default(builder: &Builder<'_>) -> bool {
builder.config.docs
}

fn make_run(run: RunConfig<'_>) {
Expand Down Expand Up @@ -862,10 +880,11 @@ impl Step for Rustc {
const IS_HOST: bool = true;

fn should_run(run: ShouldRun<'_>) -> ShouldRun<'_> {
let builder = run.builder;
run.crate_or_deps("rustc-main")
.path("compiler")
.default_condition(builder.config.compiler_docs)
run.crate_or_deps("rustc-main").path("compiler")
}

fn is_really_default(builder: &Builder<'_>) -> bool {
builder.config.compiler_docs
}

fn make_run(run: RunConfig<'_>) {
Expand Down Expand Up @@ -1009,8 +1028,11 @@ macro_rules! tool_doc {
const IS_HOST: bool = true;

fn should_run(run: ShouldRun<'_>) -> ShouldRun<'_> {
let builder = run.builder;
run.path($path).default_condition(builder.config.compiler_docs)
run.path($path)
}

fn is_really_default(builder: &Builder<'_>) -> bool {
builder.config.compiler_docs
}

fn make_run(run: RunConfig<'_>) {
Expand Down Expand Up @@ -1210,8 +1232,11 @@ impl Step for ErrorIndex {
const IS_HOST: bool = true;

fn should_run(run: ShouldRun<'_>) -> ShouldRun<'_> {
let builder = run.builder;
run.path("src/tools/error_index_generator").default_condition(builder.config.docs)
run.path("src/tools/error_index_generator")
}

fn is_really_default(builder: &Builder<'_>) -> bool {
builder.config.docs
}

fn make_run(run: RunConfig<'_>) {
Expand Down Expand Up @@ -1255,8 +1280,11 @@ impl Step for UnstableBookGen {
const IS_HOST: bool = true;

fn should_run(run: ShouldRun<'_>) -> ShouldRun<'_> {
let builder = run.builder;
run.path("src/tools/unstable-book-gen").default_condition(builder.config.docs)
run.path("src/tools/unstable-book-gen")
}

fn is_really_default(builder: &Builder<'_>) -> bool {
builder.config.docs
}

fn make_run(run: RunConfig<'_>) {
Expand Down Expand Up @@ -1322,8 +1350,11 @@ impl Step for RustcBook {
const IS_HOST: bool = true;

fn should_run(run: ShouldRun<'_>) -> ShouldRun<'_> {
let builder = run.builder;
run.path("src/doc/rustc").default_condition(builder.config.docs)
run.path("src/doc/rustc")
}

fn is_really_default(builder: &Builder<'_>) -> bool {
builder.config.docs
}

fn make_run(run: RunConfig<'_>) {
Expand Down Expand Up @@ -1418,8 +1449,11 @@ impl Step for Reference {
const DEFAULT: bool = true;

fn should_run(run: ShouldRun<'_>) -> ShouldRun<'_> {
let builder = run.builder;
run.path("src/doc/reference").default_condition(builder.config.docs)
run.path("src/doc/reference")
}

fn is_really_default(builder: &Builder<'_>) -> bool {
builder.config.docs
}

fn make_run(run: RunConfig<'_>) {
Expand Down
Loading
Loading