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

[prost] includes prost crate infos in rust_analyzer_aspect #2232

Merged
merged 4 commits into from
Nov 1, 2023

Conversation

iamricard
Copy link
Contributor

The change is fairly straightforward, but I did need to move prost
providers up to prost/providers.bzl and out of private/prost.bzl to
avoid a cyclic dependency.

What we do is:

  • change rust_prost_library to return the rust_proto_info provider
  • in the rust-analyzer aspect we iterate over transitive dep infos and
    generate the appropriate RustAnalyzerInfo
  • lastly, we use the crate_info from ProstProtoInfo if we're
    processing a prost target as the "root" crate_info

There are a couple of things I'm not sure are correct:

  1. For every prost dep I set deps to [] - I think that's correct but
    I'm not sure-sure.
  2. Similarly I set proc_macro_dylib_path to always None - again I
    think that's correct, but not sure-sure.

Fixes #2121.

The change is fairly straightforward, but I did need to move prost
providers up to `prost/providers.bzl` and out of `private/prost.bzl` to
avoid a cyclic dependency.

What we do is:
* change `rust_prost_library` to return the `rust_proto_info` provider
* in the `rust-analyzer` aspect we iterate over transitive dep infos and
  generate the appropriate `RustAnalyzerInfo`
* lastly, we use the `crate_info` from `ProstProtoInfo` if we're
  processing a prost target as the "root" `crate_info`

There are a couple of things I'm not sure are correct:
1. For every prost dep I set `deps` to `[]` - I think that's correct but
   I'm not sure-sure.
2. Similarly I set `proc_macro_dylib_path` to always `None` - again I
   think that's correct, but not sure-sure.

Fixes bazelbuild#2121.
Copy link
Collaborator

@UebelAndre UebelAndre left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Awesome! Looks good to me!

@UebelAndre UebelAndre merged commit 25411ee into bazelbuild:main Nov 1, 2023
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Rust Analyzer Generation should also add Prost generated code to the seach paths
2 participants