Skip to content

Commit

Permalink
Load a resource from the jdk runtime because it is not in the sources.
Browse files Browse the repository at this point in the history
Closes #22.
  • Loading branch information
mnlipp committed Sep 26, 2023
1 parent ab9b5fe commit 6966c5d
Show file tree
Hide file tree
Showing 5 changed files with 23 additions and 43 deletions.
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ apply plugin: 'mdoclet.java-library-conventions'
allprojects {

group = 'org.jdrupes.mdoclet'
version = '4.0.0'
version = '4.1.0'

description = 'A doclet for processing javadoc comments written with Markup'

Expand Down
4 changes: 2 additions & 2 deletions mdoclet/MDoclet-Test (Java 21).launch
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
<stringAttribute key="org.eclipse.jdt.launching.JRE_CONTAINER" value="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-21/"/>
<stringAttribute key="org.eclipse.jdt.launching.MAIN_TYPE" value="jdk.javadoc.internal.tool.Main"/>
<stringAttribute key="org.eclipse.jdt.launching.MODULE_NAME" value="mdoclet"/>
<stringAttribute key="org.eclipse.jdt.launching.PROGRAM_ARGUMENTS" value="--add-exports=jdk.javadoc/org.jdrupes.mdoclet.internal.tool=ALL-UNNAMED&#10;--add-exports=jdk.compiler/com.sun.tools.javac.tree=ALL-UNNAMED&#10;-doclet org.jdrupes.mdoclet.MDoclet --disable-auto-highlight -Xdoclint:-html&#10;-overview testfiles/overview.md -d build/testfiles testfiles/test/Test.java testfiles/test/MDocletExample.java"/>
<stringAttribute key="org.eclipse.jdt.launching.PROGRAM_ARGUMENTS" value="--add-exports=jdk.compiler/com.sun.tools.javac.tree=ALL-UNNAMED&#10;--add-opens=jdk.javadoc/jdk.javadoc.internal.doclets.toolkit.resources.releases=ALL-UNNAMED&#10;-doclet org.jdrupes.mdoclet.MDoclet --disable-auto-highlight -Xdoclint:-html&#10;-overview testfiles/overview.md -d build/testfiles testfiles/test/Test.java testfiles/test/MDocletExample.java"/>
<stringAttribute key="org.eclipse.jdt.launching.PROJECT_ATTR" value="mdoclet"/>
<stringAttribute key="org.eclipse.jdt.launching.VM_ARGUMENTS" value="--add-exports=jdk.javadoc/org.jdrupes.mdoclet.internal.tool=ALL-UNNAMED&#10;--add-exports=jdk.compiler/com.sun.tools.javac.tree=ALL-UNNAMED"/>
<stringAttribute key="org.eclipse.jdt.launching.VM_ARGUMENTS" value="--add-exports=jdk.compiler/com.sun.tools.javac.tree=ALL-UNNAMED&#10;--add-opens=jdk.javadoc/jdk.javadoc.internal.doclets.toolkit.resources.releases=ALL-UNNAMED"/>
</launchConfiguration>
31 changes: 10 additions & 21 deletions mdoclet/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,8 @@ def addedExports = ['jdk.internal.opt/jdk.internal.opt=ALL-UNNAMED',
'jdk.compiler/com.sun.tools.javac.model=ALL-UNNAMED',
'jdk.compiler/com.sun.tools.javac.tree=ALL-UNNAMED',
'jdk.compiler/com.sun.tools.javac.util=ALL-UNNAMED',
'jdk.javadoc/jdk.javadoc.internal.tool=ALL-UNNAMED']
'jdk.javadoc/jdk.javadoc.internal.tool=ALL-UNNAMED',
'jdk.javadoc/jdk.javadoc.internal.doclets.toolkit=ALL-UNNAMED']

compileJava {
addedExports.forEach {
Expand Down Expand Up @@ -89,32 +90,25 @@ task apidocs(type: JavaExec) {
inputs.file "overview.md"
ext.destinationDir = '../../jdrupes-mdoclet.gh-pages/javadoc/'

jvmArgs = ['--add-exports=jdk.internal.opt/jdk.internal.opt=ALL-UNNAMED',
'--add-exports=jdk.compiler/com.sun.tools.javac.api=ALL-UNNAMED',
jvmArgs = [
'--add-exports=jdk.compiler/com.sun.tools.doclint=ALL-UNNAMED',
'--add-exports=jdk.compiler/com.sun.tools.javac.code=ALL-UNNAMED',
'--add-exports=jdk.compiler/com.sun.tools.javac.comp=ALL-UNNAMED',
'--add-exports=jdk.compiler/com.sun.tools.javac.file=ALL-UNNAMED',
'--add-exports=jdk.compiler/com.sun.tools.javac.jvm=ALL-UNNAMED',
'--add-exports=jdk.compiler/com.sun.tools.javac.main=ALL-UNNAMED',
'--add-exports=jdk.compiler/com.sun.tools.javac.model=ALL-UNNAMED',
'--add-exports=jdk.compiler/com.sun.tools.javac.tree=ALL-UNNAMED',
'--add-exports=jdk.compiler/com.sun.tools.javac.util=ALL-UNNAMED',
'--add-exports=jdk.compiler/com.sun.tools.doclint=ALL-UNNAMED',
'--add-exports=jdk.javadoc/jdk.javadoc.internal.tool=ALL-UNNAMED']
'--add-exports=jdk.javadoc/jdk.javadoc.internal.tool=ALL-UNNAMED'
]
classpath sourceSets.main.compileClasspath

main = 'jdk.javadoc.internal.tool.Main'
args = ['-doctitle', 'JDrupes MDoclet',
'-use',
'-linksource',
'-link', 'https://docs.oracle.com/en/java/javase/21/docs/api/',
'--add-exports', 'jdk.internal.opt/jdk.internal.opt=ALL-UNNAMED',
'--add-exports', 'jdk.compiler/com.sun.tools.doclint=ALL-UNNAMED',
'--add-exports', 'jdk.compiler/com.sun.tools.javac.api=ALL-UNNAMED',
'--add-exports', 'jdk.compiler/com.sun.tools.javac.code=ALL-UNNAMED',
'--add-exports', 'jdk.compiler/com.sun.tools.javac.comp=ALL-UNNAMED',
'--add-exports', 'jdk.compiler/com.sun.tools.javac.file=ALL-UNNAMED',
'--add-exports', 'jdk.compiler/com.sun.tools.javac.jvm=ALL-UNNAMED',
'--add-exports', 'jdk.compiler/com.sun.tools.javac.main=ALL-UNNAMED',
'--add-exports', 'jdk.compiler/com.sun.tools.javac.model=ALL-UNNAMED',
'--add-exports', 'jdk.compiler/com.sun.tools.javac.tree=ALL-UNNAMED',
Expand Down Expand Up @@ -158,18 +152,13 @@ task testJavadoc(type: Javadoc) {
options.addStringOption('Xdoclint:-html', '-quiet')

options.setJFlags([
'--add-exports=jdk.internal.opt/jdk.internal.opt=ALL-UNNAMED',
'--add-exports=jdk.compiler/com.sun.tools.javac.api=ALL-UNNAMED',
'--add-exports=jdk.compiler/com.sun.tools.doclint=ALL-UNNAMED',
'--add-exports=jdk.compiler/com.sun.tools.javac.code=ALL-UNNAMED',
'--add-exports=jdk.compiler/com.sun.tools.javac.comp=ALL-UNNAMED',
'--add-exports=jdk.compiler/com.sun.tools.javac.file=ALL-UNNAMED',
'--add-exports=jdk.compiler/com.sun.tools.javac.jvm=ALL-UNNAMED',
'--add-exports=jdk.compiler/com.sun.tools.javac.main=ALL-UNNAMED',
'--add-exports=jdk.compiler/com.sun.tools.javac.model=ALL-UNNAMED',
'--add-exports=jdk.compiler/com.sun.tools.javac.tree=ALL-UNNAMED',
'--add-exports=jdk.compiler/com.sun.tools.javac.util=ALL-UNNAMED',
'--add-exports=jdk.compiler/com.sun.tools.doclint=ALL-UNNAMED',
'--add-exports=jdk.javadoc/jdk.javadoc.internal.tool=ALL-UNNAMED'])
'--add-exports=jdk.javadoc/jdk.javadoc.internal.tool=ALL-UNNAMED',
'--add-exports=jdk.javadoc/jdk.javadoc.internal.doclets.toolkit=ALL-UNNAMED',
'--add-opens=jdk.javadoc/jdk.javadoc.internal.doclets.toolkit.resources.releases=ALL-UNNAMED'])
}

check.dependsOn testJavadoc
Expand Down
26 changes: 8 additions & 18 deletions mdoclet/overview.md
Original file line number Diff line number Diff line change
Expand Up @@ -77,18 +77,13 @@ javadoc -J--add-exports=jdk.javadoc/jdk.javadoc.internal.tool=ALL-UNNAMED \
<div class="tab-content" style="display: none;" data-tab-group="usage" data-tab-name="v4">

```sh
javadoc -J--add-exports=jdk.internal.opt/jdk.internal.opt=ALL-UNNAMED \
-J--add-exports=jdk.compiler/com.sun.tools.javac.api=ALL-UNNAMED \
javadoc -J--add-exports=jdk.compiler/com.sun.tools.doclint=ALL-UNNAMED \
-J--add-exports=jdk.compiler/com.sun.tools.javac.code=ALL-UNNAMED \
-J--add-exports=jdk.compiler/com.sun.tools.javac.comp=ALL-UNNAMED \
-J--add-exports=jdk.compiler/com.sun.tools.javac.file=ALL-UNNAMED \
-J--add-exports=jdk.compiler/com.sun.tools.javac.jvm=ALL-UNNAMED \
-J--add-exports=jdk.compiler/com.sun.tools.javac.main=ALL-UNNAMED \
-J--add-exports=jdk.compiler/com.sun.tools.javac.model=ALL-UNNAMED \
-J--add-exports=jdk.compiler/com.sun.tools.javac.tree=ALL-UNNAMED \
-J--add-exports=jdk.compiler/com.sun.tools.javac.util=ALL-UNNAMED \
-J--add-exports=jdk.compiler/com.sun.tools.doclint=ALL-UNNAMED \
-J--add-exports=jdk.javadoc/jdk.javadoc.internal.tool=ALL-UNNAMED \
-J--add-exports=jdk.javadoc/jdk.javadoc.internal.doclets.toolkit=ALL-UNNAMED \
-J--add-opens=jdk.javadoc/jdk.javadoc.internal.doclets.toolkit.resources.releases=ALL-UNNAMED \
-doclet org.jdrupes.mdoclet.MDoclet -docletpath /path/to/org.jdrupes.mdoclet.jar:another.jar
```

Expand Down Expand Up @@ -179,7 +174,7 @@ configurations {
}
dependencies {
markdownDoclet "org.jdrupes.mdoclet:doclet:4.0.0"
markdownDoclet "org.jdrupes.mdoclet:doclet:4.1.0"
}
task testJavadoc(type: Javadoc) {
Expand All @@ -193,18 +188,13 @@ task testJavadoc(type: Javadoc) {
options.addStringOption('Xdoclint:-html', '-quiet')
options.setJFlags([
'--add-exports=jdk.internal.opt/jdk.internal.opt=ALL-UNNAMED',
'--add-exports=jdk.compiler/com.sun.tools.javac.api=ALL-UNNAMED',
'--add-exports=jdk.compiler/com.sun.tools.doclint=ALL-UNNAMED',
'--add-exports=jdk.compiler/com.sun.tools.javac.code=ALL-UNNAMED',
'--add-exports=jdk.compiler/com.sun.tools.javac.comp=ALL-UNNAMED',
'--add-exports=jdk.compiler/com.sun.tools.javac.file=ALL-UNNAMED',
'--add-exports=jdk.compiler/com.sun.tools.javac.jvm=ALL-UNNAMED',
'--add-exports=jdk.compiler/com.sun.tools.javac.main=ALL-UNNAMED',
'--add-exports=jdk.compiler/com.sun.tools.javac.model=ALL-UNNAMED',
'--add-exports=jdk.compiler/com.sun.tools.javac.tree=ALL-UNNAMED',
'--add-exports=jdk.compiler/com.sun.tools.javac.util=ALL-UNNAMED',
'--add-exports=jdk.compiler/com.sun.tools.doclint=ALL-UNNAMED',
'--add-exports=jdk.javadoc/jdk.javadoc.internal.tool=ALL-UNNAMED'])
'--add-exports=jdk.javadoc/jdk.javadoc.internal.tool=ALL-UNNAMED',
'--add-exports=jdk.javadoc/jdk.javadoc.internal.doclets.toolkit=ALL-UNNAMED',
'--add-opens=jdk.javadoc/jdk.javadoc.internal.doclets.toolkit.resources.releases=ALL-UNNAMED'])
}
```

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -270,7 +270,8 @@ public void checkPlatformLinks(String linkPlatformProperties,
}
DocPath elementListPath = getPlatformElementList(versionNumber);
URL elementListUrl
= AbstractDoclet.class.getResource(elementListPath.getPath());
= jdk.javadoc.internal.doclets.toolkit.AbstractDoclet.class
.getResource(elementListPath.getPath());
if (elementListUrl == null) {
reporter.print(Kind.WARNING, resources.getText(
"doclet.Resource_error", elementListPath.getPath()));
Expand Down

0 comments on commit 6966c5d

Please sign in to comment.