Skip to content
Merged
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
4 changes: 2 additions & 2 deletions src/bootstrap/src/cli_main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ use std::time::Instant;
use std::{env, process};

use crate::core::builder::StepStack;
use crate::core::config::flags::Flags;
use crate::core::config::{ChangeId, Config, Subcommand};
use crate::core::config::flags::{Flags, Subcommand};
use crate::core::config::{ChangeId, Config};
use crate::utils::change_tracker::{
CONFIG_CHANGE_HISTORY, find_recent_config_change_ids, human_readable_changes,
};
Expand Down
3 changes: 2 additions & 1 deletion src/bootstrap/src/core/build_steps/check.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@ use crate::core::builder::{
self, Alias, Builder, Cargo, CommandLineStep, Kind, RunConfig, ShouldRun, Step, StepMetadata,
crate_description,
};
use crate::core::config::{Subcommand, TargetSelection};
use crate::core::config::TargetSelection;
use crate::core::config::flags::Subcommand;
use crate::utils::build_stamp::{self, BuildStamp};
use crate::utils::helpers::t;
use crate::{CodegenBackendKind, Compiler, Mode};
Expand Down
2 changes: 1 addition & 1 deletion src/bootstrap/src/core/build_steps/clean.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ use std::path::Path;
use crate::core::builder::{
Builder, CommandLineStep, Kind, RunConfig, ShouldRun, crate_description,
};
use crate::core::config::Subcommand;
use crate::core::config::flags::Subcommand;
use crate::utils::build_stamp::BuildStamp;
use crate::utils::helpers::t;
use crate::{Build, Compiler, Mode};
Expand Down
7 changes: 4 additions & 3 deletions src/bootstrap/src/core/build_steps/clippy.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,12 @@ use crate::core::build_steps::check::{CompilerForCheck, prepare_compiler_for_che
use crate::core::build_steps::compile::{
ArtifactKeepMode, run_cargo, rustc_cargo, std_cargo, std_crates_for_make_run,
};
use crate::core::builder;
use crate::core::builder::{
Alias, Builder, CommandLineStep, Kind, RunConfig, ShouldRun, StepMetadata, crate_description,
self, Alias, Builder, CommandLineStep, Kind, RunConfig, ShouldRun, StepMetadata,
crate_description,
};
use crate::core::config::{Subcommand, TargetSelection};
use crate::core::config::TargetSelection;
use crate::core::config::flags::Subcommand;
use crate::utils::build_stamp::{self, BuildStamp};
use crate::utils::helpers;
use crate::{Compiler, Mode};
Expand Down
4 changes: 2 additions & 2 deletions src/bootstrap/src/core/build_steps/doc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,12 @@ use crate::core::build_steps::tool::{
self, RustcPrivateCompilers, SourceType, Tool, prepare_tool_cargo,
};
use crate::core::builder::{
self, Builder, CommandLineStep, Compiler, Kind, RunConfig, ShouldRun, Step, StepMetadata,
self, Builder, CommandLineStep, Kind, RunConfig, ShouldRun, Step, StepMetadata,
crate_description,
};
use crate::core::config::{Config, TargetSelection};
use crate::utils::helpers::{submodule_path_of, symlink_dir, t, up_to_date};
use crate::{FileType, Mode};
use crate::{Compiler, FileType, Mode};

macro_rules! book {
($($name:ident, $path:expr, $book_name:expr, $lang:expr ;)+) => {
Expand Down
6 changes: 3 additions & 3 deletions src/bootstrap/src/core/build_steps/test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@ use crate::core::build_steps::tool::{
use crate::core::build_steps::toolstate::ToolState;
use crate::core::build_steps::{compile, dist, llvm};
use crate::core::builder::{
self, Alias, Builder, CommandLineStep, Compiler, Kind, RunConfig, ShouldRun, Step,
StepMetadata, crate_description,
self, Alias, Builder, CommandLineStep, Kind, RunConfig, ShouldRun, Step, StepMetadata,
crate_description,
};
use crate::core::config::TargetSelection;
use crate::core::config::flags::{Subcommand, get_completion, top_level_help};
Expand All @@ -45,7 +45,7 @@ use crate::utils::helpers::{
up_to_date,
};
use crate::utils::render_tests::{add_flags_and_try_run_tests, try_run_tests};
use crate::{CLang, CodegenBackendKind, GitRepo, Mode, TestTarget, envify};
use crate::{CLang, CodegenBackendKind, Compiler, GitRepo, Mode, TestTarget, envify};

mod compiletest;
pub mod failed_tests;
Expand Down
7 changes: 4 additions & 3 deletions src/bootstrap/src/core/builder/cargo.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@ use crate::utils::build_stamp;
use crate::utils::exec::{BootstrapCommand, command};
use crate::utils::helpers::{self, LldThreads, check_cfg_arg, linker_flags, t};
use crate::{
CLang, Compiler, EXTRA_CHECK_CFGS, GitRepo, Mode, RemapScheme, prepare_behaviour_dump_dir,
CLang, Compiler, EXTRA_CHECK_CFGS, GitRepo, Mode, RemapScheme, envify,
prepare_behaviour_dump_dir,
};

/// Represents flag values in `String` form with a `\x1f` delimiter to pass to the compiler later.
Expand Down Expand Up @@ -349,15 +350,15 @@ impl Cargo {
// any fingerprint difference between host==target versus cross-compiled targets
// when it comes to those host build artifacts.
if let Some(host_linker) = builder.linker(compiler.host) {
let host = crate::envify(&compiler.host.triple);
let host = envify(&compiler.host.triple);
self.command.env(format!("CARGO_TARGET_{host}_LINKER"), host_linker);
}
for arg in linker_flags(builder, compiler.host, LldThreads::Yes) {
self.hostflags.arg(&arg);
}

if let Some(target_linker) = builder.linker(target) {
let target = crate::envify(&target.triple);
let target = envify(&target.triple);
self.command.env(format!("CARGO_TARGET_{target}_LINKER"), target_linker);
}
// We want to set -Clinker using Cargo, therefore we only call `linker_flags` and not
Expand Down
3 changes: 1 addition & 2 deletions src/bootstrap/src/core/builder/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ use clap::ValueEnum;
use tracing::instrument;

pub use self::cargo::{Cargo, apply_pgo, cargo_profile_var};
pub use crate::Compiler;
use crate::core::build_steps::compile::{Std, StdLink, looks_like_codegen_backend};
use crate::core::build_steps::tool::RustcPrivateCompilers;
use crate::core::build_steps::{
Expand All @@ -29,7 +28,7 @@ use crate::utils::cache::Cache;
use crate::utils::exec::{BootstrapCommand, ExecutionContext, command};
use crate::utils::helpers::{self, LldThreads, add_dylib_path, exe, libdir, linker_args, t};
use crate::utils::tracing::format_location;
use crate::{Build, Crate, trace};
use crate::{Build, Compiler, Crate, trace};

mod cargo;
mod cli_paths;
Expand Down
3 changes: 1 addition & 2 deletions src/bootstrap/src/core/config/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,7 @@ use crate::CodegenBackendKind;
use crate::core::build_steps::llvm;
use crate::core::build_steps::llvm::LLVM_INVALIDATION_PATHS;
use crate::core::build_steps::test::failed_tests::collect_previously_failed_tests;
pub use crate::core::config::flags::Subcommand;
use crate::core::config::flags::{Color, Flags, Warnings};
use crate::core::config::flags::{Color, Flags, Subcommand, Warnings};
use crate::core::config::macros::check_ci_llvm;
use crate::core::config::target_selection::TargetSelectionList;
use crate::core::config::toml::TomlConfig;
Expand Down
5 changes: 3 additions & 2 deletions src/bootstrap/src/core/config/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ use super::toml::rust::parse_codegen_backends;
use super::{Config, DebuggerPath, RUSTC_IF_UNCHANGED_ALLOWED_PATHS};
use crate::core::build_steps::clippy::{LintConfig, get_clippy_rules_in_order};
use crate::core::build_steps::llvm::LLVM_INVALIDATION_PATHS;
use crate::core::config::flags::Subcommand;
use crate::core::config::{
BootstrapOverrideLld, ChangeId, CompilerBuiltins, Target, TargetSelection,
};
Expand Down Expand Up @@ -287,7 +288,7 @@ fn order_of_clippy_rules() {
let config = TestCtx::new().config(&args[0]).args(&args[1..]).create_config();

let actual = match config.cmd.clone() {
crate::Subcommand::Clippy { allow, deny, warn, forbid, .. } => {
Subcommand::Clippy { allow, deny, warn, forbid, .. } => {
let cfg = LintConfig { allow, deny, warn, forbid };
let args_vec: Vec<String> = args.iter().map(|s| s.to_string()).collect();
get_clippy_rules_in_order(&args_vec, &cfg)
Expand All @@ -311,7 +312,7 @@ fn clippy_rule_separate_prefix() {
let config = TestCtx::new().config(&args[0]).args(&args[1..]).create_config();

let actual = match config.cmd.clone() {
crate::Subcommand::Clippy { allow, deny, warn, forbid, .. } => {
Subcommand::Clippy { allow, deny, warn, forbid, .. } => {
let cfg = LintConfig { allow, deny, warn, forbid };
let args_vec: Vec<String> = args.iter().map(|s| s.to_string()).collect();
get_clippy_rules_in_order(&args_vec, &cfg)
Expand Down
3 changes: 2 additions & 1 deletion src/bootstrap/src/core/sanity.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@ use std::{env, fs};
use crate::Build;
use crate::core::build_steps::tool;
use crate::core::builder::Builder;
use crate::core::config::{CompilerBuiltins, DebuggerPath, Subcommand, Target};
use crate::core::config::flags::Subcommand;
use crate::core::config::{CompilerBuiltins, DebuggerPath, Target};
use crate::utils::exec::command;
use crate::utils::helpers::{self, t};

Expand Down
21 changes: 10 additions & 11 deletions src/bootstrap/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,14 +30,13 @@ use std::time::{Instant, SystemTime};
use std::{env, fs, io, str};

use build_helper::ci::gha;
use cc::Tool;
use termcolor::{ColorChoice, StandardStream, WriteColor};
#[cfg(feature = "tracing")]
use tracing::{instrument, span};

use crate::core::build_steps::format::InternalRustfmt;
use crate::core::build_steps::vendor::VENDOR_DIR;
use crate::core::builder::{self, Kind};
use crate::core::builder::{Builder, Kind};
use crate::core::config::flags::{self, Subcommand};
use crate::core::config::{BootstrapOverrideLld, Config, DryRun, LlvmLibunwind, TargetSelection};
use crate::utils::build_stamp::BuildStamp;
Expand Down Expand Up @@ -597,7 +596,7 @@ impl Build {
}

build.do_if_verbose(|| println!("finding compilers"));
utils::cc_detect::fill_compilers(&mut build);
crate::utils::cc_detect::fill_compilers(&mut build);
// When running `setup`, the profile is about to change, so any requirements we have now may
// be different on the next invocation. Don't check for them until the next time x.py is
// run. This is ok because `setup` never runs any build commands, so it won't fail if commands are missing.
Expand Down Expand Up @@ -752,12 +751,12 @@ impl Build {

match &self.config.cmd {
Subcommand::Format { check, all } => {
let builder = builder::Builder::new(self);
let builder = Builder::new(self);
let rustfmt_path = builder.ensure(InternalRustfmt).unwrap_or_else(|| {
eprintln!("fmt error: `x fmt` is not supported on this channel");
helpers::exit_process(1);
});
return core::build_steps::format::format(
return crate::core::build_steps::format::format(
&builder,
rustfmt_path,
*check,
Expand All @@ -766,7 +765,7 @@ impl Build {
);
}
Subcommand::Perf(args) => {
return core::build_steps::perf::perf(&builder::Builder::new(self), args);
return crate::core::build_steps::perf::perf(&Builder::new(self), args);
}
_cmd => {
debug!(cmd = ?_cmd, "not a hardcoded subcommand; returning to normal handling");
Expand All @@ -787,7 +786,7 @@ impl Build {
let _sanity_check_span =
span!(tracing::Level::DEBUG, "(1) executing dry-run sanity-check").entered();
self.config.set_dry_run(DryRun::SelfCheck);
let builder = builder::Builder::new(self);
let builder = Builder::new(self);
builder.execute_cli();
}

Expand All @@ -797,14 +796,14 @@ impl Build {
let _actual_run_span =
span!(tracing::Level::DEBUG, "(2) executing actual run").entered();
self.config.set_dry_run(DryRun::Disabled);
let builder = builder::Builder::new(self);
let builder = Builder::new(self);
builder.execute_cli();
}
} else {
#[cfg(feature = "tracing")]
let _dry_run_span = span!(tracing::Level::DEBUG, "executing dry run").entered();

let builder = builder::Builder::new(self);
let builder = Builder::new(self);
builder.execute_cli();
}

Expand Down Expand Up @@ -1207,12 +1206,12 @@ impl Build {
}

/// Returns the internal `cc::Tool` for the C compiler.
fn cc_tool(&self, target: TargetSelection) -> Tool {
fn cc_tool(&self, target: TargetSelection) -> cc::Tool {
self.cc[&target].clone()
}

/// Returns the internal `cc::Tool` for the C++ compiler.
fn cxx_tool(&self, target: TargetSelection) -> Tool {
fn cxx_tool(&self, target: TargetSelection) -> cc::Tool {
self.cxx[&target].clone()
}

Expand Down
2 changes: 1 addition & 1 deletion src/bootstrap/src/utils/build_stamp/tests.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use tempfile::TempDir;

use crate::BuildStamp;
use crate::utils::build_stamp::BuildStamp;

#[test]
#[should_panic(expected = "prefix can not start or end with '.'")]
Expand Down
3 changes: 2 additions & 1 deletion src/bootstrap/src/utils/cc_detect.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,8 @@ use std::collections::HashSet;
use std::iter;
use std::path::{Path, PathBuf};

use crate::core::config::{CompressDebuginfo, Subcommand, TargetSelection};
use crate::core::config::flags::Subcommand;
use crate::core::config::{CompressDebuginfo, TargetSelection};
use crate::utils::exec::{BootstrapCommand, command};
use crate::{Build, CLang, GitRepo};

Expand Down
2 changes: 1 addition & 1 deletion src/bootstrap/src/utils/step_graph.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ use std::panic::Location;
use std::path::Path;

use crate::core::builder::{AnyDebug, Step, pretty_step_name};
use crate::t;
use crate::utils::helpers::t;
use crate::utils::tracing::format_location;

/// Records the executed steps and their dependencies in a directed graph,
Expand Down
4 changes: 2 additions & 2 deletions src/bootstrap/src/utils/tarball.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@ use crate::FileType;
use crate::core::build_steps::dist::distdir;
use crate::core::builder::{Builder, Kind};
use crate::core::config::BUILDER_CONFIG_FILENAME;
use crate::utils::channel;
use crate::utils::exec::BootstrapCommand;
use crate::utils::helpers::{move_file, t};
use crate::utils::{channel, helpers};
use crate::utils::helpers::{self, move_file, t};

#[derive(Copy, Clone)]
pub(crate) enum OverlayKind {
Expand Down
2 changes: 1 addition & 1 deletion src/bootstrap/src/utils/tracing.rs
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ pub fn format_location(location: std::panic::Location<'static>) -> String {
const COMMAND_SPAN_TARGET: &str = "COMMAND";

#[cfg(feature = "tracing")]
pub fn trace_cmd(command: &crate::BootstrapCommand) -> tracing::span::EnteredSpan {
pub fn trace_cmd(command: &crate::utils::exec::BootstrapCommand) -> tracing::span::EnteredSpan {
let fingerprint = command.fingerprint();
let location = command.get_created_location();
let location = format_location(location);
Expand Down
Loading