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

Feature Request: Add Starlark method to create a ProtoInfo provider #11060

Open
cheister opened this issue Apr 3, 2020 · 5 comments
Open

Feature Request: Add Starlark method to create a ProtoInfo provider #11060

cheister opened this issue Apr 3, 2020 · 5 comments
Labels
P3 We're not considering working on this, but happy to review a PR. (No assignee) team-Rules-Server Issues for serverside rules included with Bazel type: feature request

Comments

@cheister
Copy link
Contributor

cheister commented Apr 3, 2020

Description of the problem / feature request:

Currently the only way to create a ProtoInfo provider in Starlark is to use the native proto_library rule to generate one. This limitation means you cannot implement a proto_library rule in Starlark that works with the native proto rules.

Feature requests: what underlying problem are you trying to solve with this feature?`

The main issue this helps workaround is #10744 where we want to create a proto_libary rule with sources that come from an external jar. This may not make sense to add to the native proto_library rule so we wrote our own rule to implement it instead.

The second issue is rewriting the native proto_library rule in Starlark #10005. If we can create a ProtoInfo provider in Starlark we can write a Starlark proto_library rule that will support the "sandwich" interoperability principle with the native proto rules.

My proposed API mentioned in the discussion of #10966 for the proto_common method is

proto_info = create_proto_info(
  proto_source_root,
  descriptor_set,
  sources,
  deps,
  exports
)

Which only exposes parts of protoInfo that directly correspond to arguments that are passed to protoc.

@dslomov dslomov added team-Rules-Server Issues for serverside rules included with Bazel untriaged labels Apr 3, 2020
@Yannic
Copy link
Contributor

Yannic commented Apr 20, 2020

(If possible: block on #10939 which changes some internals of ProtoInfo)

Do I understand correctly that this is merely going to be a constructor for ProtoInfo (i.e. the caller is responsible for creating the descriptor set)?

@cheister
Copy link
Contributor Author

Ok, I'll try rebasing on #10939 and see what's different.

But yes, this is just a constructor that lets Starlark rules create ProtoInfo objects as if they were a Provider declared in Starlark. So the rule will have to create the descriptor set as a file and pass it as an argument.

@lberki lberki added P3 We're not considering working on this, but happy to review a PR. (No assignee) type: feature request and removed untriaged labels Nov 18, 2020
@TimoPtr
Copy link

TimoPtr commented Jun 29, 2022

@cheister any update on your suggestion? I see that in BazelProtoCommon protoInfo is annotated with StarlarkMethod but I didn't find any way to use it in starlark

@github-actions
Copy link

github-actions bot commented Sep 3, 2023

Thank you for contributing to the Bazel repository! This issue has been marked as stale since it has not had any activity in the last 1+ years. It will be closed in the next 90 days unless any other activity occurs or one of the following labels is added: "not stale", "awaiting-bazeler". Please reach out to the triage team (@bazelbuild/triage) if you think this issue is still relevant or you are interested in getting the issue resolved.

@github-actions github-actions bot added the stale Issues or PRs that are stale (no activity for 30 days) label Sep 3, 2023
@Yannic
Copy link
Contributor

Yannic commented Sep 3, 2023

Still a useful feature

@github-actions github-actions bot removed the stale Issues or PRs that are stale (no activity for 30 days) label Sep 4, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
P3 We're not considering working on this, but happy to review a PR. (No assignee) team-Rules-Server Issues for serverside rules included with Bazel type: feature request
Projects
None yet
Development

No branches or pull requests

5 participants