versions icon indicating copy to clipboard operation
versions copied to clipboard

{Dependency,Plugin}UpdatesReport overhaul

Open andrzejj0 opened this issue 3 years ago • 3 comments

I see that there's quite some code duplication between DependecyUpdatesReport and PluginUpdatesReport. The classes could possibly use some refactoring. Plus maybe a name change to be in line with the convention (name should probably end with Mojo).

Speaking of which, DependencyUpdatesRenderer uses a completely different interface than DependencyUpdatesXmlRenderer. There's no common factory or a common interface to use the two and the user classes, need to create and handle the two different classes differently.

Here we should create a common API with probably a common abstract factory to instantiate the correct implementation of the renderer.

I appreciate this is not a functional nor a performance issue, but rather a code quality one. I will gladly take it.

andrzejj0 avatar Aug 18 '22 18:08 andrzejj0

Heads up: it looks like using dependency inversion can offer much here, going with it.

andrzejj0 avatar Sep 25 '22 15:09 andrzejj0

Extra item to do: convert xml report generators to "real" ReportGenerators using e.g. the RandomAccessSink or the normal text sink. Then it would be possible to generate those XML reports from <reporting/> too. The execute() invocation would be slightly different, it would simply delegate the generation to two different renderers (with their two different sinks).

andrzejj0 avatar Sep 25 '22 19:09 andrzejj0

Still work in progress, so far have introduced a common model for the renderers and changed renderers into injectable components. It's not done yet -- I'd like to use a templating engine like Velocity. Sadly, it's not possible to inject a "context" into AptParser, otherwise I'd use it and would create a few macros to process content.

For now, refactored and unified the renderers.

https://github.com/mojohaus/versions-maven-plugin/compare/master...ajarmoniuk:versions-maven-plugin:doxia-renderers

andrzejj0 avatar Sep 27 '22 08:09 andrzejj0

Please close @slawekjaranowski @slachiewicz

andrzejj0 avatar Oct 21 '22 06:10 andrzejj0