Skip to content

Commit

Permalink
Fixed the publishing of the fuel-core 0.25.0 (FuelLabs#1840)
Browse files Browse the repository at this point in the history
Fixed the publishing of the `fuel-core 0.25.0` by including the
`wasm32-unknown-unknown` target and adapting the `build.rs` script to
work with the published WASM executor.

### Before requesting review
- [x] I have reviewed the code myself
  • Loading branch information
xgreenx authored Apr 19, 2024
1 parent c9caf5d commit a5552c7
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 12 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -498,7 +498,7 @@ jobs:
uses: dtolnay/rust-toolchain@master
with:
toolchain: ${{ env.RUST_VERSION }}
target: ${{ matrix.job.target }}
target: ${{ matrix.job.target }},wasm32-unknown-unknown

- name: Install cross
uses: baptiste0928/cargo-install@v1
Expand Down
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,10 @@ and this project adheres to [Semantic Versioning](http://semver.org/).

Description of the upcoming release here.

### Fixed

- [#1840](https://github.com/FuelLabs/fuel-core/pull/1840): Fixed the publishing of the `fuel-core 0.25.0` release.

## [Version 0.25.0]

### Fixed
Expand Down
35 changes: 24 additions & 11 deletions crates/services/upgradable-executor/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -34,27 +34,40 @@ fn build_wasm() {
cache_dir.push("fuel-core-upgradable-executor-cache");
let target_dir = format!("--target-dir={}", cache_dir.to_string_lossy());

let manifest_dir =
env::var_os("CARGO_MANIFEST_DIR").expect("The manifest directory is not set");
let manifest_path = Path::new(&manifest_dir);
let wasm_executor_path = manifest_path
.join("wasm-executor")
.to_string_lossy()
.to_string();

let cargo = env::var("CARGO").unwrap_or_else(|_| "cargo".to_string());

let args = vec![
let mut args = vec![
"install".to_owned(),
"--path".to_owned(),
wasm_executor_path,
"--target=wasm32-unknown-unknown".to_owned(),
"--no-default-features".to_owned(),
"--locked".to_owned(),
target_dir,
bin_dir,
];

let manifest_dir =
env::var_os("CARGO_MANIFEST_DIR").expect("The manifest directory is not set");
let manifest_path = Path::new(&manifest_dir);
let wasm_executor_path = manifest_path.join("wasm-executor");

// If the `wasm-executor` source code is available, then use it as a source for the
// `wasm-executor` binary. Otherwise, use the version from the crates.io.
if wasm_executor_path.exists() {
args.extend([
"--path".to_owned(),
wasm_executor_path.to_string_lossy().to_string(),
]);
} else {
let crate_version = env!("CARGO_PKG_VERSION");
args.extend([
"--version".to_owned(),
crate_version.to_owned(),
// We can use the offline mode because it was already downloaded
// by the `build.rs` dependencies requirements.
"--offline".to_string(),
]);
}

let mut cargo = Command::new(cargo);
cargo.env("CARGO_PROFILE_RELEASE_LTO", "true");
cargo.env("CARGO_PROFILE_RELEASE_PANIC", "abort");
Expand Down

0 comments on commit a5552c7

Please sign in to comment.