https://pantsbuild.org/ logo
#general
Title
# general
p

purple-plastic-57801

03/06/2023, 10:37 PM
Let's say I have a directory testdata with 5 files in it. Can I somehow loop in a BUILD file to create a resource for each file in the testdata dir?
b

broad-processor-92400

03/06/2023, 10:48 PM
Target generators like
resources
are best, but if you have to, normal Python loops work too, e.g. we have a BUILD file with a loop like
Copy code
info = [("a", 123), ("b", 456), ...]
for x, y in info:
    some_target(name=x, some_field=x, other_field=y)
👍 1
3 Views