-
Notifications
You must be signed in to change notification settings - Fork 6
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support activating certain features #19
Comments
Hi @nicolaslara, thanks for bringing this up. It's by design. Feature-flags in Rust are additive across all workspace members:
It's standard practice in CosmWasm contracts to have
Meaning, if you compile such a CosmWasm workspace with "all features" then those entry points will be missing from every Furthermore, But most importantly, ❯ git clone https://github.com/CosmWasm/cw-plus && cd cw-plus
❯ rustc -V
rustc 1.63.0 (4b91a6ea7 2022-08-08)
❯ cargo -V
cargo 1.63.0 (fd9c4297c 2022-07-01)
❯ cargo build --all-features
Compiling cosmwasm-std v1.0.0
error[E0554]: `#![feature]` may not be used on the stable release channel
--> /Users/mandrean/.cargo/registry/src/git.luolix.top-1ecc6299db9ec823/cosmwasm-std-1.0.0/src/lib.rs:1:45
|
1 | #![cfg_attr(feature = "backtraces", feature(backtrace))]
| ^^^^^^^^^
For more information about this error, try `rustc --explain E0554`.
error: could not compile `cosmwasm-std` due to previous error If you have any more questions, I'm happy to discuss it. Otherwise I'll close this as a Thanks! |
Thanks for the quick reply! I probably was a little sparse on the details when I wrote this. I don't really want to use The reason I want to use features in cw-optimizoor is because I'm using it in CI to build the contracts for testing (and to verify that the wasm files included in the go integration tests actually come from the latest code). Using features also allows the contracts to include code that is only used when integration testing (but ignored in prod). Right now I'm building the wasm files used for testing manually but, without being able to specify the features, I can't make sure that the included wasm files are produced from the code in the commit being tested. Now, features being additive across workspaces is clearly a problem here, and it's clearly something that's outside the scope of this repo. However, I still see value in allowing cw-optimizoor to use the same parameters that building a workspace would allow; there are probably other use cases that we haven't thought of which would expect the parity. Off the top of my head, building the same contracts for different chains is something that could benefit from contract-specific features (for example, a contract that does swaps could use gamm on opsmosis, and junoswap on juno) |
Thanks for clarifying! So I have an idea. The Cargo manifest supports specifying aliases/groups of feature flags as such: Also
If |
yes, that would be enough to solve my use case I don't think I even need the groups, since I only have one crate in my workspace right now, but it will probably be useful to someone else :) |
Awesome. Updated the title of the issue, will put something together |
thanks! |
hey @mandrean Thank you for addressing this issue, I am also looking to compile with features and wondered if there is anything I can help with for this? |
Sorry for the inactivity, had some family issues last autumn. Anyway, working on this in #26 but its a little bit trickier than I first thought due to weird behavior in |
no worries! thanks for all the work! and I hope the family issues got sorted out |
Running
cargo build --feature x
orcargo build --all-features
works well, but trying to specify it on cw-optimizoor:exits with no output and empty
artifacts/
The text was updated successfully, but these errors were encountered: