Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support for Java 11 #96

Closed
wants to merge 20 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
69a84e9
Update snapshot version to 2.0.0.
chrisvest Dec 4, 2018
19dfdc0
Modularise and get things compiling on Java 11.
chrisvest Dec 4, 2018
ccd0f58
License headers are not javadocs.
chrisvest Dec 4, 2018
4b128b7
First draft of getting the asciidoclet to run on the new Javadoc APIs…
chrisvest Jun 7, 2019
a2613e2
Tell Travis CI to use Java 11.
chrisvest Jun 7, 2019
a7d5b41
Bring back error reporting in AttributesLoader, and make sure to alwa…
chrisvest Jun 8, 2019
14b4ea2
Make the stylesheet tests pass.
chrisvest Jun 9, 2019
b3b7311
Insert asciidoctor rendering into more places.
chrisvest Jun 11, 2019
af26dde
Doclet option names begin with double-dashes.
chrisvest Jun 11, 2019
846f516
The old AsciidocletTest is not worth salvaging.
chrisvest Jun 11, 2019
13c538c
Reduce reliance on Guava for IO stuff.
chrisvest Jun 11, 2019
97ef423
Remove the remaining usages of Guava.
chrisvest Jun 11, 2019
5c91e69
Improve the javadoc parsing. Particularly around javadoc tags. Also a…
chrisvest Jul 6, 2019
1edd3c6
Fix tests and remove debugging left overs.
chrisvest Jul 7, 2019
423e657
Keep everything grouped under the `org.asciidctor.asciidoclet` group …
chrisvest Jul 13, 2019
2b91607
Fix the Maven javadoc plugin configuration, and a couple of other thi…
chrisvest Jul 16, 2019
16d809e
Resource copying, including copying over our own style sheets, now wo…
chrisvest Jul 19, 2019
95e3281
Make a `mvn javadoc:javadoc` build pass, by ignoring HTML5 doclint er…
chrisvest Jul 19, 2019
1400517
Overview, and other files, are now processed correctly as well.
chrisvest Jul 21, 2019
b73c8df
Add callouts to explain the new options in the Maven plugin example.
chrisvest Jul 21, 2019
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 1 addition & 3 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
dist: trusty
language: java
jdk:
- oraclejdk8
- openjdk8
- openjdk7
- openjdk11
chrisvest marked this conversation as resolved.
Show resolved Hide resolved
notifications:
irc: "irc.freenode.org#asciidoctor"
20 changes: 14 additions & 6 deletions README.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ The result is readable source and beautifully rendered Javadocs, the best of bot
// tag::usage[]
== Usage

Run Javadoc with the `org.asciidoctor.Asciidoclet` doclet class.
Run Javadoc with the `org.asciidoctor.asciidoclet.Asciidoclet` doclet class.
Some examples for common build systems are shown below.
See <<doclet-options>> for supported options.

Expand All @@ -122,8 +122,12 @@ Asciidoclet may be used via a `maven-javadoc-plugin` doclet:
<artifactId>maven-javadoc-plugin</artifactId>
<version>2.9</version>
<configuration>
<source>1.7</source>
<doclet>org.asciidoctor.Asciidoclet</doclet>
<source>11</source>
<additionalJOptions>
<additionalJOption>-J--add-exports=jdk.javadoc/jdk.javadoc.internal.tool=ALL-UNNAMED</additionalJOption> // <1>
<additionalJOption>-Xdoclint:all,-html,-accessibility</additionalJOption> // <2>
</additionalJOptions>
<doclet>org.asciidoctor.asciidoclet.Asciidoclet</doclet>
<docletArtifact>
<groupId>org.asciidoctor</groupId>
<artifactId>asciidoclet</artifactId>
Expand All @@ -139,6 +143,10 @@ Asciidoclet may be used via a `maven-javadoc-plugin` doclet:
</configuration>
</plugin>
----
<1> For the asciidoclet to work, it needs access to the internals of the `javadoc` tool.
This incantation makes that access possible on moduler JDKs.
<2> Asciidoctor may generate HTML that produces doclint errors, which can cause the build to fail.
To work around that, we have to disable these doclint categories.

=== Gradle

Expand All @@ -156,13 +164,13 @@ dependencies {

javadoc {
options.docletpath = configurations.asciidoclet.files.asType(List)
options.doclet = 'org.asciidoctor.Asciidoclet'
options.doclet = 'org.asciidoctor.asciidoclet.Asciidoclet'
options.overview = "src/main/java/overview.adoc"
options.addStringOption "-base-dir", "${projectDir}" // <1>
options.addStringOption "-attribute", // <2>
"name=${project.name}," +
"version=${project.version}," +
"title-link=http://example.com[${project.name} ${project.version}]")
"title-link=http://example.com[${project.name} ${project.version}]"
}
----
<1> Option names passed to Gradle's `javadoc` task must omit the leading "-", so here "-base-dir" means "--base-dir".
Expand All @@ -179,7 +187,7 @@ Asciidoclet may be used via a doclet element in Ant's `javadoc` task:
<javadoc destdir="target/javadoc"
sourcepath="src"
overview="src/overview.adoc">
<doclet name="org.asciidoctor.Asciidoclet" pathref="asciidoclet.classpath"> <!--1-->
<doclet name="org.asciidoctor.asciidoclet.Asciidoclet" pathref="asciidoclet.classpath"> <!--1-->
<param name="--base-dir" value="${basedir}"/>
<param name="--attribute" value="name=${ant.project.name}"/>
<param name="--attribute" value="version=${version}"/>
Expand Down
127 changes: 69 additions & 58 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<groupId>org.asciidoctor</groupId>
<artifactId>asciidoclet</artifactId>
<packaging>jar</packaging>
<version>1.5.7-SNAPSHOT</version>
<version>2.0.0-SNAPSHOT</version>

<name>AsciiDoc Javadoc Doclet</name>

Expand Down Expand Up @@ -46,70 +46,69 @@
<artifactId>asciidoctorj</artifactId>
<version>1.5.8.1</version>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

While we're at it and doing a full 2.x rev, we should really sync with the rest of the asciidoctor projects and use the same versions. That would mean upgrading to the latest asciidoctorj. I know that's a lot for a single pull request though.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a good version policy to have. If it needs to be done in this PR, then I'd like to get the Java 11 port working first, though, with minimal behavioural changes.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

+1

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

+1

</dependency>
<dependency>
<groupId>com.sun.tools</groupId>
<artifactId>tools</artifactId>
<version>${java.version}</version>
<scope>system</scope>
<systemPath>${java.home}/../lib/tools.jar</systemPath>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-simple</artifactId>
<version>1.7.25</version>
</dependency>
<dependency>
<groupId>com.google.guava</groupId>
<artifactId>guava</artifactId>
<version>20.0</version>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.12</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.mockito</groupId>
<artifactId>mockito-all</artifactId>
<version>1.10.19</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.powermock</groupId>
<artifactId>powermock-module-junit4</artifactId>
<version>1.6.4</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.powermock</groupId>
<artifactId>powermock-api-mockito</artifactId>
<version>1.6.4</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.hamcrest</groupId>
<artifactId>hamcrest-library</artifactId>
<version>1.3</version>
<scope>test</scope>
</dependency>
</dependencies>

<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-enforcer-plugin</artifactId>
<version>3.0.0-M2</version>
<executions>
<execution>
<id>enforce-maven</id>
<goals>
<goal>enforce</goal>
</goals>
<configuration>
<rules>
<requireMavenVersion>
<version>3.0.5</version>
</requireMavenVersion>
</rules>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.1</version>
<version>3.8.0</version>
<configuration>
<source>11</source>
<target>11</target>
<compilerArgs>
<arg>--add-exports</arg>
<arg>jdk.javadoc/jdk.javadoc.internal.tool=asciidoclet</arg>
<arg>--add-exports</arg>
<arg>jdk.compiler/com.sun.tools.javac.parser=asciidoclet</arg>
<arg>--add-exports</arg>
<arg>jdk.compiler/com.sun.tools.javac.tree=asciidoclet</arg>
<arg>--add-exports</arg>
<arg>jdk.compiler/com.sun.tools.javac.model=asciidoclet</arg>
</compilerArgs>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
<source>1.6</source>
<target>1.6</target>
<forkMode>once</forkMode>
<argLine>
--add-exports jdk.javadoc/jdk.javadoc.internal.tool=ALL-UNNAMED
</argLine>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-source-plugin</artifactId>
<version>2.2.1</version>
<version>3.0.1</version>
<executions>
<execution>
<id>attach-sources</id>
Expand All @@ -119,11 +118,10 @@
</execution>
</executions>
</plugin>
<!-- tag::pom_include[] -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
<version>2.9</version>
<version>3.0.1</version>
<executions>
<execution>
<id>attach-javadocs</id>
Expand All @@ -133,28 +131,38 @@
</execution>
</executions>
<configuration>
<source>1.7</source>
<doclet>org.asciidoctor.Asciidoclet</doclet>
<source>11</source>
<additionalJOptions>
<additionalJOption>--add-exports=jdk.javadoc/jdk.javadoc.internal.tool=asciidoclet</additionalJOption>
<additionalJOption>--add-exports=jdk.compiler/com.sun.tools.javac.parser=asciidoclet</additionalJOption>
<additionalJOption>--add-exports=jdk.compiler/com.sun.tools.javac.tree=asciidoclet</additionalJOption>
<additionalJOption>--add-exports=jdk.compiler/com.sun.tools.javac.model=asciidoclet</additionalJOption>
<additionalJOption>-J--add-exports=jdk.javadoc/jdk.javadoc.internal.tool=ALL-UNNAMED</additionalJOption>
<additionalJOption>-J--add-exports=jdk.compiler/com.sun.tools.javac.parser=ALL-UNNAMED</additionalJOption>
<additionalJOption>-J--add-exports=jdk.compiler/com.sun.tools.javac.tree=ALL-UNNAMED</additionalJOption>
<additionalJOption>-J--add-exports=jdk.compiler/com.sun.tools.javac.model=ALL-UNNAMED</additionalJOption>
<additionalJOption>-Xdoclint:all,-html,-accessibility</additionalJOption>
</additionalJOptions>
<doclet>org.asciidoctor.asciidoclet.Asciidoclet</doclet>
<docletArtifact>
<groupId>org.asciidoctor</groupId>
<artifactId>asciidoclet</artifactId>
<groupId>${project.groupId}</groupId>
<artifactId>${project.artifactId}</artifactId>
<version>${project.version}</version>
</docletArtifact>
<additionalparam> <!--1-->
<additionalOptions>
--base-dir ${project.basedir}
--attribute "project_name=${project.name}"
--attribute "project_version=${project.version}"
--attribute "project_desc=${project.description}"
</additionalparam>
</additionalOptions>
<linksource>true</linksource>
<overview>src/main/java/overview.adoc</overview> <!--2-->
<overview>src/main/java/overview.adoc</overview>
</configuration>
</plugin>
<!-- end::pom_include[] -->
<plugin>
<groupId>com.mycila.maven-license-plugin</groupId>
<artifactId>maven-license-plugin</artifactId>
<version>1.9.0</version>
<version>1.10.b1</version>
<configuration>
<header>NOTICE</header>
<includes>
Expand All @@ -173,12 +181,15 @@
</properties>
<useDefaultExcludes>true</useDefaultExcludes>
<strictCheck>true</strictCheck>
<mapping>
<java>SLASHSTAR_STYLE</java>
</mapping>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<version>3.1.1</version>
<version>3.2.1</version>
<configuration>
<shadedArtifactAttached>true</shadedArtifactAttached>
<shadedClassifierName>shaded</shadedClassifierName>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**
* Copyright 2013-2015 John Ericksen
/*
* Copyright 2013-2018 John Ericksen
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand All @@ -13,16 +13,9 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.asciidoctor.asciidoclet;

import com.sun.javadoc.Doc;

/**
* Interface used to render a Javadoc Doc
*
* @author John Ericksen
*/
public interface DocletRenderer {

void renderDoc(Doc doc);
}
module asciidoclet {
requires java.base;
requires jdk.javadoc;
requires asciidoctorj;
exports org.asciidoctor.asciidoclet;
}
Loading