Skip to content

Commit

Permalink
pallet-revive: Use RUSTUP_TOOLCHAIN if set (#6365)
Browse files Browse the repository at this point in the history
We were not passing through the `RUSTUP_TOOLCHAIN` variable to the
`build.rs` script of our fixtures. This means that setting the toolchain
like `cargo +1.81 build` had no effect on the fixture build. It would
always fall back to the default toolchain.

---------

Co-authored-by: GitHub Action <[email protected]>
  • Loading branch information
athei and actions-user authored Nov 5, 2024
1 parent 76f297d commit 6f078d1
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 2 deletions.
10 changes: 10 additions & 0 deletions prdoc/pr_6365.prdoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
title: 'pallet-revive: Use `RUSTUP_TOOLCHAIN` if set'
doc:
- audience: Runtime Dev
description: We were not passing through the `RUSTUP_TOOLCHAIN` variable to the
`build.rs` script of our fixtures. This means that setting the toolchain like
`cargo +1.81 build` had no effect on the fixture build. It would always fall back
to the default toolchain.
crates:
- name: pallet-revive-fixtures
bump: major
5 changes: 3 additions & 2 deletions substrate/frame/revive/fixtures/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,7 @@ fn invoke_build(target: &Path, current_dir: &Path) -> Result<()> {
.env("CARGO_ENCODED_RUSTFLAGS", encoded_rustflags)
.env("RUSTC_BOOTSTRAP", "1")
.env("RUSTUP_HOME", env::var("RUSTUP_HOME").unwrap_or_default())
.env("RUSTUP_TOOLCHAIN", env::var("RUSTUP_TOOLCHAIN").unwrap_or_default())
.args([
"build",
"--release",
Expand Down Expand Up @@ -147,8 +148,8 @@ fn invoke_build(target: &Path, current_dir: &Path) -> Result<()> {

/// Post-process the compiled code.
fn post_process(input_path: &Path, output_path: &Path) -> Result<()> {
let strip = std::env::var(OVERRIDE_STRIP_ENV_VAR).map_or(false, |value| value == "1");
let optimize = std::env::var(OVERRIDE_OPTIMIZE_ENV_VAR).map_or(true, |value| value == "1");
let strip = env::var(OVERRIDE_STRIP_ENV_VAR).map_or(false, |value| value == "1");
let optimize = env::var(OVERRIDE_OPTIMIZE_ENV_VAR).map_or(true, |value| value == "1");

let mut config = polkavm_linker::Config::default();
config.set_strip(strip);
Expand Down

0 comments on commit 6f078d1

Please sign in to comment.