Hey! I'm evaluating pants as an alternative to Baz...
# general
v
Hey! I'm evaluating pants as an alternative to Bazel, and am trying to write a simple shell target that the build system will run. I copied the example from the docs, from here: https://www.pantsbuild.org/stable/docs/shell/run-shell-commands and put it in my
BUILD
file, but I'm getting the following error:
Copy code
InvalidTargetException: BUILD:1: Unrecognized field `dependencies=(':shell-scripts', ':images')` in target //. Valid fields for the target type `shell_command`: ['_sources', 'cache_scope', 'command', 'description', 'environment', 'execution_dependencies', 'experimental_named_caches', 'extra_env_vars', 'log_output', 'output_dependencies', 'output_directories', 'output_files', 'outputs_match_mode', 'path_env_modify', 'root_output_directory', 'runnable_dependencies', 'tags', 'timeout', 'tools', 'workdir', 'workspace_invalidation_sources'].
My pants version matches the docs one,
2.30
Any ideas, have I enabled the wrong backend or something like that?
My pants.toml looks like this:
Copy code
[GLOBAL]
pants_version = "2.30.0"
backend_packages = [
  "pants.backend.shell",
]
w
Sorry for that, it looks like the docs on that command are stale (or a typo), the
dependencies
should be one of the more specific deps. https://www.pantsbuild.org/stable/reference/targets/shell_command That sample code runs. FYI, I'm in the process of running through all the docs to look for consistency issues and cleanup, so that would include stuff like this
v
Ah thank you!
w
👍 Just a heads up, you might also want to look into adhoc_tool - as there is some good documentation around limitations of shell-related code https://www.pantsbuild.org/stable/docs/ad-hoc-tools/integrating-new-tools-without-plugins#running-shell-scripts So, shell_command (and variants) can get you far, but adhoc_tool docs call out some limitations or workarounds as well, thus I always recommend people read both (and they'll be closer together in the doc updates I'm doing)
✅ 1