powerful-eye-58407
04/26/2023, 7:45 AM<root>
└── serviceA
└── (python sources, importing lib/moduleA.py)
└── common-lib (git submodule, already migrated to pants)
└── src
└── moduleA.py
└── moduleB.py
└── tests
└── test_moduleA.py
└── BUILD
└── pants.toml
└── pants.toml
└── BUILD
pants.toml in submodule is ignored by pants (as expected).
pants.toml in the root of the service repo contains the following:
subproject_roots = [
"/common-lib",
]
[source]
root_patterns = [
"/service",
"/common-lib",
]
Now, I understand that subproject_roots are intended to tweak the dependencies paths used in submodule's BUILD files by appending /common-lib to the path, if required.
But it looks like this mechanism doesn't work, when I use "overrides" as below:
python_tests(
name="tests",
overrides={
"test_moduleA.py": {
"dependencies": [
"src/moduleB.py"
]
}
},
)
When running pants test ::
from the root dir, I get the following error:
ResolveError: The file or directory 'src/moduleB.py' does not exist on disk in the workspace, so the address 'src/moduleB.py' from the `dependencies` field from the target common-lib/tests/test_moduleA.py:tests cannot be resolved.
Now, I can change directory to common-lib and run pants test ::
from there, and it works fine.
But I was wondering if that could become a problem, if I will have at some point to specify some dependency using "overrides" in build file for some lib module that I actually need in the service.
Is this the expected behavior?
Thanks in advance for any help!refined-addition-53644
04/26/2023, 8:18 AMsubproject_roots?
I have never heard about it. What pants version is it?
Also two pants.toml
is completely new for me.powerful-eye-58407
04/26/2023, 8:30 AMAlso twothis is only because our common-lib (built by pants) is a submodule of another git repo with a service, managed by pants as well. So, the nested pants.toml for submodule is ignored when building the service repo with pants.is completely new for me.pants.toml