-
Notifications
You must be signed in to change notification settings - Fork 69
Description
We made a great simplification by just running the compile step one time on the top level folder even with multple workspaces: https://github.com/CosmWasm/rust-optimizer/blob/v0.10.1/optimize.sh#L25
However, when we run this on cosmwasm-plus we get cw1_whitelist with a size of 13kb. That is due to the 'library' feature being enabled when imported by subkeys, so no exports and almost everything gets optimized out.
Features are the union of all crates referencing it. In order to allow these crates to be imported as libraries and also compiled alone, we need to run the cargo build script once per contract. We also decided we cannot pass argument on the command-line, so I propose something like the following:
- cd $1
- check Cargo.toml exists
- if there is a
[package]nameentry then compile there - if there is a
[package]membersentry, then go into each directory listed there and run the build script in each one
This should work the same for cosmwasm and cosmwasm-examples and cosmwasm-template. The only change would be cosmwasm-plus, where we get the previous behavior (listing .contracts/*) without passing that explicitly. We may need a tool to parse the toml file beyond grep. https://github.com/freshautomations/stoml is interesting but not sure if we can apt install it.