DFS vs BFS search of modules during resolution
Michał Kłeczek
michal at kleczek.org
Fri Dec 3 13:39:03 UTC 2021
Hi All,
During my work on lazy loading of modules I stumbled upon the following possible dependency graph that I would like to handle:
Y1 X2
^ ^
| |
(non-transitive) (non-transitive)
| |
| |
X1 Y2
^ ^
| |
\ /
\ /
\ /
\ /
\ /
\ /
Z
Where An means module named A version n.
In other words there is a cycle in dependency _names_ (but not actual ResolvedModules)
Because Configuration uses DFS to find modules in parent configurations it is impossible to create Configuration that would represent such a graph of ResolvedModules.
1. I am trying to understand the reasoning behind DFS selection. While the above situation is not very common (but not that uncommon in environments with multiple modules developed separately) - BFS would handle the need to “override” some dependencies with proper layering.
2. Is there a way to handle it today?
(Ab)using transitive dependencies might work - I could introduce artificial module M ---(transitive)-->Y2 and make Z require M (so that resolution would replace Y1 found by DFS with Y2 required transitively by M).
Am I missing something?
Thanks,
Michal
More information about the jigsaw-dev
mailing list