Skip to content
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 at-least-one groups of features (nested ideally) #42

Open
rbtcollins opened this issue May 10, 2023 · 1 comment · May be fixed by #44 or #50
Open

support at-least-one groups of features (nested ideally) #42

rbtcollins opened this issue May 10, 2023 · 1 comment · May be fixed by #44 or #50

Comments

@rbtcollins
Copy link

rbtcollins commented May 10, 2023

In rustup we have two HTTP backends (curl and reqwest). These are both features, and both can be disabled, but at least one must be enabled.

Similarly, for reqwest we have two features selecting the TLS cert stack to use, and again at least one must be enabled.

We enable sensible defaults via the default-features mechanism.

So we have the following feature sets that are valid:
["curl-backend"]
["reqwest-backend", "reqwest-default-tls"]
["curl-backend", "reqwest-backend", "reqwest-default-tls"]
["reqwest-backend", "reqwest-rustls-tls"]
["curl-backend", "reqwest-backend", "reqwest-rustls-tls"]
["reqwest-backend", "reqwest-default-tls", "reqwest-default-tls"]
["curl-backend", "reqwest-backend", "reqwest-default-tls", "reqwest-default-tls"]

I'd love to be able to express this to cargo-all-features somehow. Right now I've just forced it to always have reqwest-backend and reqwest-rustls-tls on.

@NicolasKlenert NicolasKlenert linked a pull request Jun 1, 2023 that will close this issue
demmerichs added a commit to demmerichs/cargo-all-features that referenced this issue Sep 5, 2023
…fying very general feature set rules

Fix frewsxcv#42. See added tests.
@demmerichs
Copy link
Contributor

I opened a PR #50 that would allow to give the following specification, resulting in your required feature sets:

[features]
curl-backend = []
reqwest-backend = []
reqwest-default-tls = ["reqwest-backend"]
reqwest-rustls-tls = ["reqwest-backend"]

[package.metadata.cargo-all-features]
rules = [
    "'curl-backend'|'reqwest-backend'",
    "'reqwest-backend'=>'reqwest-default-tls'|'reqwest-rustls-tls'",
]

Feel free to use the PR in the meantime, read the README for more details of this feature, and give feedback. I also added a test case based off of this issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants