I want to use a feature from a dependency when I build in release profile and I don't want to use any feature while testing/development.
For example, the dependency is normally defined as:
[depenencies.my_dep]
version = "*"
But when I build in release profile, I want it to be
[depenencies.my_dep]
version = "*"
features = [my_feature]
From the cargo documentation I can make out that this can be achieved only for platform targets. Is there a way to do it for profile based configuration?
cargo
does not support what you want directly. I see two options.
A. Use dev-dependencies
which allow for tests to have different depends
than debug/release. dev-dependencies described
B. Have a Cargo-mock.toml and a Cargo-release.toml. Switch between them using cargo build --manifest-path ./Cargo-<type>.toml
.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With