We now have two modules which rely upon detecting package files in projects:
maven-metadata-inferer
javascript-metadata-inferer.
Those two systems have a a common feature: for each element, we check the SCM and/or the local file system looking for packaging files (pom.xml in maven projects and package.json for javascript projects). When we will add python analysis, we will also add lookup of dependencies.txt file. So it would be cool to move and make common the detection file. The different steps should be something like
Change priority of current enhancers to 1 (in order for detection to happen beforehand)
Create a new PackageFileDetectorEnhancer in base module. This enhancer will receive the refactored common code. If you look into MavenPomReader, its the #MavenPomReader#processModelElement(...), the MavenPomReader#processPomAtPath(Element, String) and the MavenPomReader#processPomAtSCM(Element) methods which should be rewritten.
In each of these methods, instead of directly loading the elements, just add a model property linking the file name to its absolute path
Rewirte existing Enhancer to read those properties and load the models instead of directly loading the model (like they currently do)
We now have two modules which rely upon detecting package files in projects:
Those two systems have a a common feature: for each element, we check the SCM and/or the local file system looking for packaging files (
pom.xml
in maven projects andpackage.json
for javascript projects). When we will add python analysis, we will also add lookup ofdependencies.txt
file. So it would be cool to move and make common the detection file. The different steps should be something like1
(in order for detection to happen beforehand)PackageFileDetectorEnhancer
in base module. This enhancer will receive the refactored common code. If you look intoMavenPomReader
, its the#MavenPomReader#processModelElement(...)
, theMavenPomReader#processPomAtPath(Element, String)
and theMavenPomReader#processPomAtSCM(Element)
methods which should be rewritten.Enhancer
to read those properties and load the models instead of directly loading the model (like they currently do)