Skip to content

Commit

Permalink
handle cargo submodule in a lazy-load way
Browse files Browse the repository at this point in the history
Signed-off-by: onur-ozkan <[email protected]>
  • Loading branch information
onur-ozkan committed Jun 15, 2024
1 parent 1f551cc commit c6f38c2
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 1 deletion.
3 changes: 3 additions & 0 deletions src/bootstrap/src/core/build_steps/test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3035,6 +3035,9 @@ impl Step for Bootstrap {
let compiler = builder.compiler(0, host);
let _guard = builder.msg(Kind::Test, 0, "bootstrap", host, host);

// Some tests require cargo submodule to be present.
builder.build.update_submodule(Path::new("src/tools/cargo"));

let mut check_bootstrap = Command::new(builder.python());
check_bootstrap
.args(["-m", "unittest", "bootstrap_test.py"])
Expand Down
2 changes: 2 additions & 0 deletions src/bootstrap/src/core/build_steps/tool.rs
Original file line number Diff line number Diff line change
Expand Up @@ -586,6 +586,8 @@ impl Step for Cargo {
}

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

builder.ensure(ToolBuild {
compiler: self.compiler,
target: self.target,
Expand Down
5 changes: 4 additions & 1 deletion src/bootstrap/src/core/build_steps/vendor.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
use crate::core::builder::{Builder, RunConfig, ShouldRun, Step};
use std::path::PathBuf;
use std::path::{Path, PathBuf};
use std::process::Command;

#[derive(Debug, Clone, Hash, PartialEq, Eq)]
Expand Down Expand Up @@ -34,6 +34,9 @@ impl Step for Vendor {
cmd.arg("--versioned-dirs");
}

// cargo submodule must be present for `x vendor` to work.
builder.build.update_submodule(Path::new("src/tools/cargo"));

// Sync these paths by default.
for p in [
"src/tools/cargo/Cargo.toml",
Expand Down

0 comments on commit c6f38c2

Please sign in to comment.