Question: should I be able to use visibility rules...
# general
Question: should I be able to use visibility rules to create two projects like this with the same import path (both being app)? I tried this, but it seems to not work.
pants test ::
Gives an error:
Copy code
12:03:57.81 [WARN] The target project1/app/ imports ``, but Pants cannot safely infer a dependency because more than one target owns this module, so it is ambiguous which to use: ['project1/app/', 'project2/app/'].
The visibility rules won't affect the deps that are inferred. Those rules are applied later to validate the dependencies after inference. However in Pants 2.16 this ambiguity will be resolved by source root, so project1/app/ will depend on project1/app/ because they are in the same source root, and not on project2/app/, because (I assume) it is in a separate source root?
👍 1
In this example I do use source root with marker files and 2.16.0.dev7. Is this part of a later dev release? I saw before it was discussed here, but I now see it was decided to not support use case 2.
I see I can do
ambiguity_resolution = "by_source_root"
Thanks that works for me!
Ah, yes, this has to be turned on, sorry, forgot to mention that