Skip to content

Import rust-installer & adjust compression settings #108534

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Mar 8, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
Prev Previous commit
Next Next commit
Add bootstrap support for rust-installer
  • Loading branch information
Mark-Simulacrum committed Mar 7, 2023
commit ddc2d1e8063a346124633649b0d97dd6f8c33c83
1 change: 1 addition & 0 deletions src/bootstrap/builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -711,6 +711,7 @@ impl<'a> Builder<'a> {
test::RustdocUi,
test::RustdocJson,
test::HtmlCheck,
test::RustInstaller,
// Run bootstrap close to the end as it's unlikely to fail
test::Bootstrap,
// Run run-make last, since these won't pass without make on Windows
Expand Down
7 changes: 1 addition & 6 deletions src/bootstrap/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -482,12 +482,7 @@ impl Build {

// Make sure we update these before gathering metadata so we don't get an error about missing
// Cargo.toml files.
let rust_submodules = [
"src/tools/rust-installer",
"src/tools/cargo",
"library/backtrace",
"library/stdarch",
];
let rust_submodules = ["src/tools/cargo", "library/backtrace", "library/stdarch"];
for s in rust_submodules {
build.update_submodule(Path::new(s));
}
Expand Down
55 changes: 55 additions & 0 deletions src/bootstrap/test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2695,3 +2695,58 @@ impl Step for LintDocs {
});
}
}

#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)]
pub struct RustInstaller;

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

/// Ensure the version placeholder replacement tool builds
fn run(self, builder: &Builder<'_>) {
builder.info("test rust-installer");

let bootstrap_host = builder.config.build;
let compiler = builder.compiler(0, bootstrap_host);
let cargo = tool::prepare_tool_cargo(
builder,
compiler,
Mode::ToolBootstrap,
bootstrap_host,
"test",
"src/tools/rust-installer",
SourceType::InTree,
&[],
);
try_run(builder, &mut cargo.into());

// We currently don't support running the test.sh script outside linux(?) environments.
// Eventually this should likely migrate to #[test]s in rust-installer proper rather than a
// set of scripts, which will likely allow dropping this if.
if bootstrap_host != "x86_64-unknown-linux-gnu" {
return;
}

let mut cmd =
std::process::Command::new(builder.src.join("src/tools/rust-installer/test.sh"));
let tmpdir = testdir(builder, compiler.host).join("rust-installer");
let _ = std::fs::remove_dir_all(&tmpdir);
let _ = std::fs::create_dir_all(&tmpdir);
cmd.current_dir(&tmpdir);
cmd.env("CARGO_TARGET_DIR", tmpdir.join("cargo-target"));
cmd.env("CARGO", &builder.initial_cargo);
cmd.env("RUSTC", &builder.initial_rustc);
cmd.env("TMP_DIR", &tmpdir);
try_run(builder, &mut cmd);
}

fn should_run(run: ShouldRun<'_>) -> ShouldRun<'_> {
run.path("src/tools/rust-installer")
}

fn make_run(run: RunConfig<'_>) {
run.builder.ensure(Self);
}
}
2 changes: 1 addition & 1 deletion src/tools/rust-installer/combine-installers.sh
Original file line number Diff line number Diff line change
Expand Up @@ -21,4 +21,4 @@ abs_path() {
}

src_dir="$(abs_path $(dirname "$0"))"
cargo run --manifest-path="$src_dir/Cargo.toml" -- combine "$@"
$CARGO run --manifest-path="$src_dir/Cargo.toml" -- combine "$@"
2 changes: 1 addition & 1 deletion src/tools/rust-installer/gen-installer.sh
Original file line number Diff line number Diff line change
Expand Up @@ -21,4 +21,4 @@ abs_path() {
}

src_dir="$(abs_path $(dirname "$0"))"
cargo run --manifest-path="$src_dir/Cargo.toml" -- generate "$@"
$CARGO run --manifest-path="$src_dir/Cargo.toml" -- generate "$@"
2 changes: 1 addition & 1 deletion src/tools/rust-installer/make-tarballs.sh
Original file line number Diff line number Diff line change
Expand Up @@ -21,4 +21,4 @@ abs_path() {
}

src_dir="$(abs_path $(dirname "$0"))"
cargo run --manifest-path="$src_dir/Cargo.toml" -- tarball "$@"
$CARGO run --manifest-path="$src_dir/Cargo.toml" -- tarball "$@"
1 change: 0 additions & 1 deletion src/tools/rust-installer/test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ abs_path() {
S="$(abs_path $(dirname $0))"

TEST_DIR="$S/test"
TMP_DIR="$S/tmp"
WORK_DIR="$TMP_DIR/workdir"
OUT_DIR="$TMP_DIR/outdir"
PREFIX_DIR="$TMP_DIR/prefix"
Expand Down