find_root for multi-module projects #286
bugabinga
started this conversation in
Show and tell
Replies: 2 comments
-
This is genius, just what I was thinking of implementing. Can you add a little explanation on the correct way to use this? Thanks! |
Beta Was this translation helpful? Give feedback.
0 replies
-
I'm quite late to the party I see :p |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hi there!
I am sharing my own implementation of
find_root
, in case anyone wants to work with hierarchically nested projects.The default
find_root
searches the path to root for "marker" files until it finds the first one. For simple project layouts that is fine, but in multi-module projects one would get the child module as project root.The following implementation counts for all potential project roots the amount of (weighted) marker files and returns the directory with the highest score.
As an example; a directory with
README.md
andpom.xml
is more likely to be the project root than a directory with onlypom.xml
in it.Beta Was this translation helpful? Give feedback.
All reactions