This is an automated email from the ASF dual-hosted git repository.

ptupitsyn pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/ignite-3.git


The following commit(s) were added to refs/heads/main by this push:
     new 2ff6aba754 IGNITE-17930 Enable javadoc in gradle and fix doclint 
(#1320)
2ff6aba754 is described below

commit 2ff6aba754e1e088bbeeca42c14167c215095e7f
Author: Aleksandr <[email protected]>
AuthorDate: Tue Nov 15 00:08:03 2022 +0800

    IGNITE-17930 Enable javadoc in gradle and fix doclint (#1320)
    
    Allow javadoc site to be built with Gradle aggregateJavadoc task. By 
default, this task runs DocLint which performs some checks. There were several 
errors in raft module that now are fixed as well.
---
 DEVNOTES.md                   | 15 ++++++++--
 build.gradle                  |  7 +++++
 buildscripts/java-core.gradle | 16 ++++++++--
 buildscripts/javadoc.gradle   | 70 +++++++++++++++++++++++++++++++++++++++++++
 gradle/libs.versions.toml     |  1 +
 5 files changed, 105 insertions(+), 4 deletions(-)

diff --git a/DEVNOTES.md b/DEVNOTES.md
index aebfdba58e..e03a625c7a 100644
--- a/DEVNOTES.md
+++ b/DEVNOTES.md
@@ -297,7 +297,18 @@ Run integration tests only:
 ***
 
 ## Checking and generating Javadoc
- [TBD](https://issues.apache.org/jira/browse/IGNITE-17930)
+Javadoc is generated and checked for correctness with [Gradle Javadoc 
Plugin](https://docs.gradle.org/current/dsl/org.gradle.api.tasks.javadoc.Javadoc.html).
+
+Build Javadoc site (found in `build/docs/aggregateJavadoc/index.html`):
+```
+./gradlew aggregateJavadoc 
+```
+
+If you don't need to aggregate all javadoc you can use javadoc task and find 
generated 
+artifacts in each module (for example `modules/api/build/docs/javadoc`)
+```
+./gradlew javadoc
+```
 ***
 
 
@@ -310,7 +321,7 @@ After opening the project in IntelliJ, double check that 
the Java SDK is properl
 * In the `Project` section, make sure the project language level is set to 
11.0 as Ignite makes use of several Java 11
   language features
 
-Ignite uses machine code generation for some of it's modules. To generate 
necessary production code, build the project using maven (see [Building 
Ignite](#building-ignite)).
+Ignite uses machine code generation for some of it's modules. To generate 
necessary production code, build the project using gradle.
 
 Configure Idea code style (for IntelliJ Idea >= 2019):
 * File -> Settings -> Editor -> Code Style -> Scheme -> gear (Show Scheme 
Actions) -> Import Scheme -> IntelliJ IDEA code style XML
diff --git a/build.gradle b/build.gradle
index ee57e33cee..44c2429833 100644
--- a/build.gradle
+++ b/build.gradle
@@ -20,8 +20,11 @@
 plugins {
     alias(libs.plugins.javacc) apply false
     alias(libs.plugins.modernizer) apply false
+    alias(libs.plugins.aggregateJavadoc)
 }
 
+apply from: "$rootDir/buildscripts/javadoc.gradle"
+
 repositories {
     mavenLocal()
     maven {
@@ -77,6 +80,10 @@ allprojects {
     tasks.withType(JavaCompile) {
         options.encoding = 'UTF-8'
     }
+
+    tasks.withType(Javadoc) {
+        options.addStringOption('bottom', javadocFooter())
+    }
 }
 
 subprojects {
diff --git a/buildscripts/java-core.gradle b/buildscripts/java-core.gradle
index 8873ebc483..97f8ec862d 100644
--- a/buildscripts/java-core.gradle
+++ b/buildscripts/java-core.gradle
@@ -94,11 +94,23 @@ jacoco {
 }
 
 javadoc {
-    source = sourceSets.main.java
+    source = sourceSets.main.allJava
     classpath = configurations.compileClasspath
-    enabled = false
+
+    def sourceDirs = sourceSets.main.java.sourceDirectories.join(":")
+    def generatedSources = 
"$buildDir/generated/sources/annotationProcessor/java/main"
+
+    options.addStringOption("-source-path", sourceDirs + File.pathSeparator + 
generatedSources)
+
+    exclude 'org/apache/ignite/internal/**'
+    exclude 'org/apache/ignite/raft/jraft/**'
+    exclude 'com/facebook/presto/**'
+
+    enabled = true
 }
 
+javadoc.dependsOn compileJava
+
 jacocoTestReport {
     reports {
         xml.required = false
diff --git a/buildscripts/javadoc.gradle b/buildscripts/javadoc.gradle
new file mode 100644
index 0000000000..159d062eae
--- /dev/null
+++ b/buildscripts/javadoc.gradle
@@ -0,0 +1,70 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import java.time.LocalDate
+
+String javadocFooter() {
+    return """
+<table width="100%" border="0" cellspacing=0 cellpadding=0 style="padding: 
5px">
+  <tr>
+    <td>
+      <table style="padding-left: 0; margin: 0">
+        <tbody style="padding: 0; margin: 0">
+        <tr style="padding: 0; margin: 0">
+          <td>
+            <a target=_blank 
href="https://ignite.apache.org";><nobr>${LocalDate.now().year} Copyright &#169; 
Apache Software Foundation</nobr></a>
+          </td>
+        </tr>
+        </tbody>
+      </table>
+    </td>
+    <td width="100%" align="right" valign="center">
+      <a href="https://twitter.com/ApacheIgnite"; class="twitter-follow-button" 
data-show-count="false" data-size="large">Follow @ApacheIgnite</a>
+    </td>
+  </tr>
+  <tr>
+    <td colspan="2" valign="top" align="left">
+      <table style="padding-left: 0; margin: 0">
+        <tbody style="padding: 0; margin: 0">
+        <tr style="padding: 0; margin: 0">
+          <td>
+            <b>Ignite Database and Caching Platform</b>
+          </td>
+          <td>:&nbsp;&nbsp;
+            ver. <strong>${project.version}</strong>
+          </td>
+        </tr>
+        <tr style="padding: 0; margin: 0">
+          <td>
+            <b>Release Date</b>
+          </td>
+          <td>:&nbsp;&nbsp;
+            ${LocalDate.now()}
+          </td>
+        </tr>
+        </tbody>
+      </table>
+    </td>
+  </tr>
+</table>
+""".replaceAll('\n', System.lineSeparator())
+}
+
+// Export methods
+ext {
+    javadocFooter = this.&javadocFooter
+}
diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml
index fff428eee6..5e61aedfe9 100644
--- a/gradle/libs.versions.toml
+++ b/gradle/libs.versions.toml
@@ -86,6 +86,7 @@ modernizer = "com.github.andygoossens.modernizer:1.6.2"
 nebula = "nebula.ospackage:9.1.1"
 docker = "com.palantir.docker:0.34.0"
 checksum = "org.gradle.crypto.checksum:1.4.0"
+aggregateJavadoc = "io.freefair.aggregate-javadoc:6.5.1"
 
 [libraries]
 assertj-core = { module = "org.assertj:assertj-core", version.ref = "assertj" }

Reply via email to