Essentially, I use custom output paths for my .pex files, and while testing out the docker_image target, I noticed some of my components fail with the error
ResolveError: Directory 'backend' does not contain any BUILD files
After a lot of debugging, I only ran into this problem when my output folders were common to multiple pex_binary targets.
For example, in the repo above, I have 3 identical projects (A, B, C) - where they only differ by the pex_binaryoutput_path (and this location updated in the associated Dockerfile), and one of the projects refuses to compile.
As per the README in the repo:
# Should create a pex at dist/backend/projecta/projecta.pex
# Docker image created successfully as projecta-container:latest
./pants package backend/projecta::
# Should create a pex at dist/backend.projectc/projectc.pex
# Docker image created successfully as projectc-container:latest
./pants package backend/projectc::
# Should create a pex at dist/backend/projectb.pex
./pants package backend/projectb:projectb
# FAILS: With ResolveError
./pants package backend/projectb:projectb-container
So, the difference above is that Project C uses no output_path and uses the dot-syntax for the dist folder. ProjectA places the pex file under a backend/projecta directory. The failing ProjectB places the pex file directly under backend.
This isn't a big issue, and easily worked around, and I'm guessing it has to do with namespacing or module/package semantics, but it's just a weird problem that is difficult to debug based on the error message.
Describe the bug
Created a repo at https://github.com/sureshjoshi/pantsbuild-14031 to help illustrate this problem.
Essentially, I use custom output paths for my .pex files, and while testing out the
docker_image
target, I noticed some of my components fail with the errorAfter a lot of debugging, I only ran into this problem when my output folders were common to multiple
pex_binary
targets.For example, in the repo above, I have 3 identical projects (A, B, C) - where they only differ by the
pex_binary
output_path
(and this location updated in the associated Dockerfile), and one of the projects refuses to compile.As per the README in the repo:
So, the difference above is that Project C uses no
output_path
and uses the dot-syntax for the dist folder. ProjectA places the pex file under abackend/projecta
directory. The failing ProjectB places the pex file directly underbackend
.This isn't a big issue, and easily worked around, and I'm guessing it has to do with namespacing or module/package semantics, but it's just a weird problem that is difficult to debug based on the error message.
Pants version
OS
macOS 12.1 Untested on Linux