Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

#637: Refactoring report renderers #738

Merged
merged 1 commit into from
Oct 8, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -417,14 +417,16 @@
</reportSets>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>versions-maven-plugin</artifactId>
<groupId>${project.groupId}</groupId>
<artifactId>${project.artifactId}</artifactId>
<version>${project.version}</version>
<reportSets>
<reportSet>
<reports>
<report>dependency-updates-report</report>
<report>plugin-updates-report</report>
<report>property-updates-report</report>
<report>parent-updates-report</report>
</reports>
</reportSet>
</reportSets>
Expand Down
22 changes: 12 additions & 10 deletions src/it/it-abstract-versions-report-001/verify.groovy
Original file line number Diff line number Diff line change
@@ -1,15 +1,17 @@
dependencyUpdatesReport = new File( basedir, "target/site/dependency-updates-report.html" )

assert dependencyUpdatesReport.exists( )
dependencyUpdatesReport = new File( basedir, "target/site/dependency-updates-report.html" ).text
.replaceAll( '<[^>]+>', ' ' )
.replaceAll( '&[^;]+;', ' ' )
.replaceAll( '\\s+', ' ' )

// some basic (=not comprehensive) checks on the contents of the dependency report
assert dependencyUpdatesReport.text =~ /\b1\.1\.0-2\b/ // current version of the dependency
assert dependencyUpdatesReport.text =~ /\b3\.0\b/ // latest major available version
slawekjaranowski marked this conversation as resolved.
Show resolved Hide resolved

pluginUpdatesReport = new File( basedir, "target/site/plugin-updates-report.html" )
assert dependencyUpdatesReport =~ /\b1\.1\.0-2\b/ // current version of the dependency
assert dependencyUpdatesReport =~ /\b3\.0\b/ // latest major available version

assert pluginUpdatesReport.exists( )
pluginUpdatesReport = new File( basedir, "target/site/plugin-updates-report.html" ).text
.replaceAll( '<[^>]+>', ' ' )
.replaceAll( '&[^;]+;', ' ' )
.replaceAll( '\\s+', ' ' )

// some basic (=not comprehensive) checks on the contents of the plugin report
assert pluginUpdatesReport.text =~ /\b1\.0\b/ // current version of the plugin
assert pluginUpdatesReport.text =~ /\b3\.1\b/ // latest major available version
assert pluginUpdatesReport =~ /\b1\.0\b/ // current version of the plugin
assert pluginUpdatesReport =~ /\b3\.1\b/ // latest major available version
2 changes: 1 addition & 1 deletion src/it/it-parent-updates-report-001/invoker.properties
Original file line number Diff line number Diff line change
@@ -1 +1 @@
invoker.goals=site
invoker.goals = site
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,6 @@
* under the License.
*/

import javax.inject.Inject;

import java.io.File;
import java.util.List;
import java.util.Locale;
Expand Down Expand Up @@ -49,15 +47,17 @@
import org.codehaus.mojo.versions.api.DefaultVersionsHelper;
import org.codehaus.mojo.versions.api.VersionsHelper;
import org.codehaus.mojo.versions.model.RuleSet;
import org.codehaus.mojo.versions.reporting.ReportRendererFactory;
import org.codehaus.plexus.i18n.I18N;

/**
* Base class for all versions reports.
*
* @param <T> modelled report object
* @author Stephen Connolly
* @since 1.0-alpha-3
*/
public abstract class AbstractVersionsReport
public abstract class AbstractVersionsReport<T>
extends AbstractMavenReport
{
/**
Expand Down Expand Up @@ -99,7 +99,7 @@ public abstract class AbstractVersionsReport
/**
* @since 1.0-alpha-3
*/
private WagonManager wagonManager;
private final WagonManager wagonManager;

/**
* @since 1.0-alpha-3
Expand Down Expand Up @@ -188,17 +188,25 @@ public abstract class AbstractVersionsReport
@Parameter( property = "maven.version.ignore" )
protected Set<String> ignoredVersions;

/**
* Renderer factory
*
* @since 2.13.0
*/
protected ReportRendererFactory rendererFactory;

// --------------------- GETTER / SETTER METHODS ---------------------

@Inject
protected AbstractVersionsReport( I18N i18n, RepositorySystem repositorySystem, ArtifactResolver artifactResolver,
ArtifactMetadataSource artifactMetadataSource, WagonManager wagonManager )
ArtifactMetadataSource artifactMetadataSource, WagonManager wagonManager,
ReportRendererFactory rendererFactory )
{
this.i18n = i18n;
this.repositorySystem = repositorySystem;
this.artifactResolver = artifactResolver;
this.artifactMetadataSource = artifactMetadataSource;
this.wagonManager = wagonManager;
this.rendererFactory = rendererFactory;
}

public VersionsHelper getHelper()
Expand Down
Loading