Skip to content

Commit

Permalink
Prepare for Doxia 2.0.0
Browse files Browse the repository at this point in the history
  • Loading branch information
michael-o authored and hboutemy committed Oct 11, 2023
1 parent 8092879 commit 86fad5f
Show file tree
Hide file tree
Showing 23 changed files with 56 additions and 79 deletions.
2 changes: 1 addition & 1 deletion maven-plugin-annotations/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
<parent>
<groupId>org.apache.maven.plugin-tools</groupId>
<artifactId>maven-plugin-tools</artifactId>
<version>3.9.1-SNAPSHOT</version>
<version>3.10.0-SNAPSHOT</version>
</parent>

<artifactId>maven-plugin-annotations</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion maven-plugin-plugin/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
<parent>
<groupId>org.apache.maven.plugin-tools</groupId>
<artifactId>maven-plugin-tools</artifactId>
<version>3.9.1-SNAPSHOT</version>
<version>3.10.0-SNAPSHOT</version>
</parent>

<groupId>org.apache.maven.plugins</groupId>
Expand Down
14 changes: 10 additions & 4 deletions maven-plugin-report-plugin/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
<parent>
<groupId>org.apache.maven.plugin-tools</groupId>
<artifactId>maven-plugin-tools</artifactId>
<version>3.9.1-SNAPSHOT</version>
<version>3.10.0-SNAPSHOT</version>
</parent>

<groupId>org.apache.maven.plugins</groupId>
Expand Down Expand Up @@ -86,7 +86,12 @@
<dependency>
<groupId>org.apache.maven.doxia</groupId>
<artifactId>doxia-sink-api</artifactId>
<version>1.11.1</version>
<version>2.0.0-M7</version>
</dependency>
<dependency>
<groupId>org.apache.maven.doxia</groupId>
<artifactId>doxia-integration-tools</artifactId>
<version>2.0.0-M11</version>
</dependency>

<!-- shared -->
Expand Down Expand Up @@ -243,8 +248,9 @@
<settingsFile>src/it/settings.xml</settingsFile>
<streamLogsOnFailures>true</streamLogsOnFailures>
<filterProperties>
<sitePluginVersion>3.12.1</sitePluginVersion>
<projectInfoReportsPlugin>3.4.1</projectInfoReportsPlugin>
<sitePluginVersion>4.0.0-M9</sitePluginVersion>
<projectInfoReportsPlugin>4.0.0-M1-SNAPSHOT</projectInfoReportsPlugin>
<compilerPluginVersion>3.11.0</compilerPluginVersion>
<antVersion>${antVersion}</antVersion>
</filterProperties>
<properties>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -107,21 +107,18 @@ protected MavenProject getProject() {
* {@inheritDoc}
*/
public boolean canGenerateReport() {
if (skip || skipReport) {
getLog().info("Maven Plugin Plugin Report generation skipped.");
return false;
}

return true;
}

/**
* {@inheritDoc}
*/
protected void executeReport(Locale locale) throws MavenReportException {
if (!canGenerateReport()) {
return;
}
if (skip || skipReport) {
getLog().info("Maven Plugin Plugin Report generation skipped.");
return;
}

// Generate the plugin's documentation
generatePluginDocumentation(locale);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -100,9 +100,6 @@ under the License.
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-site-plugin</artifactId>
<version>@sitePluginVersion@</version>
<configuration>
<locales>en</locales>
</configuration>
</plugin>
</plugins>
</build>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,11 @@ def mojoDoc = new File( basedir, 'target/site/test-mojo.html' )

assert mojoDoc.isFile()

assert mojoDoc.text.contains('<b>See also:</b> <a class="externalLink" href="https://docs.oracle.com/javase/8/docs/api/java/util/Collections.html">java.util.Collections</a></div>') // mojo description see javadoc tag
assert mojoDoc.text.contains('<strong>See also:</strong> <a href="https://docs.oracle.com/javase/8/docs/api/java/util/Collections.html" class="externalLink">java.util.Collections</a></div>') // mojo description see javadoc tag

assert mojoDoc.text.contains('beans parameter leveraging <a href="apidocs/org/SimpleBean.html"><code>SimpleBean</code></a>.') // parameter description
assert mojoDoc.text.contains('<td><code><a href="apidocs/org/SimpleBean.html">Collection&lt;SimpleBean&gt;</a></code></td>') // type link in parameter overview
assert mojoDoc.text.contains('<li><b>Type</b>: <code><a href="apidocs/org/SimpleBean.html">java.util.Collection&lt;org.SimpleBean&gt;</a></code></li>') // type link in parameter details
assert mojoDoc.text.contains('<li><strong>Type</strong>: <code><a href="apidocs/org/SimpleBean.html">java.util.Collection&lt;org.SimpleBean&gt;</a></code></li>') // type link in parameter details

assert mojoDoc.text.contains('<div>invalid javadoc reference <code>org.apache.maven.artifact.Artifact</code>.</div>') // second parameter description with link being removed (as no javadoc site associated)

Expand Down
2 changes: 1 addition & 1 deletion maven-plugin-report-plugin/src/it/plugin-report/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ under the License.
<artifactId>maven-site-plugin</artifactId>
<version>@sitePluginVersion@</version>
<configuration>
<locales>en,de,fr</locales>
<locales>default,de,fr</locales>
</configuration>
</plugin>
</plugins>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -101,19 +101,16 @@ protected MavenProject getProject() {

/** {@inheritDoc} */
public boolean canGenerateReport() {
if (skip || skipReport) {
getLog().info("Maven Plugin Plugin Report generation skipped.");
return false;
}

return true;
}

/** {@inheritDoc} */
protected void executeReport(Locale locale) throws MavenReportException {
if (!canGenerateReport()) {
return;
}
if (skip || skipReport) {
getLog().info("Maven Plugin Plugin Report generation skipped.");
return;
}

// Generate the plugin's documentation
generatePluginDocumentation(locale);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -238,17 +238,16 @@ public String getOutputName() {
private void generateMojosDocumentation(PluginDescriptor pluginDescriptor, Locale locale)
throws MavenReportException {
try {
PluginXdocGenerator generator = new PluginXdocGenerator(
getProject(), locale, getReportOutputDirectory(), disableInternalJavadocLinkValidation);
PluginToolsRequest pluginToolsRequest = new DefaultPluginToolsRequest(getProject(), pluginDescriptor);
File outputDir;
if (!locale.equals(SiteTool.DEFAULT_LOCALE)) {
outputDir = new File(new File(generatedSiteDirectory, locale.toString()), "xdoc");
} else {
outputDir = new File(generatedSiteDirectory, "xdoc");
}
outputDir.mkdirs();

PluginXdocGenerator generator = new PluginXdocGenerator(
getProject(), locale, getReportOutputDirectory(), disableInternalJavadocLinkValidation);
PluginToolsRequest pluginToolsRequest = new DefaultPluginToolsRequest(getProject(), pluginDescriptor);
generator.execute(outputDir, pluginToolsRequest);
} catch (GeneratorException e) {
throw new MavenReportException("Error writing plugin documentation", e);
Expand Down Expand Up @@ -524,7 +523,7 @@ private void renderUsageSection(boolean hasMavenReport) {
sb.append(" ...").append(Markup.EOL);
sb.append("</project>");

verbatimText(sb.toString());
verbatimSource(sb.toString());

sink.paragraph();
linkPatternedText(getI18nString("configuration.end"));
Expand Down
2 changes: 1 addition & 1 deletion maven-plugin-tools-annotations/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
<parent>
<groupId>org.apache.maven.plugin-tools</groupId>
<artifactId>maven-plugin-tools</artifactId>
<version>3.9.1-SNAPSHOT</version>
<version>3.10.0-SNAPSHOT</version>
</parent>

<artifactId>maven-plugin-tools-annotations</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion maven-plugin-tools-api/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
<parent>
<groupId>org.apache.maven.plugin-tools</groupId>
<artifactId>maven-plugin-tools</artifactId>
<version>3.9.1-SNAPSHOT</version>
<version>3.10.0-SNAPSHOT</version>
</parent>

<artifactId>maven-plugin-tools-api</artifactId>
Expand Down
4 changes: 2 additions & 2 deletions maven-plugin-tools-generators/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
<parent>
<groupId>org.apache.maven.plugin-tools</groupId>
<artifactId>maven-plugin-tools</artifactId>
<version>3.9.1-SNAPSHOT</version>
<version>3.10.0-SNAPSHOT</version>
</parent>

<artifactId>maven-plugin-tools-generators</artifactId>
Expand Down Expand Up @@ -62,7 +62,7 @@
<!-- other -->
<dependency>
<groupId>org.apache.velocity</groupId>
<artifactId>velocity</artifactId>
<artifactId>velocity-engine-core</artifactId>
</dependency>

<dependency>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,20 +81,20 @@ public class PluginXdocGenerator implements Generator {
private final boolean disableInternalJavadocLinkValidation;

/**
* Default constructor using <code>Locale.ENGLISH</code> as locale.
* Default constructor using <code>Locale.ROOT</code> as locale.
* Used only in test cases.
*/
public PluginXdocGenerator() {
this(null);
}

/**
* Constructor using <code>Locale.ENGLISH</code> as locale.
* Constructor using <code>Locale.ROOT</code> as locale.
*
* @param project not null Maven project.
*/
public PluginXdocGenerator(MavenProject project) {
this(project, Locale.ENGLISH, new File("").getAbsoluteFile(), false);
this(project, Locale.ROOT, new File("").getAbsoluteFile(), false);
}

/**
Expand Down Expand Up @@ -135,7 +135,8 @@ public void execute(File destinationDirectory, PluginToolsRequest request) throw
* @throws IOException if any
*/
protected void processMojoDescriptor(MojoDescriptor mojoDescriptor, File destinationDirectory) throws IOException {
File outputFile = new File(destinationDirectory, getMojoFilename(mojoDescriptor, "xml"));
// TODO Rewrite to: Sink sink = new XdocSinkFactory().createSink(outputDir, "*-mojo.xml", encoding);
File outputFile = new File(destinationDirectory, mojoDescriptor.getGoal() + "-mojo.xml");
try (Writer writer = new OutputStreamWriter(new CachingOutputStream(outputFile), UTF_8)) {
XMLWriter w = new PrettyPrintXMLWriter(new PrintWriter(writer), UTF_8.name(), null);
writeBody(mojoDescriptor, w);
Expand All @@ -144,15 +145,6 @@ protected void processMojoDescriptor(MojoDescriptor mojoDescriptor, File destina
}
}

/**
* @param mojo not null
* @param ext not null
* @return the output file name
*/
private String getMojoFilename(MojoDescriptor mojo, String ext) {
return mojo.getGoal() + "-mojo." + ext;
}

/**
* @param mojoDescriptor not null
* @param w not null
Expand Down Expand Up @@ -623,7 +615,6 @@ private void writeParameterList(String title, List<Parameter> parameterList, XML
w.addAttribute("name", title);

w.startElement("table");
w.addAttribute("border", "0");
w.addAttribute("class", "bodyTable");

w.startElement("tr");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ pluginxdoc.mojodescriptor.parameter.details=Parameter Details
pluginxdoc.mojodescriptor.parameter.deprecated=<strong>Deprecated.</strong> {0}
pluginxdoc.mojodescriptor.parameter.name=Name
pluginxdoc.mojodescriptor.parameter.name_link=<code><a href="#{0}">&lt;{0}&gt;</a></code>
pluginxdoc.mojodescriptor.parameter.name_internal=<strong><a name="{0}">&lt;{0}&gt;</a></strong>
pluginxdoc.mojodescriptor.parameter.name_internal=<strong><a id="{0}">&lt;{0}&gt;</a></strong>
pluginxdoc.mojodescriptor.parameter.description=Description
pluginxdoc.mojodescriptor.parameter.type=Type
pluginxdoc.mojodescriptor.parameter.type_link=<a href="{1}">{0}</a>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@
</li>
</ul>
<subsection name="Required Parameters">
<table border="0" class="bodyTable">
<table class="bodyTable">
<tr>
<th>Name</th>
<th>Type</th>
Expand Down Expand Up @@ -81,7 +81,7 @@
</table>
</subsection>
<subsection name="Optional Parameters">
<table border="0" class="bodyTable">
<table class="bodyTable">
<tr>
<th>Name</th>
<th>Type</th>
Expand Down Expand Up @@ -109,7 +109,7 @@
<subsection name="Parameter Details">
<h4>
<strong>
<a name="dir">&lt;dir&gt;</a>
<a id="dir">&lt;dir&gt;</a>
</strong>
</h4>
<div>Test parameter description</div>
Expand Down Expand Up @@ -142,7 +142,7 @@
<hr/>
<h4>
<strong>
<a name="withoutSince">&lt;withoutSince&gt;</a>
<a id="withoutSince">&lt;withoutSince&gt;</a>
</strong>
</h4>
<div>(no description)</div>
Expand Down
2 changes: 1 addition & 1 deletion maven-plugin-tools-java/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
<parent>
<groupId>org.apache.maven.plugin-tools</groupId>
<artifactId>maven-plugin-tools</artifactId>
<version>3.9.1-SNAPSHOT</version>
<version>3.10.0-SNAPSHOT</version>
</parent>

<artifactId>maven-plugin-tools-java</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion maven-script/maven-plugin-tools-ant/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
<parent>
<groupId>org.apache.maven.plugin-tools</groupId>
<artifactId>maven-script</artifactId>
<version>3.9.1-SNAPSHOT</version>
<version>3.10.0-SNAPSHOT</version>
</parent>

<artifactId>maven-plugin-tools-ant</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion maven-script/maven-plugin-tools-beanshell/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
<parent>
<groupId>org.apache.maven.plugin-tools</groupId>
<artifactId>maven-script</artifactId>
<version>3.9.1-SNAPSHOT</version>
<version>3.10.0-SNAPSHOT</version>
</parent>

<artifactId>maven-plugin-tools-beanshell</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion maven-script/maven-plugin-tools-model/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
<parent>
<groupId>org.apache.maven.plugin-tools</groupId>
<artifactId>maven-script</artifactId>
<version>3.9.1-SNAPSHOT</version>
<version>3.10.0-SNAPSHOT</version>
</parent>

<artifactId>maven-plugin-tools-model</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion maven-script/maven-script-ant/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ under the License.
<parent>
<groupId>org.apache.maven.plugin-tools</groupId>
<artifactId>maven-script</artifactId>
<version>3.9.1-SNAPSHOT</version>
<version>3.10.0-SNAPSHOT</version>
</parent>

<artifactId>maven-script-ant</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion maven-script/maven-script-beanshell/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ under the License.
<parent>
<groupId>org.apache.maven.plugin-tools</groupId>
<artifactId>maven-script</artifactId>
<version>3.9.1-SNAPSHOT</version>
<version>3.10.0-SNAPSHOT</version>
</parent>

<artifactId>maven-script-beanshell</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion maven-script/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ under the License.
<parent>
<groupId>org.apache.maven.plugin-tools</groupId>
<artifactId>maven-plugin-tools</artifactId>
<version>3.9.1-SNAPSHOT</version>
<version>3.10.0-SNAPSHOT</version>
</parent>

<artifactId>maven-script</artifactId>
Expand Down

0 comments on commit 86fad5f

Please sign in to comment.