You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by hb...@apache.org on 2024/03/23 17:50:06 UTC
(maven-plugin-tools) branch MPLUGIN-510 created (now 958bb307)
This is an automated email from the ASF dual-hosted git repository.
hboutemy pushed a change to branch MPLUGIN-510
in repository https://gitbox.apache.org/repos/asf/maven-plugin-tools.git
at 958bb307 [MPLUGIN-510] group history per common requirements
This branch includes the following new commits:
new 958bb307 [MPLUGIN-510] group history per common requirements
The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails. The revisions
listed as "add" were already present in the repository and have only
been added to this reference.
(maven-plugin-tools) 01/01: [MPLUGIN-510] group history per common requirements
Posted by hb...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
hboutemy pushed a commit to branch MPLUGIN-510
in repository https://gitbox.apache.org/repos/asf/maven-plugin-tools.git
commit 958bb307e1451f939745f53c53efbd682e5ebbbb
Author: Hervé Boutemy <hb...@apache.org>
AuthorDate: Sat Mar 23 18:49:50 2024 +0100
[MPLUGIN-510] group history per common requirements
---
.../pom.xml | 7 ++++--
.../verify.groovy | 6 ++---
.../plugin/report/PluginOverviewRenderer.java | 27 +++++++++++++++++++---
.../maven/plugin/plugin/report/PluginReport.java | 10 ++++++--
.../plugin/plugin/report/RequirementsHistory.java | 5 ++++
5 files changed, 44 insertions(+), 11 deletions(-)
diff --git a/maven-plugin-report-plugin/src/it/plugin-report-detect-requirements-history/pom.xml b/maven-plugin-report-plugin/src/it/plugin-report-detect-requirements-history/pom.xml
index 51b08ae9..e38c90b6 100644
--- a/maven-plugin-report-plugin/src/it/plugin-report-detect-requirements-history/pom.xml
+++ b/maven-plugin-report-plugin/src/it/plugin-report-detect-requirements-history/pom.xml
@@ -24,8 +24,8 @@ under the License.
<modelVersion>4.0.0</modelVersion>
<groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-plugin-report-plugin</artifactId><!-- intentionally reuse plugin's groupId:artifactId to build its releases history -->
- <version>1.0-SNAPSHOT</version>
+ <artifactId>maven-assembly-plugin</artifactId><!-- intentionally reuse plugin's groupId:artifactId to build its releases history -->
+ <version>3.7.1-SNAPSHOT</version>
<packaging>maven-plugin</packaging>
<name>MPLUGIN-511</name>
@@ -84,6 +84,9 @@ under the License.
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-plugin-report-plugin</artifactId>
<version>@project.version@</version>
+ <configuration>
+ <requirementsHistoryDetectionRange>[3,3.7.0]</requirementsHistoryDetectionRange>
+ </configuration>
</plugin>
</plugins>
</reporting>
diff --git a/maven-plugin-report-plugin/src/it/plugin-report-detect-requirements-history/verify.groovy b/maven-plugin-report-plugin/src/it/plugin-report-detect-requirements-history/verify.groovy
index bdf7c032..f1ce27a1 100644
--- a/maven-plugin-report-plugin/src/it/plugin-report-detect-requirements-history/verify.groovy
+++ b/maven-plugin-report-plugin/src/it/plugin-report-detect-requirements-history/verify.groovy
@@ -22,8 +22,6 @@ assert new File( basedir, 'target/site/noop-mojo.html' ).isFile()
def pluginInfo = new File( basedir, 'target/site/plugin-info.html' )
assert pluginInfo.isFile()
-assert pluginInfo.text.contains('3.11.0')
-assert pluginInfo.text.contains('3.10.2')
-assert pluginInfo.text.contains('3.9.0')
-assert pluginInfo.text.contains('3.7.0')
+assert pluginInfo.text.contains('from 3.4.0 to 3.6.0')
+assert pluginInfo.text.contains('>3.2.5<')
assert pluginInfo.text.contains('>8<')
diff --git a/maven-plugin-report-plugin/src/main/java/org/apache/maven/plugin/plugin/report/PluginOverviewRenderer.java b/maven-plugin-report-plugin/src/main/java/org/apache/maven/plugin/plugin/report/PluginOverviewRenderer.java
index 0c45f0ae..d557ed7f 100644
--- a/maven-plugin-report-plugin/src/main/java/org/apache/maven/plugin/plugin/report/PluginOverviewRenderer.java
+++ b/maven-plugin-report-plugin/src/main/java/org/apache/maven/plugin/plugin/report/PluginOverviewRenderer.java
@@ -211,11 +211,32 @@ class PluginOverviewRenderer extends AbstractPluginReportRenderer {
getI18nString("systemrequirements.history.jdk")
});
+ // group by same requirements
+ final List<List<RequirementsHistory>> requirementsVersions = new ArrayList<>();
requirementsHistories.forEach(requirementsHistory -> {
+ List<RequirementsHistory> current =
+ requirementsVersions.isEmpty() ? null : requirementsVersions.get(requirementsVersions.size() - 1);
+ if (current != null && current.get(0).hasSameRequirements(requirementsHistory)) {
+ current.add(requirementsHistory);
+ } else {
+ current = new ArrayList<>();
+ current.add(requirementsHistory);
+ requirementsVersions.add(current);
+ }
+ });
+
+ // render by common requirements
+ requirementsVersions.forEach(requirementsHistories -> {
sink.tableRow();
- tableCell(requirementsHistory.getVersion());
- tableCell(requirementsHistory.getMaven());
- tableCell(requirementsHistory.getJdk());
+ RequirementsHistory current = requirementsHistories.get(0);
+ if (requirementsHistories.size() == 1) {
+ tableCell(current.getVersion());
+ } else {
+ RequirementsHistory from = requirementsHistories.get(requirementsHistories.size() - 1);
+ tableCell("from " + from.getVersion() + " to " + current.getVersion());
+ }
+ tableCell(current.getMaven());
+ tableCell(current.getJdk());
sink.tableRow_();
});
endTable();
diff --git a/maven-plugin-report-plugin/src/main/java/org/apache/maven/plugin/plugin/report/PluginReport.java b/maven-plugin-report-plugin/src/main/java/org/apache/maven/plugin/plugin/report/PluginReport.java
index 9f1178ff..5979fe70 100644
--- a/maven-plugin-report-plugin/src/main/java/org/apache/maven/plugin/plugin/report/PluginReport.java
+++ b/maven-plugin-report-plugin/src/main/java/org/apache/maven/plugin/plugin/report/PluginReport.java
@@ -189,8 +189,14 @@ public class PluginReport extends AbstractMavenReport {
String v = null;
try {
List<Version> versions = discoverVersions(requirementsHistoryDetectionRange);
- getLog().info("Detecting requirements history for " + requirementsHistoryDetectionRange + ": "
- + versions.size());
+ if (versions.isEmpty()) {
+ getLog().info("No plugin history found for range " + requirementsHistoryDetectionRange);
+ } else {
+ getLog().info("Detecting plugin requirements history for range "
+ + requirementsHistoryDetectionRange + ": "
+ + versions.size() + " releases, from " + versions.get(0) + " to "
+ + versions.get(versions.size() - 1));
+ }
Collections.reverse(versions);
for (Version version : versions) {
diff --git a/maven-plugin-report-plugin/src/main/java/org/apache/maven/plugin/plugin/report/RequirementsHistory.java b/maven-plugin-report-plugin/src/main/java/org/apache/maven/plugin/plugin/report/RequirementsHistory.java
index 53446d44..9d797168 100644
--- a/maven-plugin-report-plugin/src/main/java/org/apache/maven/plugin/plugin/report/RequirementsHistory.java
+++ b/maven-plugin-report-plugin/src/main/java/org/apache/maven/plugin/plugin/report/RequirementsHistory.java
@@ -20,6 +20,7 @@ package org.apache.maven.plugin.plugin.report;
import java.util.Arrays;
import java.util.Map;
+import java.util.Objects;
import java.util.Optional;
import org.apache.commons.lang3.StringUtils;
@@ -173,4 +174,8 @@ public class RequirementsHistory {
return null;
}
+
+ public boolean hasSameRequirements(RequirementsHistory other) {
+ return Objects.equals(this.maven, other.getMaven()) && Objects.equals(this.jdk, other.getJdk());
+ }
}