Skip to content

Commit

Permalink
Rename require_and_update_submodule to require_submodule
Browse files Browse the repository at this point in the history
Just trying to be a little less verbose here.
  • Loading branch information
ehuss committed Jul 27, 2024
1 parent 0f387eb commit 1c98b8f
Show file tree
Hide file tree
Showing 11 changed files with 25 additions and 25 deletions.
2 changes: 1 addition & 1 deletion src/bootstrap/src/core/build_steps/check.rs
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ impl Step for Std {
}

fn run(self, builder: &Builder<'_>) {
builder.require_and_update_submodule("library/stdarch", None);
builder.require_submodule("library/stdarch", None);

let target = self.target;
let compiler = builder.compiler(builder.top_stage, builder.config.build);
Expand Down
2 changes: 1 addition & 1 deletion src/bootstrap/src/core/build_steps/clippy.rs
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ impl Step for Std {
}

fn run(self, builder: &Builder<'_>) {
builder.require_and_update_submodule("library/stdarch", None);
builder.require_submodule("library/stdarch", None);

let target = self.target;
let compiler = builder.compiler(builder.top_stage, builder.config.build);
Expand Down
6 changes: 3 additions & 3 deletions src/bootstrap/src/core/build_steps/compile.rs
Original file line number Diff line number Diff line change
Expand Up @@ -182,11 +182,11 @@ impl Step for Std {
return;
}

builder.require_and_update_submodule("library/stdarch", None);
builder.require_submodule("library/stdarch", None);

// Profiler information requires LLVM's compiler-rt
if builder.config.profiler {
builder.require_and_update_submodule(
builder.require_submodule(
"src/llvm-project",
Some(
"The `build.profiler` config option requires `compiler-rt` sources from LLVM.",
Expand Down Expand Up @@ -461,7 +461,7 @@ pub fn std_cargo(builder: &Builder<'_>, target: TargetSelection, stage: u32, car
// That's probably ok? At least, the difference wasn't enforced before. There's a comment in
// the compiler_builtins build script that makes me nervous, though:
// https://github.com/rust-lang/compiler-builtins/blob/31ee4544dbe47903ce771270d6e3bea8654e9e50/build.rs#L575-L579
builder.require_and_update_submodule(
builder.require_submodule(
"src/llvm-project",
Some(
"The `build.optimized-compiler-builtins` config option \
Expand Down
2 changes: 1 addition & 1 deletion src/bootstrap/src/core/build_steps/dist.rs
Original file line number Diff line number Diff line change
Expand Up @@ -907,7 +907,7 @@ impl Step for Src {
/// Creates the `rust-src` installer component
fn run(self, builder: &Builder<'_>) -> GeneratedTarball {
if !builder.config.dry_run() {
builder.require_and_update_submodule("src/llvm-project", None);
builder.require_submodule("src/llvm-project", None);
}

let tarball = Tarball::new_targetless(builder, "rust-src");
Expand Down
8 changes: 4 additions & 4 deletions src/bootstrap/src/core/build_steps/doc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ macro_rules! book {
fn run(self, builder: &Builder<'_>) {
$(
let path = submodule_helper!( $path, submodule $( = $submodule )? );
builder.require_and_update_submodule(path, None);
builder.require_submodule(path, None);
)?
builder.ensure(RustbookSrc {
target: self.target,
Expand Down Expand Up @@ -224,7 +224,7 @@ impl Step for TheBook {
/// * Index page
/// * Redirect pages
fn run(self, builder: &Builder<'_>) {
builder.require_and_update_submodule("src/doc/book", None);
builder.require_submodule("src/doc/book", None);

let compiler = self.compiler;
let target = self.target;
Expand Down Expand Up @@ -934,7 +934,7 @@ macro_rules! tool_doc {
let source_type = SourceType::Submodule;

let path = submodule_helper!( $path, submodule $( = $submodule )? );
builder.require_and_update_submodule(path, None);
builder.require_submodule(path, None);
)?

let stage = builder.top_stage;
Expand Down Expand Up @@ -1252,7 +1252,7 @@ impl Step for Reference {

/// Builds the reference book.
fn run(self, builder: &Builder<'_>) {
builder.require_and_update_submodule("src/doc/reference", None);
builder.require_submodule("src/doc/reference", None);

// This is needed for generating links to the standard library using
// the mdbook-spec plugin.
Expand Down
4 changes: 2 additions & 2 deletions src/bootstrap/src/core/build_steps/llvm.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1198,7 +1198,7 @@ impl Step for CrtBeginEnd {

/// Build crtbegin.o/crtend.o for musl target.
fn run(self, builder: &Builder<'_>) -> Self::Output {
builder.require_and_update_submodule(
builder.require_submodule(
"src/llvm-project",
Some("The LLVM sources are required for the CRT from `compiler-rt`."),
);
Expand Down Expand Up @@ -1274,7 +1274,7 @@ impl Step for Libunwind {

/// Build libunwind.a
fn run(self, builder: &Builder<'_>) -> Self::Output {
builder.require_and_update_submodule(
builder.require_submodule(
"src/llvm-project",
Some("The LLVM sources are required for libunwind."),
);
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 @@ -2287,7 +2287,7 @@ macro_rules! test_book {
fn run(self, builder: &Builder<'_>) {
$(
for submodule in $submodules {
builder.require_and_update_submodule(submodule, None);
builder.require_submodule(submodule, None);
}
)*
builder.ensure(BookTest {
Expand Down Expand Up @@ -2409,7 +2409,7 @@ impl Step for RustcGuide {

fn run(self, builder: &Builder<'_>) {
let relative_path = "src/doc/rustc-dev-guide";
builder.require_and_update_submodule(relative_path, None);
builder.require_submodule(relative_path, None);

let src = builder.src.join(relative_path);
let mut rustbook_cmd = builder.tool_cmd(Tool::Rustbook).delay_failure();
Expand Down Expand Up @@ -3019,7 +3019,7 @@ impl Step for Bootstrap {
let _guard = builder.msg(Kind::Test, 0, "bootstrap", host, host);

// Some tests require cargo submodule to be present.
builder.build.require_and_update_submodule("src/tools/cargo", None);
builder.build.require_submodule("src/tools/cargo", None);

let mut check_bootstrap = command(builder.python());
check_bootstrap
Expand Down
8 changes: 4 additions & 4 deletions src/bootstrap/src/core/build_steps/tool.rs
Original file line number Diff line number Diff line change
Expand Up @@ -290,7 +290,7 @@ macro_rules! bootstrap_tool {
fn run(self, builder: &Builder<'_>) -> PathBuf {
$(
for submodule in $submodules {
builder.require_and_update_submodule(submodule, None);
builder.require_submodule(submodule, None);
}
)*
builder.ensure(ToolBuild {
Expand Down Expand Up @@ -373,7 +373,7 @@ impl Step for OptimizedDist {
fn run(self, builder: &Builder<'_>) -> PathBuf {
// We need to ensure the rustc-perf submodule is initialized when building opt-dist since
// the tool requires it to be in place to run.
builder.require_and_update_submodule("src/tools/rustc-perf", None);
builder.require_submodule("src/tools/rustc-perf", None);

builder.ensure(ToolBuild {
compiler: self.compiler,
Expand Down Expand Up @@ -414,7 +414,7 @@ impl Step for RustcPerf {

fn run(self, builder: &Builder<'_>) -> PathBuf {
// We need to ensure the rustc-perf submodule is initialized.
builder.require_and_update_submodule("src/tools/rustc-perf", None);
builder.require_submodule("src/tools/rustc-perf", None);

let tool = ToolBuild {
compiler: self.compiler,
Expand Down Expand Up @@ -715,7 +715,7 @@ impl Step for Cargo {
}

fn run(self, builder: &Builder<'_>) -> PathBuf {
builder.build.require_and_update_submodule("src/tools/cargo", None);
builder.build.require_submodule("src/tools/cargo", None);

builder.ensure(ToolBuild {
compiler: self.compiler,
Expand Down
2 changes: 1 addition & 1 deletion src/bootstrap/src/core/build_steps/vendor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ impl Step for Vendor {

// These submodules must be present for `x vendor` to work.
for submodule in SUBMODULES_FOR_RUSTBOOK.iter().chain(["src/tools/cargo"].iter()) {
builder.build.require_and_update_submodule(submodule, None);
builder.build.require_submodule(submodule, None);
}

// Sync these paths by default.
Expand Down
2 changes: 1 addition & 1 deletion src/bootstrap/src/core/builder/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ fn configure_with_args(cmd: &[String], host: &[&str], target: &[&str]) -> Config
rust_codegen_backends: vec![],
..Config::parse(&["check".to_owned()])
});
submodule_build.require_and_update_submodule("src/doc/book", None);
submodule_build.require_submodule("src/doc/book", None);
config.submodules = Some(false);

config.ninja_in_file = false;
Expand Down
8 changes: 4 additions & 4 deletions src/bootstrap/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -441,7 +441,7 @@ impl Build {
// Cargo.toml files.
let rust_submodules = ["library/backtrace", "library/stdarch"];
for s in rust_submodules {
build.require_and_update_submodule(
build.require_submodule(
s,
Some(
"The submodule is required for the standard library \
Expand Down Expand Up @@ -482,7 +482,7 @@ impl Build {
///
/// This *does not* update the submodule if `config.toml` explicitly says
/// not to, or if we're not in a git repository (like a plain source
/// tarball). Typically [`Build::require_and_update_submodule`] should be
/// tarball). Typically [`Build::require_submodule`] should be
/// used instead to provide a nice error to the user if the submodule is
/// missing.
fn update_submodule(&self, relative_path: &str) {
Expand Down Expand Up @@ -599,7 +599,7 @@ impl Build {
///
/// The given `err_hint` will be shown to the user if the submodule is not
/// checked out and submodule management is disabled.
pub fn require_and_update_submodule(&self, submodule: &str, err_hint: Option<&str>) {
pub fn require_submodule(&self, submodule: &str, err_hint: Option<&str>) {
// When testing bootstrap itself, it is much faster to ignore
// submodules. Almost all Steps work fine without their submodules.
if cfg!(test) && !self.config.submodules() {
Expand Down Expand Up @@ -628,7 +628,7 @@ impl Build {
/// management is disabled and the submodule does not exist.
pub fn require_and_update_all_submodules(&self) {
for submodule in build_helper::util::parse_gitmodules(&self.src) {
self.require_and_update_submodule(submodule, None);
self.require_submodule(submodule, None);
}
}

Expand Down

0 comments on commit 1c98b8f

Please sign in to comment.