Skip to content

Commit

Permalink
[MPLUGIN-499] Add deprecate description in parameters table
Browse files Browse the repository at this point in the history
  • Loading branch information
slawekjaranowski committed Dec 26, 2023
1 parent fc41218 commit 8c9926c
Show file tree
Hide file tree
Showing 9 changed files with 69 additions and 75 deletions.
1 change: 1 addition & 0 deletions maven-plugin-report-plugin/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
/*
* 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.
*/

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' )
assert pluginInfo.isFile()

assert !pluginInfo.text.contains('Memory')
assert !pluginInfo.text.contains('Disk Space')
// check JDK and Maven requirements
assert pluginInfo.text.contains('1.8')
assert pluginInfo.text.contains('3.2.5')

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

Original file line number Diff line number Diff line change
Expand Up @@ -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' )
Expand All @@ -36,3 +35,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
Original file line number Diff line number Diff line change
Expand Up @@ -274,10 +274,8 @@ private void renderParameterOverviewTableRow(Parameter parameter) {
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");
Expand All @@ -304,13 +302,7 @@ private void renderParameterDetails(Iterator<Parameter> parameters) {
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));
Expand Down Expand Up @@ -355,6 +347,20 @@ private void renderParameterDetails(Iterator<Parameter> parameters) {
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();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,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
Expand Down Expand Up @@ -63,7 +63,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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,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

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,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

Expand Down

0 comments on commit 8c9926c

Please sign in to comment.