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

Allow composing rule implementations #16710

Open
lberki opened this issue Nov 9, 2022 · 2 comments
Open

Allow composing rule implementations #16710

lberki opened this issue Nov 9, 2022 · 2 comments
Assignees
Labels
P2 We'll consider working on this in future. (Assignee optional) team-Rules-API API for writing rules/aspects: providers, runfiles, actions, artifacts type: feature request

Comments

@lberki
Copy link
Contributor

lberki commented Nov 9, 2022

Description of the feature request:

It would be nice of the implementation of a Starlark rule could call the implementation of another rule.

There are two current answers to this functionality:

  • Macros (but they are much less powerful than rules and show up in bazel query, which is not ideal
  • Calling the implementation function of another rule (it may or may not be exported, doesn't work for native rules and requires the attributes of the calling rule to be set up just right including their names, types, applied aspects, toolchains and implicit dependencies)

I am not very certain if this is the right approach: this came up within the context of writing custom C++ rules and it could very well be that a better cc_common API would make this request superfluous. On the surface, however, I think it's useful to at least discuss it.

What underlying problem are you trying to solve with this feature?

No response

Which operating system are you running Bazel on?

No response

What is the output of bazel info release?

No response

If bazel info release returns development version or (@non-git), tell us how you built Bazel.

No response

What's the output of git remote get-url origin; git rev-parse master; git rev-parse HEAD ?

No response

Have you found anything relevant by searching the web?

No response

Any other information, logs, or outputs that you want to share?

No response

@lberki
Copy link
Contributor Author

lberki commented Nov 9, 2022

cc @comius @brandjon @lizkammer

@sgowroji sgowroji added team-Loading-API BUILD file and macro processing: labels, package(), visibility, glob type: bug type: feature request and removed team-Build-Language type: bug labels Nov 9, 2022
@brandjon brandjon added the P4 This is either out of scope or we don't have bandwidth to review a PR. (No assignee) label Nov 16, 2022
@brandjon
Copy link
Member

I'd like to look into this in 2023 as part of a larger effort to understand the best path for making macros and rules play nicer together.

@comius comius self-assigned this Dec 27, 2022
@comius comius added P2 We'll consider working on this in future. (Assignee optional) team-Rules-API API for writing rules/aspects: providers, runfiles, actions, artifacts and removed P4 This is either out of scope or we don't have bandwidth to review a PR. (No assignee) team-Loading-API BUILD file and macro processing: labels, package(), visibility, glob labels Dec 27, 2022
@comius comius changed the title Allow componsing rule implementations Allow composing rule implementations Dec 27, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
P2 We'll consider working on this in future. (Assignee optional) team-Rules-API API for writing rules/aspects: providers, runfiles, actions, artifacts type: feature request
Projects
None yet
Development

No branches or pull requests

4 participants