Skip to content

Commit

Permalink
use fixed rustup nightly toolchain + bug fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
OmarTawfik committed Dec 6, 2023
1 parent c9847e7 commit 5ff67d4
Show file tree
Hide file tree
Showing 9 changed files with 14 additions and 32 deletions.
1 change: 0 additions & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
"rust-analyzer.check.command": "clippy",
"rust-analyzer.check.features": "all",
"rust-analyzer.rustfmt.extraArgs": ["+nightly"],
"rust-analyzer.server.path": "${workspaceFolder}/bin/rust-analyzer",
"search.exclude": {
// Packages and Dependencies
"**/.hermit/": true,
Expand Down
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[workspace.package]
version = "0.11.0"
rust-version = "1.72.0" # Keep this version in sync with "$RUST_VERSION" in "$REPO_ROOT/bin/hermit.hcl" and "rust-src" in "$REPO_ROOT/bin"
rust-version = "1.72.0" # Keep this version in sync with "$RUST_STABLE_VERSION" in "$REPO_ROOT/bin/hermit.hcl"
edition = "2021"
publish = false

Expand Down
1 change: 0 additions & 1 deletion bin/[email protected]

This file was deleted.

1 change: 0 additions & 1 deletion bin/.rust-src-1.72.0.pkg

This file was deleted.

3 changes: 2 additions & 1 deletion bin/hermit.hcl
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@ env = {

// Rust:
"RUST_BACKTRACE": "FULL",
"RUST_VERSION": "1.72.0", // Keep this version in sync with "rust-version" in "$REPO_ROOT/Cargo.toml" and "rust-src" in "$REPO_ROOT/bin"
"RUST_STABLE_VERSION": "1.72.0", // Keep this version in sync with "rust-version" in "$REPO_ROOT/Cargo.toml"
"RUST_NIGHTLY_VERSION": "nightly-2023-12-01",
"RUSTC_WRAPPER": "${HERMIT_ENV}/bin/sccache",
"SCCACHE_DIR": "${HERMIT_ENV}/.hermit/sccache",

Expand Down
1 change: 0 additions & 1 deletion bin/rust-analyzer

This file was deleted.

1 change: 0 additions & 1 deletion bin/rust-src

This file was deleted.

30 changes: 8 additions & 22 deletions crates/infra/cli/src/commands/setup/cargo/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ use infra_utils::{commands::Command, github::GitHub};

pub fn setup_cargo() -> Result<()> {
// The bootstrap bash script defined in '$REPO_ROOT/scripts/_common.sh'
// installs the 'minimal' profile of the '$RUST_VERSION' toolchain.
// installs the 'minimal' profile of the '$RUST_STABLE_VERSION' toolchain.
// This includes the following components:
//
// - 'cargo'
Expand All @@ -14,28 +14,23 @@ pub fn setup_cargo() -> Result<()> {
// But we need these additional optional components:
//
// - 'clippy' for linting
// - 'rust-docs' for local development only
// - 'rust-docs' and 'rust-src' for local development
//
// So let's install these here:

rustup_add_component(env!("RUST_VERSION"), "clippy")?;
rustup_add_component(env!("RUST_STABLE_VERSION"), "clippy")?;

if !GitHub::is_running_in_ci() {
rustup_add_component(env!("RUST_VERSION"), "rust-docs")?;
rustup_add_component(env!("RUST_STABLE_VERSION"), "rust-docs")?;
rustup_add_component(env!("RUST_STABLE_VERSION"), "rust-src")?;
}

// Additionally, we also need 'rustfmt nightly', as we use experimental options.
// So let's install the 'nightly' toolchain along with the 'rustfmt' component.
// So let's install the '$RUST_NIGHTLY_VERSION' toolchain along with the 'rustfmt' component.

rustup_install_toolchain("nightly")?;
rustup_install_toolchain(env!("RUST_NIGHTLY_VERSION"))?;

rustup_add_component("nightly", "rustfmt")?;

// Warm up IDE tools if running locally.

if !GitHub::is_running_in_ci() {
warm_up_ide_tools()?;
}
rustup_add_component(env!("RUST_NIGHTLY_VERSION"), "rustfmt")?;

// Make sure we have the latest dependencies:

Expand All @@ -50,7 +45,6 @@ fn rustup_install_toolchain(toolchain: &str) -> Result<()> {
.flag("--no-self-update")
.property("--profile", "minimal")
.arg(toolchain)
.arg("nightly")
.run()
}

Expand All @@ -62,14 +56,6 @@ fn rustup_add_component(toolchain: &str, component: &str) -> Result<()> {
.run()
}

fn warm_up_ide_tools() -> Result<()> {
Command::new("rust-analyzer").flag("--version").run()?;

Command::new("rust-src").flag("--version").run()?;

Ok(())
}

fn run_cargo_fetch() -> Result<()> {
let mut command = Command::new("cargo").arg("fetch");

Expand Down
6 changes: 3 additions & 3 deletions scripts/_common.sh
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ set -euo pipefail
}

#
# This installs the minimal profile of the '$RUST_VERSION' toolchain.
# This installs the minimal profile of the '$RUST_STABLE_VERSION' toolchain.
# Any additional toolchains, or optional components, should be installed
# during 'infra setup cargo' step instead of here, as this is the hot path
# for every other command.
Expand All @@ -36,7 +36,7 @@ set -euo pipefail
#

{
rustup install --no-self-update --profile "minimal" "${RUST_VERSION:?}"
rustup install --no-self-update --profile "minimal" "${RUST_STABLE_VERSION:?}"

rustup default "${RUST_VERSION:?}"
rustup default "${RUST_STABLE_VERSION:?}"
}

0 comments on commit 5ff67d4

Please sign in to comment.