https://pantsbuild.org/ logo
#development
Title
# development
a

aloof-angle-91616

08/16/2019, 9:48 PM
but you can
yield
that
Get
within a rule, it just won't be checked at compile time and may fail if the Get can't be satisfied, i think
h

hundreds-breakfast-49010

08/16/2019, 9:54 PM
I'm currently trying to make use of a
Get
rule in a function that isn't itself a rule
it's used by a rule
and I'm not sure if that even makes sense to do
a

aloof-angle-91616

08/16/2019, 9:54 PM
it might make sense to do, i didn't think it would but after i thought about it i think the only special thing about gets in rules is that it announces the possibility of that Get to the engine
i don't know what control flow you're thinking of
h

hundreds-breakfast-49010

08/16/2019, 10:01 PM
I have a list of directory paths
I want to turn those into a list of
PathGlobs
and then get a list of
Snapshots
from those, which I don't know how to do other than with
yield Get
basically I want to see which of those paths actually exists on the filesystem in a v2-compatible way
hm, does
yield Get
do basically teh same thing as
scheduler.product_request
?
in general if I have an
@rule
, and that
@rule
invokes a non-
@rule
function that internally uses
yield Get
is there a way I can pass something from the
@rule
to the non-
@rule
in order to make the
yield
work?
a

aloof-angle-91616

08/17/2019, 1:39 AM
hm, does
yield Get
do basically teh same thing as
scheduler.product_request
?
yes!
you can make multiple rules here, and i would actually recommend it! you can see how this is done in https://github.com/pantsbuild/pants/blob/master/src/python/pants/backend/native/subsystems/native_toolchain.py, where intermediate types are used to represent phases of preparing the compiler and linker
is there a reason that wouldn't work?