Skip to content

Add excludes to cc_action_type_set#669

Open
keith wants to merge 1 commit intobazelbuild:mainfrom
keith:ks/add-excludes-to-cc_action_type_set
Open

Add excludes to cc_action_type_set#669
keith wants to merge 1 commit intobazelbuild:mainfrom
keith:ks/add-excludes-to-cc_action_type_set

Conversation

@keith
Copy link
Copy Markdown
Member

@keith keith commented Mar 26, 2026

This makes it easier to compose action sets that are very similar to
other ones but excluding a few things. This is used today for
lto_backend, and in this change is also used for header parsing, which
produces a warning when -c is passed.

This makes it easier to compose action sets that are very similar to
other ones but excluding a few things. This is used today for
lto_backend, and in this change is also used for header parsing, which
produces a warning when `-c` is passed.
)

cc_action_type_set(
name = "compile_actions_without_header_parsing",
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

This seems a little overkill since we can just do this:

cc_action_type_set(
    name = "source_compile_actions",
    actions = [
        ":compile_actions_without_header_parsing",
        ":cpp_header_parsing",
    ],
)

I'm not convinced the set of actions is unruly enough to justify extending the API, but it's possible there are more complex usages that could justify it.

I'd prefer for the case of fixing this bug we keep the solution simple.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Which immediately pushes the complexity further down... let me see if there's a path to cleaning this up without making a huge mess.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

i think one nice thing about the exclusion api is it's much more clear looking at a target definition like this that it's not missing anything else, where in the current source_compile_actions just looking at the definition you can't easily spot the things that are being omitted, and you also can't spot things that were accidentally left out as new actions are addedd

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Purely accumulating doesn't look too bad after a bit of cleanup: #686

I could be convinced that excludes is justified if there are further compelling examples that live outside of rules_cc.

@hvadehra hvadehra removed their request for review April 9, 2026 16:46
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.

2 participants