-
Notifications
You must be signed in to change notification settings - Fork 444
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
Support path dependencies for Cargo.toml patches #3071
base: main
Are you sure you want to change the base?
Conversation
Hi @P1n3appl3! Sorry for not picking up your work here earlier. I recently added quite a similar change in #3025 which is intended to make path dependencies and Let me know what you think and how you'd like to proceed - I'm not particularly attached to what I merged (other than the tests, the tests are useful! Including #3063 which adds tests that live edits to the source code behind the path dependency work). |
Hey @illicitonion, I tried running crate_universe from 0.56.0, which I think include your changes, on Fuchsia's setup, and it didn't work for me. Can you extend your patch path support for vendor as well? It'll greatly help our project. I saw the following error when generating build files:
For askama, we have the following entry in our Cargo.toml (this is the full file if it helps):
This is the crate_vendor Bazel target I'm using:
|
This makes
cargo_bazel
respect the[patch]
section in the manifest when usingcrates_vendor
. This change was originally proposed in #1902, and this PR is a cleaned up version of that.The added example and docs section show the resulting BUILD files and directory structure, but here's a high level description:
cargo vendor
will no longer download crates which are patched outThat last one was the main point of discussion when this change was initially proposed (see this comment). There are several options here, such as having
cargo_bazel
generate BUILD files outside the vendor dir, or having the user manually write BUILD files for each patch. We still believe that the compromise of manually writing BUILD files that expose filegroups and lettingcrates_vendor
still generate BUILD files in the normal vendor dir is ideal for a couple of reasons:cargo_bazel
generate files outside of the vendor dir is highly surprising for users, and it'd establish a brittle 2-way dependency between the generated BUILD files inside and outside the vendor dir. If either were ever moved it'd require some nontrivial fixup.Fuchsia's adoption of bazel for rust is still blocked on this feature. We're happy to make changes or add tests that the maintainers deem necessary so that we can get this landed and avoid having to maintain these patches on top of upstream. We're successfully using this change now, and besides the integration test added in the example, we'll make sure that this feature continues working as we update rules_rust regularly.