Skip to content

Commit 7dd3a25

Browse files
[MPLUGIN-499] Add deprecate description in parameters table (#250)
1 parent 9bb13f0 commit 7dd3a25

File tree

10 files changed

+95
-79
lines changed

10 files changed

+95
-79
lines changed

maven-plugin-report-plugin/pom.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -241,6 +241,7 @@
241241
<groupId>org.apache.maven.plugins</groupId>
242242
<artifactId>maven-invoker-plugin</artifactId>
243243
<configuration>
244+
<showErrors>true</showErrors>
244245
<projectsDirectory>src/it</projectsDirectory>
245246
<cloneProjectsTo>${project.build.directory}/it</cloneProjectsTo>
246247
<preBuildHookScript>setup</preBuildHookScript>

maven-plugin-report-plugin/src/it/plugin-report-annotations/verify.bsh

Lines changed: 0 additions & 55 deletions
This file was deleted.
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
/*
2+
* Licensed to the Apache Software Foundation (ASF) under one
3+
* or more contributor license agreements. See the NOTICE file
4+
* distributed with this work for additional information
5+
* regarding copyright ownership. The ASF licenses this file
6+
* to you under the Apache License, Version 2.0 (the
7+
* "License"); you may not use this file except in compliance
8+
* with the License. You may obtain a copy of the License at
9+
*
10+
* http://www.apache.org/licenses/LICENSE-2.0
11+
*
12+
* Unless required by applicable law or agreed to in writing,
13+
* software distributed under the License is distributed on an
14+
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15+
* KIND, either express or implied. See the License for the
16+
* specific language governing permissions and limitations
17+
* under the License.
18+
*/
19+
20+
assert new File( basedir, 'target/site/noop-mojo.html' ).isFile()
21+
assert new File( basedir, 'target/site/report-mojo.html' ).isFile()
22+
23+
def pluginInfo = new File( basedir, 'target/site/plugin-info.html' )
24+
assert pluginInfo.isFile()
25+
26+
assert !pluginInfo.text.contains('Memory')
27+
assert !pluginInfo.text.contains('Disk Space')
28+
// check JDK and Maven requirements
29+
assert pluginInfo.text.contains('1.8')
30+
assert pluginInfo.text.contains('3.2.5')
31+
32+
// deprecated info and description
33+
assert pluginInfo.text.contains('<div><strong>Deprecated.</strong> You don\'t use test goals, do you?</div><br />')
34+
assert pluginInfo.text.contains('Does nothing.')
35+
36+
37+
def noopMojo = new File( basedir, 'target/site/noop-mojo.html' )
38+
assert noopMojo.isFile()
39+
40+
// deprecated in table and details
41+
assert noopMojo.text.count('<div><strong>Deprecated.</strong><br />Just testing.</div><br />') == 2
42+

maven-plugin-report-plugin/src/it/plugin-report/verify.groovy

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@
1717
* under the License.
1818
*/
1919

20-
assert new File( basedir, 'target/site/noop-mojo.html' ).isFile()
2120
assert new File( basedir, 'target/site/report-mojo.html' ).isFile()
2221

2322
def pluginInfo = new File( basedir, 'target/site/plugin-info.html' )
@@ -29,10 +28,20 @@ assert !pluginInfo.text.contains('Disk Space')
2928
assert pluginInfo.text.contains('1.8')
3029
assert pluginInfo.text.contains('3.2.5')
3130

31+
// deprecated info and description
32+
assert pluginInfo.text.contains('<div><strong>Deprecated.</strong> You don\'t use test goals, do you?</div><br />')
33+
assert pluginInfo.text.contains('Does nothing.')
34+
3235
assert new File( basedir, 'target/site/de/noop-mojo.html' ).isFile()
3336
assert new File( basedir, 'target/site/de/report-mojo.html' ).isFile()
3437
assert new File( basedir, 'target/site/de/plugin-info.html' ).isFile()
3538

3639
assert new File( basedir, 'target/site/fr/noop-mojo.html' ).isFile()
3740
assert new File( basedir, 'target/site/fr/report-mojo.html' ).isFile()
3841
assert new File( basedir, 'target/site/fr/plugin-info.html' ).isFile()
42+
43+
def noopMojo = new File( basedir, 'target/site/noop-mojo.html' )
44+
assert noopMojo.isFile()
45+
46+
// deprecated in table and details
47+
assert noopMojo.text.count('<div><strong>Deprecated.</strong><br />Just testing.</div><br />') == 2

maven-plugin-report-plugin/src/main/java/org/apache/maven/plugin/plugin/report/GoalRenderer.java

Lines changed: 17 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -274,10 +274,8 @@ private void renderParameterOverviewTableRow(Parameter parameter) {
274274
sink.tableCell();
275275
String description;
276276
String context = "Parameter " + parameter.getName() + " in goal " + descriptor.getGoal();
277-
if (StringUtils.isNotEmpty(parameter.getDeprecated())) {
278-
String deprecated = getXhtmlWithValidatedLinks(parameter.getDescription(), context);
279-
description = format("parameter.deprecated", deprecated);
280-
} else if (StringUtils.isNotEmpty(parameter.getDescription())) {
277+
renderDeprecatedParameterDescription(parameter.getDeprecated(), context);
278+
if (StringUtils.isNotEmpty(parameter.getDescription())) {
281279
description = getXhtmlWithValidatedLinks(parameter.getDescription(), context);
282280
} else {
283281
description = getI18nString("nodescription");
@@ -304,13 +302,7 @@ private void renderParameterDetails(Iterator<Parameter> parameters) {
304302
startSection(format("parameter.name", parameter.getName()));
305303
sink.anchor_();
306304
String context = "Parameter " + parameter.getName() + " in goal " + descriptor.getGoal();
307-
if (StringUtils.isNotEmpty(parameter.getDeprecated())) {
308-
sink.division();
309-
String deprecated = getXhtmlWithValidatedLinks(parameter.getDeprecated(), context);
310-
sink.rawText(format("parameter.deprecated", deprecated));
311-
sink.division_();
312-
}
313-
305+
renderDeprecatedParameterDescription(parameter.getDeprecated(), context);
314306
sink.division();
315307
if (StringUtils.isNotEmpty(parameter.getDescription())) {
316308
sink.rawText(getXhtmlWithValidatedLinks(parameter.getDescription(), context));
@@ -355,6 +347,20 @@ private void renderParameterDetails(Iterator<Parameter> parameters) {
355347
endSection();
356348
}
357349

350+
private void renderDeprecatedParameterDescription(String deprecated, String context) {
351+
if (StringUtils.isNotEmpty(deprecated)) {
352+
String deprecatedXhtml = getXhtmlWithValidatedLinks(deprecated, context);
353+
sink.division();
354+
sink.inline(Semantics.STRONG);
355+
sink.text(getI18nString("parameter.deprecated"));
356+
sink.inline_();
357+
sink.lineBreak();
358+
sink.rawText(deprecatedXhtml);
359+
sink.division_();
360+
sink.lineBreak();
361+
}
362+
}
363+
358364
private void renderTableCellDetail(String nameKey, String value) {
359365
if (StringUtils.isNotEmpty(value)) {
360366
sink.lineBreak();

maven-plugin-report-plugin/src/main/java/org/apache/maven/plugin/plugin/report/PluginOverviewRenderer.java

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@
2727
import org.apache.commons.lang3.StringUtils;
2828
import org.apache.maven.doxia.markup.Markup;
2929
import org.apache.maven.doxia.sink.Sink;
30+
import org.apache.maven.doxia.sink.impl.SinkEventAttributeSet;
3031
import org.apache.maven.model.Plugin;
3132
import org.apache.maven.model.Prerequisites;
3233
import org.apache.maven.plugin.descriptor.MojoDescriptor;
@@ -148,15 +149,27 @@ private void renderGoalsSection(boolean hasMavenReport) {
148149
}
149150
}
150151

151-
String description;
152+
sink.tableCell();
152153
if (StringUtils.isNotEmpty(mojo.getDeprecated())) {
153-
description = "<strong>" + getI18nString("goal.deprecated") + "</strong> " + mojo.getDeprecated();
154-
} else if (StringUtils.isNotEmpty(mojo.getDescription())) {
154+
sink.division();
155+
sink.inline(SinkEventAttributeSet.Semantics.STRONG);
156+
sink.text(getI18nString("goal.deprecated"));
157+
sink.text(".");
158+
sink.inline_();
159+
sink.text(" ");
160+
sink.rawText(mojo.getDeprecated());
161+
sink.division_();
162+
sink.lineBreak();
163+
}
164+
165+
String description;
166+
if (StringUtils.isNotEmpty(mojo.getDescription())) {
155167
description = mojo.getDescription();
156168
} else {
157169
description = getI18nString("goal.nodescription");
158170
}
159-
tableCell(description, true);
171+
sink.rawText(description);
172+
sink.tableCell_();
160173
sink.tableRow_();
161174
}
162175

maven-plugin-report-plugin/src/main/resources/plugin-report.properties

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ report.plugin.goals.column.isMavenReport=Report?
2929
report.plugin.goals.column.description=Description
3030

3131
report.plugin.goal.nodescription=No description.
32-
report.plugin.goal.deprecated=Deprecated.
32+
report.plugin.goal.deprecated=Deprecated
3333
report.plugin.goal.notice.prefix=Note
3434
report.plugin.goal.notice.isMavenReport=This goal should be used as a Maven report.
3535
report.plugin.goal.fullname=Full name
@@ -64,7 +64,7 @@ report.plugin.goal.parameter.name=<{0}>
6464
report.plugin.goal.parameter.defaultValue=Default
6565
report.plugin.goal.parameter.property=User Property
6666
report.plugin.goal.parameter.alias=Alias
67-
report.plugin.goal.parameter.deprecated=<strong>Deprecated.</strong> {0}
67+
report.plugin.goal.parameter.deprecated=Deprecated.
6868
report.plugin.goal.parameter.type=Type
6969
report.plugin.goal.parameter.required=Required
7070
report.plugin.goal.parameter.expression=Expression

maven-plugin-report-plugin/src/main/resources/plugin-report_de.properties

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,8 @@ report.plugin.goals.column.goal=Goal
2727
report.plugin.goals.column.isMavenReport=Bericht?
2828
report.plugin.goals.column.description=Beschreibung
2929
report.plugin.goal.nodescription=Keine Beschreibung.
30-
report.plugin.goal.deprecated=Missbilligt.
31-
30+
report.plugin.goal.deprecated=Missbilligt
31+
report.plugin.goal.parameter.deprecated=Missbilligt.
3232
report.plugin.goal.yes=Ja
3333
report.plugin.goal.no=Nein
3434

maven-plugin-report-plugin/src/main/resources/plugin-report_fr.properties

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,8 @@ report.plugin.goals.column.goal=Goal
2626
report.plugin.goals.column.isMavenReport=Rapport?
2727
report.plugin.goals.column.description=Description
2828
report.plugin.goal.nodescription=Pas de description.
29-
report.plugin.goal.deprecated=Obsol\u00E8te.
30-
29+
report.plugin.goal.deprecated=Obsol\u00E8te
30+
report.plugin.goal.parameter.deprecated=Obsol\u00E8te.
3131
report.plugin.goal.yes=Oui
3232
report.plugin.goal.no=Non
3333

maven-plugin-report-plugin/src/main/resources/plugin-report_sv.properties

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,8 @@ report.plugin.goals.column.goal=M\u00E5l
2626
report.plugin.goals.column.isMavenReport=Rapport?
2727
report.plugin.goals.column.description=Beskrivning
2828
report.plugin.goal.nodescription=Ingen beskrivning.
29-
report.plugin.goal.deprecated=F\u00F6r\u00E5ldrat.
30-
29+
report.plugin.goal.deprecated=F\u00F6r\u00E5ldrat
30+
report.plugin.goal.parameter.deprecated=F\u00F6r\u00E5ldrat.
3131
report.plugin.goal.yes=Ja
3232
report.plugin.goal.no=Nej
3333

0 commit comments

Comments
 (0)