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

Crate Universe feature request: skipping dependencies #1599

Open
rdelfin opened this issue Oct 21, 2022 · 3 comments
Open

Crate Universe feature request: skipping dependencies #1599

rdelfin opened this issue Oct 21, 2022 · 3 comments

Comments

@rdelfin
Copy link

rdelfin commented Oct 21, 2022

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.

@illicitonion
Copy link
Collaborator

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!

@rdelfin
Copy link
Author

rdelfin commented Oct 21, 2022

Oh, I hadn't thought about using patches to do that 🤔
That would at least get me unblocked! I'll give that a try and might reach out on slack, thanks @illicitonion 😄

@robin-wayve
Copy link

I think this is resolved by #2674

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