<#20575 2.20 changes `adhoc_tool` to resolve targe...
# github-notifications
c
#20575 2.20 changes `adhoc_tool` to resolve target specs in `execution_dependencies` relative to `runnable`, not target Issue created by huonw Describe the bug It seems 2.20 changes behaviour for how the dependency target specs are resolved in a BUILD file like:
Copy code
file(name="f", source="f.txt")

adhoc_tool(
    name="tool",
    runnable="a:cat",
    args=["f.txt"],
    execution_dependencies=[":f"],
    log_output=True,
)
If that's in
b/
, then the
execution_dependencies
field refers to: • 2.19:
b:f
• 2.20:
a:f
This is a regression/breakage that may require users to update code, so, if it's a desirable change, we'd preferably not do it without warning/deprecation (although it is experimental, so maybe we decide it's worth it)... but it seems undesirable? Reproducer:
Copy code
cd $(mktemp -d)

cat > pants.toml <<EOF
[GLOBAL]
pants_version = "2.20.0a0"

backend_packages = [
  "pants.backend.experimental.adhoc",
]
EOF

mkdir -p a b

cat > a/BUILD <<EOF
system_binary(name="cat", binary_name="cat")
EOF

cat > b/BUILD <<EOF
file(name="f", source="f.txt")

adhoc_tool(
    name="tool",
    runnable="a:cat",
    args=["f.txt"],
    execution_dependencies=[":f"],
    log_output=True,
)
EOF

echo "contents of f.txt here" > b/f.txt

# OKAY: successfully cats the file, and exports
PANTS_VERSION=2.19.0 pants export-codegen b:tool

# BUG: 'ResolveError: The address a:f from the `execution_dependencies` from the target a:cat does not exist.'
pants export-codegen b:tool
Pants version 2.20.0a0 This appears to be be a regression from 2.20.0.dev3 (works like 2.19) to 2.20.0.dev4 (has this new behaviour). • https://github.com/pantsbuild/pants/releases/tag/release_2.20.0.dev4release_2.20.0.dev3...release_2.20.0.dev4 OS macOS Additional info N/A pantsbuild/pants