You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Change the cc_common.compile, cc_common.link, cc_common.create_linking_context_from_compilation_outputs, and cc_common.register_linkstamp_compile_action boundaries to accept ctx. The boundaries convert an actions value supplied as ctx once for migration compatibility, while compile, link, LTO, and linkstamp implementations receive the rule context directly. Wrapped link_actions remain separate only where shareable or alternate-configuration link artifacts require them.
Rationale
The action-only parameters forced implementation code to recover the rule context repeatedly through actions2ctx_cheat. Passing ctx from rules_cc callers removes those downstream conversions and gives each implementation direct access to the exact rule context fields it uses.
dzbarsky
changed the title
[codex] Pass ctx through C++ action construction
Pass ctx through C++ action construction
Jun 18, 2026
I believe the intent was to remove the usage of ctx, for functions receive the things that are actually required, and that this was simply incomplete.
Passing in ctx again would then be a step backwards on that particular road.
That's fair, but is anyone actually working on that? OTOH landing this PR allows to remove this actions2ctx_cheat method from the Java host side, which gives a tanglible simplification/improvement to the system, and doesn't actually prevent anyone from doing this (very non-trivial) no-ctx cleanup in the future, if there is appetite.
(As an aside, I think it's fine to just wire ctx everywhere, rule_go tries to do a similar thing with wiring a go context everywhere instead of the real ctx, and it also has to resort to go._ctx cheat in some places...)
This file contains hidden or 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
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.
Summary
Change the
cc_common.compile,cc_common.link,cc_common.create_linking_context_from_compilation_outputs, andcc_common.register_linkstamp_compile_actionboundaries to acceptctx. The boundaries convert anactionsvalue supplied asctxonce for migration compatibility, while compile, link, LTO, and linkstamp implementations receive the rule context directly. Wrappedlink_actionsremain separate only where shareable or alternate-configuration link artifacts require them.Rationale
The action-only parameters forced implementation code to recover the rule context repeatedly through
actions2ctx_cheat. Passingctxfrom rules_cc callers removes those downstream conversions and gives each implementation direct access to the exact rule context fields it uses.