iroha icon indicating copy to clipboard operation
iroha copied to clipboard

feat(kagami wasm): move --profile into --cargo-args

Open Levi0804 opened this issue 6 months ago • 7 comments

Overview

This PR handles #5453, moving the --profile argument to --cargo-args and handling the case where the --profile argument is given multiple times.

Changes

  1. Updated Args::Build handler branch to prioritize --profile argument inside --cargo-args, ignoring the other --profile argument (default or if any).
  2. Updated build_wasm.sh to use --carg-args.

Levi0804 avatar Jul 10 '25 01:07 Levi0804

Hey, I’ve added the tests and logs you suggested, and also refactored some code to avoid unnecessary allocations. Does the change fromProfile to Option<Profile> inside Args::Build look good to you?

Please let me know if you'd like me to change anything.

Levi0804 avatar Jul 11 '25 14:07 Levi0804

Hey, this works, but I just realized I could have done it a bit better using #[arg(value_parser = ...)] and the tests could be written more cleanly too. I’ll add those changes soon. What do you think?

Levi0804 avatar Jul 13 '25 16:07 Levi0804

Hello, I've updated the code to use the parse function and added an else if branch for appropriate logging in different conditions. Let me know if these changes look good to you.

Levi0804 avatar Jul 14 '25 08:07 Levi0804

Hey, this works, but I just realized I could have done it a bit better using #[arg(value_parser = ...)] and the tests could be written more cleanly too. I’ll add those changes soon. What do you think?

Also, I don't think this will be possible because profile depends on cargo_args.

Levi0804 avatar Jul 14 '25 08:07 Levi0804

Hello, do these changes look good?

Levi0804 avatar Jul 18 '25 07:07 Levi0804

yeah, I see.

It isn't necessary that WASMs are built either with release or deploy profile

then will they all just default to release?

Levi0804 avatar Aug 25 '25 07:08 Levi0804

then will they all just default to release?

Hmm, not sure. Actually, I've looked into the how wasm-pack handles profiles, and it has a limited set of pre-defined profiles (--dev, --profiling, --release), and uses --release as the default. So, maybe it's fine to leave things as is in iroha-wasm-builder... What do you think?

0x009922 avatar Aug 27 '25 07:08 0x009922