Pass ctx through C++ action construction - #756
Conversation
93104bb to
73db1e4
Compare
|
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 (As an aside, I think it's fine to just wire |
@c-mita do you recall where or with whom this was discussed? Are there opinions on rules API design I should know about? I generally like the idea of removing the low-complexity Java code but this would also require changing rules_swift's public API (its compile|link equivalents also don't take ctx; almost all other cc_common.compile|link call sites have ctx available) in addition to updating a lot of callers. |
|
FWIW I asked on the original PR that added these,
and never received a response from the original author. To my knowledge nobody is working on actually cleaning any of that up, but various folks are OOO for the week. I know other rulesets go to great lengths to avoid the passage of |
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.