Closed nicolaslara closed 1 year ago
The reason behind this is the following. In contrast to examples, the bin targets are built as part of the default cargo build
. But CosmWasm contracts do not contains any bin
which is compiled to Wasm. It is all happening in the lib
part. So no matter what schema generators do, using --lib
makes sense and is safe for old and new contracts. Recently my collegues concluded we prefer using a bin
target instead of an examples
target for the new schemas best practice. This turns this previously optional --lib
argument into a required one.
Even more context here: https://medium.com/cosmwasm/dev-note-1-moving-schema-rs-from-examples-to-bin-7c1b8cde7fc8
Thanks for the PR @nicolaslara and the shout-out @webmaster128!
My pleasure.
The more I think about it, the more I like this project. I now understand that it is fundamentally different to rust-optimizer and both projects have their place. More on that soon as part of https://github.com/CosmWasm/rust-optimizer/issues/101. Cheers!
https://github.com/CosmWasm/rust-optimizer/pull/91/files introduces the required
--lib
argument when optimizing with rust-optimizer/workspace-optimizer. This enables the schema generation to live undersrc/bin
instead ofexamples/
.This PR applies the same change to cw-optimizoor