<#19730 Introduce call-by-name syntax for `@rules`...
# github-notifications
c
#19730 Introduce call-by-name syntax for `@rules` Issue created by stuhood (as motivated in #18905) Implementation sketch: 1.
rule_graph
crate changes: ☑︎ adjust the definition of
Get
(
DependencyKey
) for rule-graph solving to accept a fixed name/identifier for the rule to use, and some/all of its positional arguments ☑︎ adjust graph solving to use the explicitly specified arguments to skip solving 2. syntax changes: ☑︎ adjust the rule visitor (
AwaitableCollector
) to support extracting directly called
@rules
, in addition to the existing support for "rule helpers" ☑︎ introduce an
implicitly(..)
builtin, which takes arguments similar to
Get(TypeName, ..)
☐ add support for positional arguments to
@rule
calls ☐ add replacement
MultiGet
syntax ☐ determine new
@union
-usage syntax (or keep it type driven) 3. runtime changes: ☑︎ adjust the
@rule
decorator such that when it has been called directly (i.e., not called with some secret-handshake), it trampolines back out to fill the additional positional arguments and to begin memoization • applies to both
async def
and
def
@rules
, since the act of memoizing can potentially mean blocking to wait for a result computed by another task ☐ Use the
@rule
ids introduced in #19755 to drive
@rule
solving 4. deployment: ☐ add a
pants
-builtin goal which will execute a rewrite of one or more specified plugins or files from
await Get(TypeName, ..)
->
await rule_name(.., **implicitly(..))
• this requires rule-graph solving first (to select the
@rule
to use at each
Get
callsite), so the rewritten file must actually have been loaded pantsbuild/pants