cool-easter-32542
05/16/2023, 6:51 PMfile(
name="downloaded-jq",
source = http_source(
len = 3953824,
sha256 = "af986793a515d500ab2d35f8d2aecd656e764504b789b66d7e1a0b727a124c44",
url = "<https://github.com/stedolan/jq/releases/download/jq-1.6/jq-linux64>",
),
)
shell_command(
name = "sandboxed-jq",
command="chmod +x jq-linux64",
tools = ["chmod"],
execution_dependencies=[":downloaded-jq"],
output_directories = ["."],
)
run_shell_command(
name = "jq",
command=f"{{chroot}}/{build_file_dir() / 'jq-linux64'}",
execution_dependencies=[":sandboxed-jq"],
workdir="/",
)
Run with:
$ pants run //:jq -- --help
yields usage:
Usage: /tmp/pants-sandbox-zLIAv5/3rdparty/tools/jq-linux64 [options] <jq filter> [file...]
/tmp/pants-sandbox-zLIAv5/3rdparty/tools/jq-linux64 [options] --args <jq filter> [strings...]
/tmp/pants-sandbox-zLIAv5/3rdparty/tools/jq-linux64 [options] --jsonargs <jq filter> [JSON_TEXTS...]
Pants version
main
OS
Linux
Additional info
pantsbuild/pantscool-easter-32542
05/16/2023, 9:21 PM