This is an automated email from the ASF dual-hosted git repository.

sjaranowski pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/maven-plugin-tools.git


The following commit(s) were added to refs/heads/master by this push:
     new 7dd3a259 [MPLUGIN-499] Add deprecate description in parameters table 
(#250)
7dd3a259 is described below

commit 7dd3a259585b50f3d450d68e480eb3da8d19e70b
Author: Slawomir Jaranowski <s.jaranow...@gmail.com>
AuthorDate: Wed Dec 27 11:06:52 2023 +0100

    [MPLUGIN-499] Add deprecate description in parameters table (#250)
---
 maven-plugin-report-plugin/pom.xml                 |  1 +
 .../src/it/plugin-report-annotations/verify.bsh    | 55 ----------------------
 .../verify.groovy                                  | 16 ++++---
 .../src/it/plugin-report/verify.groovy             | 11 ++++-
 .../maven/plugin/plugin/report/GoalRenderer.java   | 28 ++++++-----
 .../plugin/report/PluginOverviewRenderer.java      | 21 +++++++--
 .../src/main/resources/plugin-report.properties    |  4 +-
 .../src/main/resources/plugin-report_de.properties |  4 +-
 .../src/main/resources/plugin-report_fr.properties |  4 +-
 .../src/main/resources/plugin-report_sv.properties |  4 +-
 10 files changed, 63 insertions(+), 85 deletions(-)

diff --git a/maven-plugin-report-plugin/pom.xml 
b/maven-plugin-report-plugin/pom.xml
index f7143f0b..99e392b1 100644
--- a/maven-plugin-report-plugin/pom.xml
+++ b/maven-plugin-report-plugin/pom.xml
@@ -241,6 +241,7 @@
             <groupId>org.apache.maven.plugins</groupId>
             <artifactId>maven-invoker-plugin</artifactId>
             <configuration>
+              <showErrors>true</showErrors>
               <projectsDirectory>src/it</projectsDirectory>
               <cloneProjectsTo>${project.build.directory}/it</cloneProjectsTo>
               <preBuildHookScript>setup</preBuildHookScript>
diff --git 
a/maven-plugin-report-plugin/src/it/plugin-report-annotations/verify.bsh 
b/maven-plugin-report-plugin/src/it/plugin-report-annotations/verify.bsh
deleted file mode 100644
index e884269e..00000000
--- a/maven-plugin-report-plugin/src/it/plugin-report-annotations/verify.bsh
+++ /dev/null
@@ -1,55 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- * 
- *   http://www.apache.org/licenses/LICENSE-2.0
- * 
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-import java.io.*;
-import java.util.*;
-import java.util.regex.*;
-
-try
-{
-    File siteDir = new File( basedir, "target/site" );
-    System.out.println( "Checking for existence of site directory: " + siteDir 
);
-    if ( !siteDir.isDirectory() )
-    {
-        System.out.println( "FAILED!" );
-        return false;
-    }
-
-    String[] expectedFiles = {
-        "noop-mojo.html",
-        "report-mojo.html",
-    };
-    for ( String path : expectedFiles )
-    {
-        File file = new File( siteDir, path );
-        System.out.println( "Checking for existence of doc file: " + file );
-        if ( !file.isFile() || file.length() <= 0 )
-        {
-            System.out.println( "FAILED!" );
-            return false;
-        }
-    }
-}
-catch( Throwable t )
-{
-    t.printStackTrace();
-    return false;
-}
-
-return true;
diff --git a/maven-plugin-report-plugin/src/it/plugin-report/verify.groovy 
b/maven-plugin-report-plugin/src/it/plugin-report-annotations/verify.groovy
similarity index 74%
copy from maven-plugin-report-plugin/src/it/plugin-report/verify.groovy
copy to 
maven-plugin-report-plugin/src/it/plugin-report-annotations/verify.groovy
index 2f24cb8a..281cbbd3 100644
--- a/maven-plugin-report-plugin/src/it/plugin-report/verify.groovy
+++ b/maven-plugin-report-plugin/src/it/plugin-report-annotations/verify.groovy
@@ -29,10 +29,14 @@ assert !pluginInfo.text.contains('Disk Space')
 assert pluginInfo.text.contains('1.8')
 assert pluginInfo.text.contains('3.2.5')
 
-assert new File( basedir, 'target/site/de/noop-mojo.html' ).isFile()
-assert new File( basedir, 'target/site/de/report-mojo.html' ).isFile()
-assert new File( basedir, 'target/site/de/plugin-info.html' ).isFile()
+// deprecated info and description
+assert pluginInfo.text.contains('<div><strong>Deprecated.</strong> You don\'t 
use test goals, do you?</div><br />')
+assert pluginInfo.text.contains('Does nothing.')
+
+
+def noopMojo = new File( basedir, 'target/site/noop-mojo.html' )
+assert noopMojo.isFile()
+
+// deprecated in table and details
+assert noopMojo.text.count('<div><strong>Deprecated.</strong><br />Just 
testing.</div><br />') == 2
 
-assert new File( basedir, 'target/site/fr/noop-mojo.html' ).isFile()
-assert new File( basedir, 'target/site/fr/report-mojo.html' ).isFile()
-assert new File( basedir, 'target/site/fr/plugin-info.html' ).isFile()
diff --git a/maven-plugin-report-plugin/src/it/plugin-report/verify.groovy 
b/maven-plugin-report-plugin/src/it/plugin-report/verify.groovy
index 2f24cb8a..f77584dc 100644
--- a/maven-plugin-report-plugin/src/it/plugin-report/verify.groovy
+++ b/maven-plugin-report-plugin/src/it/plugin-report/verify.groovy
@@ -17,7 +17,6 @@
  * under the License.
  */
 
-assert new File( basedir, 'target/site/noop-mojo.html' ).isFile()
 assert new File( basedir, 'target/site/report-mojo.html' ).isFile()
 
 def pluginInfo = new File( basedir, 'target/site/plugin-info.html' )
@@ -29,6 +28,10 @@ assert !pluginInfo.text.contains('Disk Space')
 assert pluginInfo.text.contains('1.8')
 assert pluginInfo.text.contains('3.2.5')
 
+// deprecated info and description
+assert pluginInfo.text.contains('<div><strong>Deprecated.</strong> You don\'t 
use test goals, do you?</div><br />')
+assert pluginInfo.text.contains('Does nothing.')
+
 assert new File( basedir, 'target/site/de/noop-mojo.html' ).isFile()
 assert new File( basedir, 'target/site/de/report-mojo.html' ).isFile()
 assert new File( basedir, 'target/site/de/plugin-info.html' ).isFile()
@@ -36,3 +39,9 @@ assert new File( basedir, 'target/site/de/plugin-info.html' 
).isFile()
 assert new File( basedir, 'target/site/fr/noop-mojo.html' ).isFile()
 assert new File( basedir, 'target/site/fr/report-mojo.html' ).isFile()
 assert new File( basedir, 'target/site/fr/plugin-info.html' ).isFile()
+
+def noopMojo = new File( basedir, 'target/site/noop-mojo.html' )
+assert noopMojo.isFile()
+
+// deprecated in table and details
+assert noopMojo.text.count('<div><strong>Deprecated.</strong><br />Just 
testing.</div><br />') == 2
diff --git 
a/maven-plugin-report-plugin/src/main/java/org/apache/maven/plugin/plugin/report/GoalRenderer.java
 
b/maven-plugin-report-plugin/src/main/java/org/apache/maven/plugin/plugin/report/GoalRenderer.java
index eac6c0c7..62d38c15 100644
--- 
a/maven-plugin-report-plugin/src/main/java/org/apache/maven/plugin/plugin/report/GoalRenderer.java
+++ 
b/maven-plugin-report-plugin/src/main/java/org/apache/maven/plugin/plugin/report/GoalRenderer.java
@@ -274,10 +274,8 @@ public class GoalRenderer extends 
AbstractPluginReportRenderer {
         sink.tableCell();
         String description;
         String context = "Parameter " + parameter.getName() + " in goal " + 
descriptor.getGoal();
-        if (StringUtils.isNotEmpty(parameter.getDeprecated())) {
-            String deprecated = 
getXhtmlWithValidatedLinks(parameter.getDescription(), context);
-            description = format("parameter.deprecated", deprecated);
-        } else if (StringUtils.isNotEmpty(parameter.getDescription())) {
+        renderDeprecatedParameterDescription(parameter.getDeprecated(), 
context);
+        if (StringUtils.isNotEmpty(parameter.getDescription())) {
             description = 
getXhtmlWithValidatedLinks(parameter.getDescription(), context);
         } else {
             description = getI18nString("nodescription");
@@ -304,13 +302,7 @@ public class GoalRenderer extends 
AbstractPluginReportRenderer {
             startSection(format("parameter.name", parameter.getName()));
             sink.anchor_();
             String context = "Parameter " + parameter.getName() + " in goal " 
+ descriptor.getGoal();
-            if (StringUtils.isNotEmpty(parameter.getDeprecated())) {
-                sink.division();
-                String deprecated = 
getXhtmlWithValidatedLinks(parameter.getDeprecated(), context);
-                sink.rawText(format("parameter.deprecated", deprecated));
-                sink.division_();
-            }
-
+            renderDeprecatedParameterDescription(parameter.getDeprecated(), 
context);
             sink.division();
             if (StringUtils.isNotEmpty(parameter.getDescription())) {
                 
sink.rawText(getXhtmlWithValidatedLinks(parameter.getDescription(), context));
@@ -355,6 +347,20 @@ public class GoalRenderer extends 
AbstractPluginReportRenderer {
         endSection();
     }
 
+    private void renderDeprecatedParameterDescription(String deprecated, 
String context) {
+        if (StringUtils.isNotEmpty(deprecated)) {
+            String deprecatedXhtml = getXhtmlWithValidatedLinks(deprecated, 
context);
+            sink.division();
+            sink.inline(Semantics.STRONG);
+            sink.text(getI18nString("parameter.deprecated"));
+            sink.inline_();
+            sink.lineBreak();
+            sink.rawText(deprecatedXhtml);
+            sink.division_();
+            sink.lineBreak();
+        }
+    }
+
     private void renderTableCellDetail(String nameKey, String value) {
         if (StringUtils.isNotEmpty(value)) {
             sink.lineBreak();
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 9b772fc1..a601bd50 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
@@ -27,6 +27,7 @@ import java.util.Optional;
 import org.apache.commons.lang3.StringUtils;
 import org.apache.maven.doxia.markup.Markup;
 import org.apache.maven.doxia.sink.Sink;
+import org.apache.maven.doxia.sink.impl.SinkEventAttributeSet;
 import org.apache.maven.model.Plugin;
 import org.apache.maven.model.Prerequisites;
 import org.apache.maven.plugin.descriptor.MojoDescriptor;
@@ -148,15 +149,27 @@ class PluginOverviewRenderer extends 
AbstractPluginReportRenderer {
                 }
             }
 
-            String description;
+            sink.tableCell();
             if (StringUtils.isNotEmpty(mojo.getDeprecated())) {
-                description = "<strong>" + getI18nString("goal.deprecated") + 
"</strong> " + mojo.getDeprecated();
-            } else if (StringUtils.isNotEmpty(mojo.getDescription())) {
+                sink.division();
+                sink.inline(SinkEventAttributeSet.Semantics.STRONG);
+                sink.text(getI18nString("goal.deprecated"));
+                sink.text(".");
+                sink.inline_();
+                sink.text(" ");
+                sink.rawText(mojo.getDeprecated());
+                sink.division_();
+                sink.lineBreak();
+            }
+
+            String description;
+            if (StringUtils.isNotEmpty(mojo.getDescription())) {
                 description = mojo.getDescription();
             } else {
                 description = getI18nString("goal.nodescription");
             }
-            tableCell(description, true);
+            sink.rawText(description);
+            sink.tableCell_();
             sink.tableRow_();
         }
 
diff --git 
a/maven-plugin-report-plugin/src/main/resources/plugin-report.properties 
b/maven-plugin-report-plugin/src/main/resources/plugin-report.properties
index c9479731..1a3fb266 100644
--- a/maven-plugin-report-plugin/src/main/resources/plugin-report.properties
+++ b/maven-plugin-report-plugin/src/main/resources/plugin-report.properties
@@ -29,7 +29,7 @@ report.plugin.goals.column.isMavenReport=Report?
 report.plugin.goals.column.description=Description
 
 report.plugin.goal.nodescription=No description.
-report.plugin.goal.deprecated=Deprecated.
+report.plugin.goal.deprecated=Deprecated
 report.plugin.goal.notice.prefix=Note
 report.plugin.goal.notice.isMavenReport=This goal should be used as a Maven 
report.
 report.plugin.goal.fullname=Full name
@@ -64,7 +64,7 @@ report.plugin.goal.parameter.name=<{0}>
 report.plugin.goal.parameter.defaultValue=Default
 report.plugin.goal.parameter.property=User Property
 report.plugin.goal.parameter.alias=Alias
-report.plugin.goal.parameter.deprecated=<strong>Deprecated.</strong> {0}
+report.plugin.goal.parameter.deprecated=Deprecated.
 report.plugin.goal.parameter.type=Type
 report.plugin.goal.parameter.required=Required
 report.plugin.goal.parameter.expression=Expression
diff --git 
a/maven-plugin-report-plugin/src/main/resources/plugin-report_de.properties 
b/maven-plugin-report-plugin/src/main/resources/plugin-report_de.properties
index a4975f11..06831a33 100644
--- a/maven-plugin-report-plugin/src/main/resources/plugin-report_de.properties
+++ b/maven-plugin-report-plugin/src/main/resources/plugin-report_de.properties
@@ -27,8 +27,8 @@ report.plugin.goals.column.goal=Goal
 report.plugin.goals.column.isMavenReport=Bericht?
 report.plugin.goals.column.description=Beschreibung
 report.plugin.goal.nodescription=Keine Beschreibung.
-report.plugin.goal.deprecated=Missbilligt.
-
+report.plugin.goal.deprecated=Missbilligt
+report.plugin.goal.parameter.deprecated=Missbilligt.
 report.plugin.goal.yes=Ja
 report.plugin.goal.no=Nein
 
diff --git 
a/maven-plugin-report-plugin/src/main/resources/plugin-report_fr.properties 
b/maven-plugin-report-plugin/src/main/resources/plugin-report_fr.properties
index e430ab38..548fcd9b 100644
--- a/maven-plugin-report-plugin/src/main/resources/plugin-report_fr.properties
+++ b/maven-plugin-report-plugin/src/main/resources/plugin-report_fr.properties
@@ -26,8 +26,8 @@ report.plugin.goals.column.goal=Goal
 report.plugin.goals.column.isMavenReport=Rapport?
 report.plugin.goals.column.description=Description
 report.plugin.goal.nodescription=Pas de description.
-report.plugin.goal.deprecated=Obsol\u00E8te.
-
+report.plugin.goal.deprecated=Obsol\u00E8te
+report.plugin.goal.parameter.deprecated=Obsol\u00E8te.
 report.plugin.goal.yes=Oui
 report.plugin.goal.no=Non
 
diff --git 
a/maven-plugin-report-plugin/src/main/resources/plugin-report_sv.properties 
b/maven-plugin-report-plugin/src/main/resources/plugin-report_sv.properties
index f4b89b98..0c4fde5b 100644
--- a/maven-plugin-report-plugin/src/main/resources/plugin-report_sv.properties
+++ b/maven-plugin-report-plugin/src/main/resources/plugin-report_sv.properties
@@ -26,8 +26,8 @@ report.plugin.goals.column.goal=M\u00E5l
 report.plugin.goals.column.isMavenReport=Rapport?
 report.plugin.goals.column.description=Beskrivning
 report.plugin.goal.nodescription=Ingen beskrivning.
-report.plugin.goal.deprecated=F\u00F6r\u00E5ldrat.
-
+report.plugin.goal.deprecated=F\u00F6r\u00E5ldrat
+report.plugin.goal.parameter.deprecated=F\u00F6r\u00E5ldrat.
 report.plugin.goal.yes=Ja
 report.plugin.goal.no=Nej
 

Reply via email to