Riduidel / aadarchi

A maven archetype to generate easily projects allowing architecture description using a mix of C4, agile architecture, Asciidoc and PlantUML
https://riduidel.github.io/aadarchi/
Apache License 2.0
41 stars 12 forks source link

Separate package file detection and analysis #350

Closed Riduidel closed 1 year ago

Riduidel commented 1 year ago

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 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

  1. Change priority of current enhancers to 1 (in order for detection to happen beforehand)
  2. 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.
  3. In each of these methods, instead of directly loading the elements, just add a model property linking the file name to its absolute path
  4. Rewirte existing Enhancer to read those properties and load the models instead of directly loading the model (like they currently do)
Riduidel commented 1 year ago

Fixed in fcee29720ff470dbb89af661097c7d220c0c379f