Closed emperorjm closed 11 months ago
If you have a workspace with multiple projects you need to use workspace-optimizer instead of rust-optimizer. Then all your contracts need to go to the ./contracts/ folder and non-contract projects should be in a different place, e.g. packages. See for example the folder layout in https://github.com/CosmWasm/cw-plus.
Thanks a lot, @webmaster128. I had to restructure my entire project to utilize workspaces. For those curious about how I achieved this, I used version 2.0.0-beta.1 of the Archway CLI (https://github.com/archway-network/archway-cli/tree/2.0.0-beta.1). This version uses workspaces by default and facilitates the creation of multiple contracts within a project, leveraging the workspace-optimizer. I only became aware of this just now.
I have two contracts with both projects in the following folder structure:
nft-card
is a dependency for thecard
contract. The following is added to myCargo.toml
dependencies for thecard
contract:nft-card = { path = "../nft-card", version = "0.1.0", features = ["library"] }
When I run the optimizer I get the following error:
Both
cargo build
andcargo wasm
run with no issues.