ignite-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ale...@apache.org
Subject [ignite] branch master updated: IGNITE-11393 Fix javadoc maven build for java9+ - Fixes #7983.
Date Thu, 09 Jul 2020 04:54:05 GMT
This is an automated email from the ASF dual-hosted git repository.

alexpl pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/ignite.git


The following commit(s) were added to refs/heads/master by this push:
     new 3006dd8  IGNITE-11393 Fix javadoc maven build for java9+ - Fixes #7983.
3006dd8 is described below

commit 3006dd80d80e6996fa8cfeff708d4f8a71cefac6
Author: Aleksey Plekhanov <plehanov.alex@gmail.com>
AuthorDate: Thu Jul 9 09:29:40 2020 +0500

    IGNITE-11393 Fix javadoc maven build for java9+ - Fixes #7983.
    
    Signed-off-by: Aleksey Plekhanov <plehanov.alex@gmail.com>
---
 .../tools/ant/beautifier/GridJavadocAntTask.java   |   5 +-
 .../ignite/tools/javadoc/IgniteLinkTaglet.java     | 107 ++++++++++-----------
 parent/pom.xml                                     |  16 ++-
 pom.xml                                            |  21 ++++
 4 files changed, 87 insertions(+), 62 deletions(-)

diff --git a/modules/tools/src/main/java/org/apache/ignite/tools/ant/beautifier/GridJavadocAntTask.java
b/modules/tools/src/main/java/org/apache/ignite/tools/ant/beautifier/GridJavadocAntTask.java
index 4f49eb3..67cfb65 100644
--- a/modules/tools/src/main/java/org/apache/ignite/tools/ant/beautifier/GridJavadocAntTask.java
+++ b/modules/tools/src/main/java/org/apache/ignite/tools/ant/beautifier/GridJavadocAntTask.java
@@ -166,6 +166,7 @@ public class GridJavadocAntTask extends MatchingTask {
             // Parse HTML.
             Jerry doc = Jerry.jerry(fileContent);
 
+            // TODO https://issues.apache.org/jira/browse/IGNITE-13202 Check also index.html
file.
             if (file.endsWith("overview-summary.html")) {
                 // Try to find Other Packages section.
                 Jerry otherPackages =
@@ -181,7 +182,7 @@ public class GridJavadocAntTask extends MatchingTask {
             }
             else if (!isViewHtml(file)) {
                 // Try to find a class description block.
-                Jerry descBlock = doc.find("div.contentContainer div.description ul.blockList
li.blockList div.block");
+                Jerry descBlock = doc.find("div.contentContainer .description");
 
                 if (descBlock.size() == 0)
                     throw new IllegalArgumentException("Class doesn't have description in
file: " + file);
@@ -372,7 +373,7 @@ public class GridJavadocAntTask extends MatchingTask {
     private boolean isViewHtml(String fileName) {
         String baseName = new File(fileName).getName();
 
-        return "index.html".equals(baseName) || baseName.contains("-");
+        return "index.html".equals(baseName) || baseName.contains("-") || "allclasses.html".equals(baseName);
     }
 
     /**
diff --git a/modules/tools/src/main/java11/org/apache/ignite/tools/javadoc/IgniteLinkTaglet.java
b/modules/tools/src/main/java11/org/apache/ignite/tools/javadoc/IgniteLinkTaglet.java
index 075fea6..78663c6 100644
--- a/modules/tools/src/main/java11/org/apache/ignite/tools/javadoc/IgniteLinkTaglet.java
+++ b/modules/tools/src/main/java11/org/apache/ignite/tools/javadoc/IgniteLinkTaglet.java
@@ -19,13 +19,14 @@ package org.apache.ignite.tools.javadoc;
 
 import java.io.File;
 import java.util.HashSet;
-import java.util.Iterator;
 import java.util.List;
-import java.util.Map;
 import java.util.Set;
 import javax.lang.model.element.Element;
-import com.sun.javadoc.Tag;
 import com.sun.source.doctree.DocTree;
+import com.sun.source.doctree.UnknownInlineTagTree;
+import com.sun.source.util.SimpleDocTreeVisitor;
+import jdk.javadoc.doclet.Doclet;
+import jdk.javadoc.doclet.DocletEnvironment;
 import jdk.javadoc.doclet.Taglet;
 
 /**
@@ -37,6 +38,14 @@ public class IgniteLinkTaglet implements Taglet {
     /** */
     private static final String NAME = "ignitelink";
 
+    /** */
+    private DocletEnvironment env;
+
+    /** {@inheritDoc} */
+    @Override public void init(DocletEnvironment env, Doclet doclet) {
+        this.env = env;
+    }
+
     /**
      * Return the name of this custom tag.
      */
@@ -44,18 +53,7 @@ public class IgniteLinkTaglet implements Taglet {
         return NAME;
     }
 
-    @Override public String toString(List<? extends DocTree> tags, Element element)
{
-        StringBuilder sb = new StringBuilder();
-
-        for (Iterator<? extends DocTree> iter = tags.iterator(); iter.hasNext(); )
{
-            DocTree next = iter.next();
-
-            sb.append(""); //todo IGNITE-11393 Implement toString for Java 9+
-        }
-
-        return sb.toString();
-    }
-
+    /** {@inheritDoc} */
     @Override public Set<Location> getAllowedLocations() {
         return new HashSet<>();
     }
@@ -70,64 +68,59 @@ public class IgniteLinkTaglet implements Taglet {
     }
 
     /**
-     * Register this Taglet.
-     *
-     * @param tagletMap the map to register this tag to.
-     */
-    public static void register(Map<String, IgniteLinkTaglet> tagletMap) {
-        IgniteLinkTaglet tag = new IgniteLinkTaglet();
-
-        Taglet t = tagletMap.get(tag.getName());
-
-        if (t != null)
-            tagletMap.remove(tag.getName());
-
-        tagletMap.put(tag.getName(), tag);
-    }
-
-    /**
-     * Given the <code>Tag</code> representation of this custom tag, return its
string representation.
+     * Given the <code>DocTree</code> representation of this custom tag, return
its string representation.
      * <p>
      * Input: org.apache.ignite.grid.spi.indexing.h2.GridH2IndexingSpi#setIndexCustomFunctionClasses(Class[])
      * <p>
-     * Output: <a href="../../../../../org/apache/ignite/grid/spi/indexing/h2/GridH2IndexingSpi.html#
-     * setIndexCustomFunctionClasses(java.lang.Class...)">
-     * <code>GridH2IndexingSpi.setIndexCustomFunctionClasses(java.lang.Class[])</code></a>
+     * Output: &lt;a href="../../../../../org/apache/ignite/grid/spi/indexing/h2/GridH2IndexingSpi.html#
+     * setIndexCustomFunctionClasses(java.lang.Class...)"&gt;
+     * &lt;code&gt;GridH2IndexingSpi.setIndexCustomFunctionClasses(java.lang.Class[])&lt;/code&gt;&lt;/a&gt;
      *
-     * @param tag <code>Tag</code> representation of this custom tag.
+     * @param tags <code>DocTree</code> representation of this custom tag.
+     * @param element The element to which the enclosing comment belongs.
      */
-     public String toString(Tag tag) {
-        if (tag.text() == null || tag.text().isEmpty())
-            return "";
+    @Override public String toString(List<? extends DocTree> tags, Element element)
{
+        for (DocTree tag : tags) {
+            String text = new SimpleDocTreeVisitor<String, Void>() {
+                @Override public String visitUnknownInlineTag(UnknownInlineTagTree node,
Void param) {
+                    return node.getContent().toString();
+                }
+            }.visit(tag, null);
 
-        File f = tag.position().file();
+            if (text == null || text.isEmpty())
+                return "";
 
-        String curClass = f == null ? "" : f.getAbsolutePath().replace(File.separator, ".");
+            File f = new File(env.getDocTrees().getPath(element).getCompilationUnit().getSourceFile().toUri());
 
-        String packPref = "src.main.java.";
+            String curCls = f == null ? "" : f.getAbsolutePath().replace(File.separator,
".");
 
-        int idx = curClass.indexOf(packPref);
+            String packPref = "src.main.java.";
 
-        StringBuilder path = new StringBuilder();
+            int idx = curCls.indexOf(packPref);
 
-        if (idx != -1) {
-            curClass = curClass.substring(idx + packPref.length());
+            StringBuilder path = new StringBuilder();
 
-            for (int i = 0, n = curClass.split("\\.").length - 2; i < n; i++)
-                path.append("../");
-        }
+            if (idx != -1) {
+                curCls = curCls.substring(idx + packPref.length());
 
-        String[] tokens = tag.text().split("#");
+                for (int i = 0, n = curCls.split("\\.").length - 2; i < n; i++)
+                    path.append("../");
+            }
 
-        int lastIdx = tokens[0].lastIndexOf('.');
+            String[] tokens = text.split("#");
 
-        String simpleClsName = lastIdx != -1 && lastIdx + 1 < tokens[0].length()
?
-            tokens[0].substring(lastIdx + 1) : tokens[0];
+            int lastIdx = tokens[0].lastIndexOf('.');
 
-        String fullyQClsName = tokens[0].replace(".", "/");
+            String simpleClsName = lastIdx != -1 && lastIdx + 1 < tokens[0].length()
?
+                tokens[0].substring(lastIdx + 1) : tokens[0];
+
+            String fullyQClsName = tokens[0].replace(".", "/");
+
+            return "<a href=\"" + path + fullyQClsName + ".html" +
+                (tokens.length > 1 ? ("#" + tokens[1].replace("[]", "...")) : "") +
+                "\"><code>" + simpleClsName + (tokens.length > 1 ? ("." + tokens[1])
: "") + "</code></a>";
+        }
 
-        return "<a href=\"" + path.toString() + fullyQClsName + ".html" +
-            (tokens.length > 1 ? ("#" + tokens[1].replace("[]", "...")) : "") +
-            "\"><code>" + simpleClsName + (tokens.length > 1 ? ("." + tokens[1])
: "") + "</code></a>";
+        return "";
     }
 }
diff --git a/parent/pom.xml b/parent/pom.xml
index aad7b6c..0e3cab9 100644
--- a/parent/pom.xml
+++ b/parent/pom.xml
@@ -146,7 +146,7 @@
         <spark24.version>2.4.4</spark24.version>
 
         <!-- Maven plugins versions -->
-        <maven.javadoc.plugin.version>2.10.4</maven.javadoc.plugin.version>
+        <maven.javadoc.plugin.version>3.2.0</maven.javadoc.plugin.version>
 
         <!-- OSGI Manifest generation default property values -->
         <osgi.import.package>*</osgi.import.package>
@@ -289,7 +289,7 @@
                         <use>true</use>
                         <author>false</author>
                         <version>false</version>
-                        <additionalparam>${javadoc.opts}</additionalparam>
+                        <additionalOptions>${javadoc.opts}</additionalOptions>
                         <groups>
                             <group>
                                 <title>Common Grid APIs</title>
@@ -333,7 +333,7 @@
                             </group>
                             <group>
                                 <title>Streaming APIs</title>
-                                <packages>org.apache.ignite.streamer*::org.apache.ignite.stream*</packages>
+                                <packages>org.apache.ignite.streamer*:org.apache.ignite.stream*</packages>
                             </group>
                             <group>
                                 <title>Security APIs</title>
@@ -1063,6 +1063,16 @@
                             <argLine>--add-exports=java.base/jdk.internal.misc=ALL-UNNAMED
--add-exports=java.base/sun.nio.ch=ALL-UNNAMED --add-exports=java.management/com.sun.jmx.mbeanserver=ALL-UNNAMED
--add-exports=jdk.internal.jvmstat/sun.jvmstat.monitor=ALL-UNNAMED --add-exports=java.base/sun.reflect.generics.reflectiveObjects=ALL-UNNAMED
--illegal-access=permit</argLine>
                         </configuration>
                     </plugin>
+
+                    <plugin>
+                        <groupId>org.apache.maven.plugins</groupId>
+                        <artifactId>maven-javadoc-plugin</artifactId>
+                        <configuration>
+                            <!-- TODO https://issues.apache.org/jira/browse/IGNITE-13202
-->
+                            <additionalOptions>${javadoc.opts} --add-exports=java.base/sun.nio.ch=ALL-UNNAMED
--add-exports=java.management/com.sun.jmx.mbeanserver=ALL-UNNAMED</additionalOptions>
+                            <detectJavaApiLink>false</detectJavaApiLink>
+                        </configuration>
+                    </plugin>
                 </plugins>
             </build>
 
diff --git a/pom.xml b/pom.xml
index 4ae4bb1..d5fb32b 100644
--- a/pom.xml
+++ b/pom.xml
@@ -206,6 +206,27 @@
                                 </goals>
                                 <phase>validate</phase>
                                 <configuration>
+                                    <additionalDependencies>
+                                        <!--
+                                        Only the last version of spring data is included
to class path, some classes
+                                        required by old spring data modules are absent in
this version.
+                                        Add spring-data-2.0 explicitly to be able to find
all required classes.
+                                        -->
+                                        <dependency>
+                                            <groupId>org.springframework.data</groupId>
+                                            <artifactId>spring-data-commons</artifactId>
+                                            <version>${spring.data-2.0.version}</version>
+                                        </dependency>
+                                    </additionalDependencies>
+                                    <!--
+                                    For some reason maven-javadoc-plugin 3.0+ doesn't include
taglet artifact from
+                                    parent configuration to -tagletpath javadoc parameter.
+                                    -->
+                                    <tagletArtifact>
+                                        <groupId>org.apache.ignite</groupId>
+                                        <artifactId>ignite-tools</artifactId>
+                                        <version>${project.version}</version>
+                                    </tagletArtifact>
                                     <reportOutputDirectory>${basedir}/target/javadoc</reportOutputDirectory>
                                     <destDir>core</destDir>
                                     <subpackages>org.apache.ignite -exclude org.apache.ignite.codegen:org.apache.ignite.examples:org.apache.ignite.internal:org.apache.ignite.schema:org.apache.ignite.tests:org.apache.ignite.tools:org.apache.ignite.util:org.apache.ignite.spi.discovery.tcp.messages:org.apache.ignite.spi.discovery.tcp.internal:org.apache.ignite.spi.communication.tcp.internal:org.apache.ignite.spi.discovery.zk.internal:org.apache.ignite.spi.deployment.uri.scanners:org.apache.
[...]


Mime
View raw message