[ 
https://issues.apache.org/jira/browse/MPIR-431?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17724712#comment-17724712
 ] 

ASF GitHub Bot commented on MPIR-431:
-------------------------------------

michael-o commented on code in PR #47:
URL: 
https://github.com/apache/maven-project-info-reports-plugin/pull/47#discussion_r1199821656


##########
src/main/java/org/apache/maven/report/projectinfo/dependencies/renderer/DependenciesRenderer.java:
##########
@@ -607,25 +608,76 @@ private void renderSectionDependencyFileDetails() {
         justification[0] = Sink.JUSTIFY_RIGHT;
         justification[6] = Sink.JUSTIFY_RIGHT;
 
-        for (int i = -1; i < TotalCell.SCOPES_COUNT; i++) {
-            if (totaldeps.getTotal(i) > 0) {
-                tableRow(hasSealed, new String[] {
-                    totaldeps.getTotalString(i),
-                    totaldepsize.getTotalString(i),
-                    totalentries.getTotalString(i),
-                    totalclasses.getTotalString(i),
-                    totalpackages.getTotalString(i),
-                    (i < 0) ? javaVersionFormat.format(new Object[] 
{highestJavaVersion}) : "",
-                    totalDebugInformation.getTotalString(i),
-                    totalsealed.getTotalString(i)
-                });
+        // calculate rowspan attr
+        int rowspan = computeRowspan(totaldeps);
+
+        if (rowspan > 1) {
+            boolean insertRowspanAttr = false;
+            int column = 5; // Java Version's column
+            for (int i = -1; i < TotalCell.SCOPES_COUNT; i++) {
+                if (totaldeps.getTotal(i) > 0) {
+                    boolean alreadyInsertedRowspanAttr = insertRowspanAttr && 
(0 < i && i < 4);
+                    insertRowspanAttr = (0 <= i && i < 4);
+                    justification[column] = (insertRowspanAttr && 
alreadyInsertedRowspanAttr)
+                            ? justification[column + 1]
+                            : Sink.JUSTIFY_CENTER;
+                    tableRowWithRowspan(
+                            hasSealed, insertRowspanAttr, 
alreadyInsertedRowspanAttr, column, rowspan, new String[] {
+                                totaldeps.getTotalString(i),
+                                totaldepsize.getTotalString(i),
+                                totalentries.getTotalString(i),
+                                totalclasses.getTotalString(i),
+                                totalpackages.getTotalString(i),
+                                formatMaxVersionForScope(i, 
highestTestJavaVersion, highestNonTestJavaVersion),
+                                totalDebugInformation.getTotalString(i),
+                                totalsealed.getTotalString(i)
+                            });
+                }
+            }
+        } else {
+            for (int i = -1; i < TotalCell.SCOPES_COUNT; i++) {
+                if (totaldeps.getTotal(i) > 0) {
+                    tableRow(hasSealed, new String[] {
+                        totaldeps.getTotalString(i),
+                        totaldepsize.getTotalString(i),
+                        totalentries.getTotalString(i),
+                        totalclasses.getTotalString(i),
+                        totalpackages.getTotalString(i),
+                        formatMaxVersionForScope(i, highestTestJavaVersion, 
highestNonTestJavaVersion),
+                        totalDebugInformation.getTotalString(i),
+                        totalsealed.getTotalString(i)
+                    });
+                }
             }
         }
 
         endTable();
         endSection();
     }
 
+    private int computeRowspan(TotalCell totaldeps) {
+        int rowspan = 0;
+        for (int i = 0; i < TotalCell.SCOPES_COUNT - 1; i++) {
+            if (totaldeps.getTotal(i) > 0) {
+                rowspan++;
+            }
+        }
+        return rowspan;
+    }
+
+    private String formatMaxVersionForScope(

Review Comment:
   Let's make this `formatMaxJavaVersionForScope`





> Dependency file details section: segregate Java version column into execution 
> and test versions
> -----------------------------------------------------------------------------------------------
>
>                 Key: MPIR-431
>                 URL: https://issues.apache.org/jira/browse/MPIR-431
>             Project: Maven Project Info Reports Plugin
>          Issue Type: Improvement
>          Components: dependencies
>            Reporter: Gabriel Belingueres
>            Assignee: Michael Osipov
>            Priority: Minor
>
> In order to easily spot which is the minimum java version for execution 
> versus the minimum java version for building the project, divide the "Java 
> version" column into two columns:
> Java version: max version between dependencies with scopes: compile, runtime, 
> provided, system.
> Test Java version: max java version between all the test scoped dependencies.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to