Does anybody know if Pants supports dynamic target...
# general
g
Does anybody know if Pants supports dynamic target dispatching based on system arch? like:
Copy code
if platform == "macos_arm64":
  ...
elif platform == "linux_x86_64":
  ...
Analogous functionality in Bazel is
config_setting
https://bazel.build/reference/be/general#config_setting
b
You can use
if
directly. To detect the current platform, potentially a reasonable way is to set an environment variable in
.pants.bootstrap
and then read it with
env(name_of_variable)
(In the BUILD file) https://www.pantsbuild.org/stable/docs/using-pants/key-concepts/options#pantsbootstrap-file