Enable feature for all workspace for specific target(architecture)?

I have workspace with create foo and boo which use http crate reqwest,
that depend on crate, that depend on crate and so on and finally depend on openssl-sys.

I build my project for linux and android. And because of there is no openssl in android native SDK,
I have to build it my self for android, and I want to use system openssl for linux.
The problem how can I do it in the most ergonomic way?

I can do it like this:

[workspace]
members = ["foo", "boo"]

[patch.'crates-io']
openssl-sys = { version = "0.9.55", features = ["vendored"]}

But this build openssl also for linux.

I can specify android only stuff:

[target.'cfg(android)'.dependencies]
openssl-sys = { version = "0.9.55", features = ["vendored"]}

but I have to repeat this stuff in "foo" and "boo".

Is any way to combine patch.crates-io and target.'cfg(android)' ?

In other words enable feature in all workspace for specific target(architecture)?

1 Like

I don't think there's a feature for this.

If one of your crates is a common dependency to the others, you can just enable the vendored feature in that one, and it will be unified for the rest. If you have a lot of crates but not one in common, then it might be worth making a tiny glue crate for this.

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.