google / cargo-raze

Generate Bazel BUILD from Cargo dependencies!
Apache License 2.0
479 stars 104 forks source link

Remove special logic for binary dependencies (`binary_deps`) #305

Open UebelAndre opened 3 years ago

UebelAndre commented 3 years ago

This is a followup of https://github.com/rust-lang/cargo/issues/1545 where special support was added to account for binary dependencies in Remote genmode. It's unclear as to whether what the future of binary dependencies will look like for cargo but for this project, this issue should stand as a reminder that we're doing something unique and should at some point conform to whatever cargo decides to do.

https://github.com/rust-lang/cargo/issues/1545 tracks a request to support a cargo clone command which can be used to clean up the implementation to support binary dependencies and reduce the amount of dependencies on cargo-raze.

Ultimately, once https://github.com/rust-lang/cargo/issues/8708 is totally resolved then there will likely be an action item here. This issue tracks that progress.

edit: Updated issue since https://github.com/rust-lang/cargo/issues/8888 is a duplicate of https://github.com/rust-lang/cargo/issues/1545

UebelAndre commented 3 years ago

https://github.com/rust-lang/rfcs/pull/3028 is also relevant here (and very exciting should it get approved and go through).

UebelAndre commented 3 years ago

I think there might be an easy path forward here. It would require updating the CrateContext list generated in the planning step to include an entry for the local package. Then some Bazel repository_rule could be written to take a url to some crate and download it and use. The rule would invoke cargo raze with some set of flags that cause it to render a build file for the local newly downloaded crate. This way we can clean up all the cruft created by the binary_deps functionality and the need for Cargo.raze.lock and be able to more directly rely/reuse existing cargo patterns. This might be the next thing I try to tackle. Interested in your thoughts here @acmcarther

UebelAndre commented 3 years ago

https://github.com/rust-lang/cargo/issues/9096 can potentially be a resolution to this issue.

UebelAndre commented 3 years ago

For documentation's sake, this feature was added in https://github.com/google/cargo-raze/pull/227