iroha icon indicating copy to clipboard operation
iroha copied to clipboard

`kagami wasm`: move `--profile` into `--cargo-args`

Open 0x009922 opened this issue 7 months ago • 5 comments

I think profile can be moved to --cargo-args eventually.

Originally posted by @aoyako in https://github.com/hyperledger-iroha/iroha/pull/5449#discussion_r2108438404

0x009922 avatar Jun 04 '25 04:06 0x009922

@0x009922 Hey!

Could you please clarify what you meant by moving --profile into --cargo-args? thanks!

Levi0804 avatar Jul 06 '25 11:07 Levi0804

@Levi0804 Hey!

The --profile argument of kagami wasm is just passed directly to Cargo internally. Since I've introduced --cargo-args in #5449, it is possible to remove a dedicated argument for --profile from kagami wasm:

# before
kagami wasm build path/to/wasm --profile deploy --cargo-args="--locked"

# after
kagami wasm build path/to/wasm --cargo-args="--locked --profile deploy"

So, this task is about:

  • Soft-deprecating the current --profile argument of kagami wasm
  • Updating existing scripts (build_wasm.sh) to use --cargo-args

0x009922 avatar Jul 07 '25 03:07 0x009922

  • Soft-deprecating the current --profile argument of kagami wasm

Hey, Is this task only about warning for the argument?

Also, I pulled the branch from #5449 for the purpose of this issue and changed (in build_wasm.sh):

# this 
"${bin_kagami[@]}" wasm build "$CARGO_DIR/$1/$name" --profile="$PROFILE" --out-file "$out_file" --cargo-args="--locked"

# to this
"${bin_kagami[@]}" wasm build "$CARGO_DIR/$1/$name" --out-file "$out_file" --cargo-args="--locked --profile deploy"

and got the following error:

error: the argument '--profile <PROFILE-NAME>' cannot be used multiple times

Levi0804 avatar Jul 07 '25 18:07 Levi0804

Hey, Is this task only about warning for the argument?

and got the following error:

error: the argument '--profile <PROFILE-NAME>' cannot be used multiple times

No, it isn't only about warning. As you can see, you need to implement an internal change in kagami wasm so that it handles both --profile and --cargo-args properly.

Currently, if no --profile provided, it puts some default value, hence the "multiple times" error.

0x009922 avatar Jul 08 '25 02:07 0x009922

@0x009922 I created a PR. Please take a look when you have some time.

Levi0804 avatar Jul 10 '25 01:07 Levi0804