How to set up Bazel with local Rust crates? #27984
Closed
thmsbinder
started this conversation in
General
Replies: 2 comments
-
|
FYI @UebelAndre This is better to be filed against the rules_rust repo though. |
Beta Was this translation helpful? Give feedback.
0 replies
-
|
Moved to bazelbuild/rules_rust#3778. Closing here. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
I want to set up a hermetic bazel build with Rust toolchain, pre-fetching all the dependencies and passing them via
--distdirpointing to a local directory. Rust crates are served from crates.io, via URLs of the formhttps://static.crates.io/crates/$CRATE_NAME/$CRATE_VERSION/download
With bazel's distdir conventions, all crates are identified under the key
download(the basename of the URL) and their hash, so there need to be as many distdirs as there are crates. That's technically correct and will work, but practically infeasible, since this would involve--distdir d1 ... --distdir d999, with only one file nameddownloadin each distdir.I also tried to use a rewrite rule with
--downloader_config, but it is only intended for URLs (http or https). It's not possible to rewrite to a local file (i.e. rewrite https:// to file://).Question is, what's the best way to keep the Rust dependencies local and manageable, ideally in a single local directory where all crates appear under a meaningful name, e.g.
crates/${CRATE_NAME}__${CRATE_VERSION}.crate?Beta Was this translation helpful? Give feedback.
All reactions