I am new to using pantsbuild and I can't seem to find any good questions, answers, or documentation around my dillema.
I have a Pants project which should be buildable on its own. It has its own pants
and pants.ini
file as well as all BUILD
files containing paths relative to the project root (where pants.ini
is). This project is hosted on GitHub.
I'd like to use this project as a dependency in a second project. I've chosen to use git submodules to do this. Now, I have a layout like the following:
path
├── pants
├── pants.ini
├── projectA
│ └── src
│ └── python
| └── main
│ ├── BUILD
│ └── main.py
└── projectB
├── pants
├── pants.ini
└── src
└── python
├── libA
| ├── BUILD
| └── lib.py
└── libB
├── BUILD
└── lib.py
Naturally, I am looking to use projectB's BUILD targets from within projectA, so in projectA's BUILD
, I have something of the sort:
dependencies = [ "projectB/src/python:libA" ]
This is all well and good. However, since projectB is an independent project, it's src/python/libA/BUILD
file contains something of the sort:
dependencies = [ "src/python:libB" ]
Because of this, projectB can indeed be built independently. However, when trying to build projectA, the build targets from projectB search starting from projectA's project root, for instance:
Exception Message: libB was not found in BUILD files from path/src/python
Does pantsbuild have any clean way to handle these subproject dependencies? Or would I be forced to alter the BUILD files of the subproject in order to fit them within my project layout (Causing the project to be unbuildable independently)?
Any solutions or advice is welcomed!