How can I put all targets from a package into one variable in a higher-level package? I'm trying to create a simulation framework with the following architecture:
.
├── run_simulation.py
├──data
| ├── folder1
| │ ├── file_1.cvs
| │ ...
| │ └── file_k.csv
| ├── folder2
| │ ├── file_1.cvs
| │ ...
| │ └── file_k.csv
| └── BUILD
└── BUILD
the data/BUILD file consists of:
data_dirs = [
"folder1",
"folder2"
]
[
filegroup(
name = "my_cool_data_" + data_dir,
srcs = glob(["{}/*.csv".format(data_dir)]),
...
) for data_dir in data_dirs
]
and produce a target with experimental data per a folder.
I'd like to run the script run_simulation.py
with inputs from folders in the data directory with a command like:
$ bazel run run_simulation_<data target name>
so I have to add to the ./BUILD file
data_targets=[*do smth to get all targets from data/BUILD file*]
[
py_binary(
name = "run_simulation_" + data_target,
...
data = ["//data:{}".format(data_target)],
...
) for data_target in data_targets
]
The problem is how can I put all targets from the data package into a variable in the ./BUILD
file? I couldn't find a way to do this in the official documentation.