diff --git a/README.adoc b/README.adoc index bee97e4..7df83b2 100644 --- a/README.adoc +++ b/README.adoc @@ -125,8 +125,12 @@ Asciidoclet may be used via a `maven-javadoc-plugin` doclet: 11 - -J--add-exports=jdk.javadoc/jdk.javadoc.internal.tool=ALL-UNNAMED // <1> - -Xdoclint:all,-html,-accessibility // <2> + -J--add-exports=jdk.javadoc/jdk.javadoc.internal.tool=ALL-UNNAMED + -J--add-exports=jdk.compiler/com.sun.tools.javac.tree=ALL-UNNAMED + -J--add-exports=jdk.compiler/com.sun.tools.javac.parser=ALL-UNNAMED + -J--add-opens=jdk.compiler/com.sun.tools.javac.api=ALL-UNNAMED + -J--add-opens=jdk.compiler/com.sun.tools.javac.parser=ALL-UNNAMED + -Xdoclint:all,-html,-accessibility org.asciidoctor.asciidoclet.Asciidoclet @@ -153,6 +157,36 @@ To work around that, we have to disable these doclint categories. Asciidoclet may be used via a doclet in the `Javadoc` task: +with Kotlin +[source,kotlin] +---- +val asciiDoclet by configurations.registering + +dependencies { + asciiDoclet("org.asciidoctor:asciidoclet:2.+") +} + +tasks.withType().configureEach { // process *all* javadoc configurations, not just the one for main + options { + doclet("org.asciidoctor.asciidoclet.Asciidoclet") + docletpath(*asciiDoclet.get().files.toTypedArray()) + overview("README.adoc") // you can also point this to the traditional overview like in the groovy example + jFlags( + "--add-exports=jdk.javadoc/jdk.javadoc.internal.tool=ALL-UNNAMED", + "--add-exports=jdk.compiler/com.sun.tools.javac.tree=ALL-UNNAMED", + "--add-exports=jdk.compiler/com.sun.tools.javac.parser=ALL-UNNAMED", + "--add-opens=jdk.compiler/com.sun.tools.javac.api=ALL-UNNAMED", + "--add-opens=jdk.compiler/com.sun.tools.javac.parser=ALL-UNNAMED", + ) + } + (options as StandardJavadocDocletOptions).apply { + addStringOption("-base-dir", project.layout.projectDirectory.asFile.path) // 1 + addStringsOption("-attribute", ",").value = listOf("name=${project.name}", "version=${project.version}") // 2 + } +} +---- + +or with groovy, this example only uses main javadoc and will not handle classes generated by source code [source,groovy] ---- configurations { @@ -160,13 +194,20 @@ configurations { } dependencies { - asciidoclet 'org.asciidoctor:asciidoclet:1.+' + asciidoclet 'org.asciidoctor:asciidoclet:2.+' } javadoc { options.docletpath = configurations.asciidoclet.files.asType(List) options.doclet = 'org.asciidoctor.asciidoclet.Asciidoclet' options.overview = "src/main/java/overview.adoc" + options.jFlags = [ + "--add-exports=jdk.javadoc/jdk.javadoc.internal.tool=ALL-UNNAMED", + "--add-exports=jdk.compiler/com.sun.tools.javac.tree=ALL-UNNAMED", + "--add-exports=jdk.compiler/com.sun.tools.javac.parser=ALL-UNNAMED", + "--add-opens=jdk.compiler/com.sun.tools.javac.api=ALL-UNNAMED", + "--add-opens=jdk.compiler/com.sun.tools.javac.parser=ALL-UNNAMED", + ] options.addStringOption "-base-dir", "${projectDir}" // <1> options.addStringOption "-attribute", // <2> "name=${project.name}," +