-
Notifications
You must be signed in to change notification settings - Fork 440
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
Allow overriding crate universe packages to local packages #2674
Merged
illicitonion
merged 8 commits into
bazelbuild:main
from
ograff:allow_overriding_crate_universe_packages_to_local_packages
Jun 6, 2024
Merged
Allow overriding crate universe packages to local packages #2674
illicitonion
merged 8 commits into
bazelbuild:main
from
ograff:allow_overriding_crate_universe_packages_to_local_packages
Jun 6, 2024
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ograff
force-pushed
the
allow_overriding_crate_universe_packages_to_local_packages
branch
from
June 3, 2024 20:08
57fa7fa
to
e2fa65d
Compare
In some cases it may be desirable to alias a public crate to a locally define rust_library target, even for dependencies of crates that are not being overriden. Support this use case by swapping out `alias` for `rust_library` when a user overrides the target using an annotation.
ograff
force-pushed
the
allow_overriding_crate_universe_packages_to_local_packages
branch
from
June 3, 2024 20:13
e2fa65d
to
42e4639
Compare
LGTM! I made a PR with one suggested modification in ograff#1 - PTAL and merge into this branch or discuss, and I'm happy to merge this :) Thanks! |
Externalise alias keys
@illicitonion that change looks great, I went ahead and merged it in. Is your preference for me to squash all these commits to one pre-merge or leave the history as is? |
We auto-squash on merge, so don't worry about it, GitHub will deal with it for us! Thanks! |
illicitonion
approved these changes
Jun 6, 2024
github-merge-queue bot
pushed a commit
that referenced
this pull request
Jun 10, 2024
The ability to override crate targets when using crate_universe was added here: #2674 However, this change did not expose that functionality when using bzlmod. This change adds that functionality in. Because of the limited set of options we have for dictionaries in tag classes, I had to split out "override_targets" into four different options, each taking a Label. I have added in an example based on the example given in #2674 , but using bzlmod instead. I have also tested that example and found it to be working.
rrbutani
referenced
this pull request
in bazel-contrib/toolchains_llvm
Jun 10, 2024
[![Mend Renovate](https://app.renovatebot.com/images/banner.svg)](https://renovatebot.com) This PR contains the following updates: | Package | Type | Update | Change | |---|---|---|---| | rules_rust | bazel_dep | minor | `0.45.1` -> `0.46.0` | | [rules_rust](https://togithub.com/bazelbuild/rules_rust) | http_archive | minor | `0.45.1` -> `0.46.0` | --- ### Release Notes <details> <summary>bazelbuild/rules_rust (rules_rust)</summary> ### [`v0.46.0`](https://togithub.com/bazelbuild/rules_rust/releases/tag/0.46.0) [Compare Source](https://togithub.com/bazelbuild/rules_rust/compare/0.45.1...0.46.0) ##### 0.46.0 ```python load("@​bazel_tools//tools/build_defs/repo:http.bzl", "http_archive") http_archive( name = "rules_rust", integrity = "sha256-F8U7+AC5MvMtPKGdLLnorVM84cDXKfDRgwd7/dq3rUY=", urls = ["https://github.com/bazelbuild/rules_rust/releases/download/0.46.0/rules_rust-v0.46.0.tar.gz"], ) ``` Additional documentation can be found at: https://bazelbuild.github.io/rules_rust/#setup ##### What's Changed - fix: default rustfmt version to supplied rust version by [@​mattem](https://togithub.com/mattem) in [https://github.com/bazelbuild/rules_rust/pull/2660](https://togithub.com/bazelbuild/rules_rust/pull/2660) - Use repo-mapping-aware runfiles API in rust-analyzer by [@​dzbarsky](https://togithub.com/dzbarsky) in [https://github.com/bazelbuild/rules_rust/pull/2666](https://togithub.com/bazelbuild/rules_rust/pull/2666) - Fix protobuf generated srcs to include all sources by [@​matts1](https://togithub.com/matts1) in [https://github.com/bazelbuild/rules_rust/pull/2676](https://togithub.com/bazelbuild/rules_rust/pull/2676) - Fix cargo_build_script executables. by [@​matts1](https://togithub.com/matts1) in [https://github.com/bazelbuild/rules_rust/pull/2675](https://togithub.com/bazelbuild/rules_rust/pull/2675) - crate_universe: Don't include crate name in build script path. by [@​criemen](https://togithub.com/criemen) in [https://github.com/bazelbuild/rules_rust/pull/2663](https://togithub.com/bazelbuild/rules_rust/pull/2663) - Ensure dynamic library dependencies end up in the runfiles directory by [@​EdSchouten](https://togithub.com/EdSchouten) in [https://github.com/bazelbuild/rules_rust/pull/2671](https://togithub.com/bazelbuild/rules_rust/pull/2671) - use bazel_ci_rules bazel_dep instead of http_archive by [@​mmorel-35](https://togithub.com/mmorel-35) in [https://github.com/bazelbuild/rules_rust/pull/2678](https://togithub.com/bazelbuild/rules_rust/pull/2678) - Ensure that running `bazel build` on a cargo_build_script target actually runs the build script by [@​matts1](https://togithub.com/matts1) in [https://github.com/bazelbuild/rules_rust/pull/2680](https://togithub.com/bazelbuild/rules_rust/pull/2680) - Allow overriding crate universe packages to local packages by [@​ograff](https://togithub.com/ograff) in [https://github.com/bazelbuild/rules_rust/pull/2674](https://togithub.com/bazelbuild/rules_rust/pull/2674) - Depend on a copy of rustfmt for the target by [@​EdSchouten](https://togithub.com/EdSchouten) in [https://github.com/bazelbuild/rules_rust/pull/2685](https://togithub.com/bazelbuild/rules_rust/pull/2685) - \[Bugfix] Convert metadata keys to screaming snake case instead of screaming kebab case in `cargo_build_script_runner` by [@​Pagten](https://togithub.com/Pagten) in [https://github.com/bazelbuild/rules_rust/pull/2682](https://togithub.com/bazelbuild/rules_rust/pull/2682) - Add support for override_target when using bzlmod by [@​AmeliasCode](https://togithub.com/AmeliasCode) in [https://github.com/bazelbuild/rules_rust/pull/2683](https://togithub.com/bazelbuild/rules_rust/pull/2683) - Release 0.46.0 by [@​illicitonion](https://togithub.com/illicitonion) in [https://github.com/bazelbuild/rules_rust/pull/2686](https://togithub.com/bazelbuild/rules_rust/pull/2686) ##### New Contributors - [@​mattem](https://togithub.com/mattem) made their first contribution in [https://github.com/bazelbuild/rules_rust/pull/2660](https://togithub.com/bazelbuild/rules_rust/pull/2660) - [@​EdSchouten](https://togithub.com/EdSchouten) made their first contribution in [https://github.com/bazelbuild/rules_rust/pull/2671](https://togithub.com/bazelbuild/rules_rust/pull/2671) - [@​mmorel-35](https://togithub.com/mmorel-35) made their first contribution in [https://github.com/bazelbuild/rules_rust/pull/2678](https://togithub.com/bazelbuild/rules_rust/pull/2678) - [@​ograff](https://togithub.com/ograff) made their first contribution in [https://github.com/bazelbuild/rules_rust/pull/2674](https://togithub.com/bazelbuild/rules_rust/pull/2674) - [@​Pagten](https://togithub.com/Pagten) made their first contribution in [https://github.com/bazelbuild/rules_rust/pull/2682](https://togithub.com/bazelbuild/rules_rust/pull/2682) **Full Changelog**: bazelbuild/rules_rust@0.45.1...0.46.0 </details> --- ### Configuration 📅 **Schedule**: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined). 🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied. ♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox. 🔕 **Ignore**: Close this PR and you won't be reminded about these updates again. --- - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box --- This PR has been generated by [Mend Renovate](https://www.mend.io/free-developer-tools/renovate/). View repository job log [here](https://developer.mend.io/github/bazel-contrib/toolchains_llvm). <!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzNy4zOTMuMCIsInVwZGF0ZWRJblZlciI6IjM3LjM5My4wIiwidGFyZ2V0QnJhbmNoIjoibWFzdGVyIiwibGFiZWxzIjpbXX0=--> Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Allow external crates to be aliased to local targets
In some cases it may be desirable to alias a public crate to a locally
define rust_library target, even for dependencies of crates that are not
being overriden.
Support this use case by swapping out
alias
forrust_library
whena user overrides the target using an annotation.