rules_rust
rules_rust copied to clipboard
Crate Universe feature request: skipping dependencies
Much like my previous issue on here, I'm in the process of moving a repo from using cargo raze over to crate universe, and I've hit one of the stranger packages in our dependencies. We currently (indirectly) depend on a library that generates bindings for a C library in its build.rs file. Because of how it does so, we have to basically replace the whole crate with our own bazel-friendly implementation.
To enable these kinds of scenarios, cargo raze provided a skipped_deps option. You can see an excerpt from their readme below:
In a few cases, the sys crate may need to be overridden entirely. This can be facilitated by removing and supplementing dependencies in the Cargo.toml, pre-generation:
[package.metadata.raze.crates.sdl2.'0.31.0']
skipped_deps = [
"sdl2-sys-0.31.0"
]
additional_deps = [
"@//cargo/overrides/sdl2-sys:sdl2_sys"
]
Unfortunately, this usecase is not currently supported by crate universe, making it impossible to implement this crate.
I've started implementing a potential fix, but given I'm not very familiar with the codebase, I wanted to add an issue to track this, and in case someone with a better understanding of this repo beats me to it.
This seems like a very reasonable feature request - I quite like how rules_jvm_external models this as "override_targets": https://github.com/bazelbuild/rules_jvm_external#overriding-generated-targets
Also, instead, I guess this may be vaguely able to be cobbled together today by using the patches section of a Cargo.toml file?
Either way, please reach out here or on Slack if you need a hand implementing!
Oh, I hadn't thought about using patches to do that :thinking:
That would at least get me unblocked! I'll give that a try and might reach out on slack, thanks @illicitonion :smile:
I think this is resolved by https://github.com/bazelbuild/rules_rust/pull/2674