From 4c383c97e9478937136c9a4b226e387c953781d6 Mon Sep 17 00:00:00 2001 From: Lohachov Mykhailo Date: Fri, 17 Jan 2025 17:37:48 +0900 Subject: [PATCH] fix: wasm build instructions Signed-off-by: Lohachov Mykhailo --- .github/workflows/iroha2-dev-pr-wasm.yml | 2 +- CONTRIBUTING.md | 2 +- crates/iroha_kagami/src/wasm.rs | 8 +++++--- scripts/build_wasm.sh | 2 +- wasm/libs/default_executor/README.md | 2 +- 5 files changed, 9 insertions(+), 7 deletions(-) diff --git a/.github/workflows/iroha2-dev-pr-wasm.yml b/.github/workflows/iroha2-dev-pr-wasm.yml index a387e53d70..d8e3ce82c8 100644 --- a/.github/workflows/iroha2-dev-pr-wasm.yml +++ b/.github/workflows/iroha2-dev-pr-wasm.yml @@ -47,7 +47,7 @@ jobs: steps: - uses: actions/checkout@v4 - name: Build wasm libs - run: mold --run cargo run --bin kagami wasm -- build ./wasm/libs/default_executor --optimize --out-file ${{ env.DEFAULTS_DIR }}/executor.wasm + run: mold --run cargo run --bin kagami -- wasm build ./wasm/libs/default_executor --optimize --out-file ${{ env.DEFAULTS_DIR }}/executor.wasm - name: Upload executor to reuse in other jobs uses: actions/upload-artifact@v4 with: diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 6d4daa425e..a71d7a92a0 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -282,7 +282,7 @@ It can be done by running: ```bash # compile executor without optimizations -cargo run --bin kagami wasm -- build ./path/to/executor --out-file executor.wasm +cargo run --bin kagami -- wasm build ./path/to/executor --out-file executor.wasm ``` With profiling feature enabled Iroha exposes endpoint to scrap pprof profiles: diff --git a/crates/iroha_kagami/src/wasm.rs b/crates/iroha_kagami/src/wasm.rs index a5687f156c..b7ff54715e 100644 --- a/crates/iroha_kagami/src/wasm.rs +++ b/crates/iroha_kagami/src/wasm.rs @@ -1,10 +1,12 @@ -use std::path::PathBuf; +use std::{ + io::{BufWriter, Write}, + path::PathBuf, +}; -use clap::{Subcommand, Args as ClapArgs}; +use clap::{Args as ClapArgs, Subcommand}; use color_eyre::eyre::{eyre, Context}; use iroha_wasm_builder::Builder; use owo_colors::OwoColorize; -use std::io::{BufWriter, Write}; use crate::{Outcome, RunArgs}; diff --git a/scripts/build_wasm.sh b/scripts/build_wasm.sh index 53dcb4cc23..aada9058d1 100755 --- a/scripts/build_wasm.sh +++ b/scripts/build_wasm.sh @@ -23,7 +23,7 @@ build() { mkdir -p "$TARGET_DIR/$1" for name in ${NAMES[@]}; do out_file="$TARGET_DIR/$1/$name.wasm" - cargo run --bin kagami wasm -- build "$CARGO_DIR/$1/$name" --optimize --out-file "$out_file" + cargo run --bin kagami -- wasm build "$CARGO_DIR/$1/$name" --optimize --out-file "$out_file" done echo "info: WASM $1 build complete" echo "artifacts written to $TARGET_DIR/$1/" diff --git a/wasm/libs/default_executor/README.md b/wasm/libs/default_executor/README.md index a984609c4d..2451f23ade 100644 --- a/wasm/libs/default_executor/README.md +++ b/wasm/libs/default_executor/README.md @@ -3,6 +3,6 @@ Use the [Kagami Wasm Builder](../../../crates/iroha_kagami/README.md) in order to build it: ```bash -cargo run --bin kagami wasm -- \ +cargo run --bin kagami -- wasm \ build ./wasm/libs/default_executor --optimize --out-file ./defaults/executor.wasm ```