Question on the rule graph. I've made a plugin th...
# plugins
f
Question on the rule graph. I've made a plugin that can convert
.foo
files into
.bar
format. It does dependency inference and everything. Now I've written a second plugin that converts
.bar
files into
.baz
files. The
.foo
files are my primary sources. But when I try to HydrateSources with enable_codeen and the for_sources_type set to
.baz
, none of the rules are invoked, nor are the dependency inference functions. What is the secret to get it to chain the two rules together?
f
The work-around would be to install another
GenerateSourcesRequest
handler which could invoke
.foo
->
.bar
->
.baz
.
(I surmise that the handler could probably just invoke the existing logic you've already written for the other conversions.)
f
Hmm. Ok. That's going to be rather limiting.
Um... How do I invoke the second step? I guess now that there's call by name I can just call my rule function directly?
f
Presumably. You could also invoke
generate_sources
or
hydrate_sources
with the
request
argument as your applicable subclass of
GenerateSourcesRequest
or
HydratesSourceesRequest
, respectively. Basically hard-code what a chaining impl might do.
f
ok, I'm trying this... From the first HydrateSources call, I ended up with a HydratedSources object with the
.bar
files in its snapshot. How do I convert that into a SourcesField to call HydrateSources the second time?
The second HydrateSources ends up failing on an unmatched glob for the file generated by the first one.
I guess I could call workspace.write_digest() in between, but that feels gross.
heh. that worked. 😆 So what's the right way to do it?