I would like to build a dynamic target list for my py_binary.
Actually : BUILD.bazel
py_binary(
name = "launch",
srcs = glob(*.py)
)
Supposed : BUILD.bazel
load("deps.bzl", "generate_target")
py_binary(
name = "launch",
srcs = glob(*.py)
data = generate_target()
)
Supposed deps.bzl:
def generate_target():
# TODO
I got a script python which return my target list just like "["//:target0", "//:target1"...]", depends on config. Generate_target function, have to use my script python to generate the target list, and return it. But I don't know how can I do.
I try to use a native.genrule, native.py_binary or ctx.actions.run inside generate_target(), but I can't collect my target list.
Someone got an idea ?
Thanks