github.com/apache/beam/sdks/v2@v2.48.2/java/javadoc/build.gradle (about)

     1  /*
     2   * Licensed to the Apache Software Foundation (ASF) under one
     3   * or more contributor license agreements.  See the NOTICE file
     4   * distributed with this work for additional information
     5   * regarding copyright ownership.  The ASF licenses this file
     6   * to you under the Apache License, Version 2.0 (the
     7   * License); you may not use this file except in compliance
     8   * with the License.  You may obtain a copy of the License at
     9   *
    10   *     http://www.apache.org/licenses/LICENSE-2.0
    11   *
    12   * Unless required by applicable law or agreed to in writing, software
    13   * distributed under the License is distributed on an AS IS BASIS,
    14   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    15   * See the License for the specific language governing permissions and
    16   * limitations under the License.
    17   */
    18  
    19  /*
    20   * Aggregate Javadoc is not published to Maven Central. Each Java module that is published
    21   * to Maven Cental packages its own Javadoc. To generate aggregated javadocs, run:
    22   *   ./gradlew :sdks:java:javadoc:aggregateJavadoc
    23   * Generated files will be located under beam/sdks/java/javadoc/build/docs/javadoc and are
    24   * used as part of the beam-site source tree.
    25   */
    26  plugins { id 'org.apache.beam.module' }
    27  applyJavaNature(publish: false)
    28  description = "Apache Beam :: SDKs :: Java :: Aggregated Javadoc"
    29  
    30  for (p in rootProject.subprojects) {
    31    if (!p.path.equals(project.path) && !p.path.startsWith(':sdks:java:bom')) {
    32      evaluationDependsOn(p.path)
    33    }
    34  }
    35  
    36  ext.getExportedJavadocProjects = {
    37    def exportedJavadocProjects = new ArrayList<>();
    38    for (p in rootProject.subprojects) {
    39      if (!p.path.equals(project.path) && !p.path.startsWith(':sdks:java:bom')) {
    40        def subproject = p // project(':' + p.name)
    41        if (subproject.ext.properties.containsKey('exportJavadoc') &&
    42            subproject.ext.properties.exportJavadoc) {
    43          exportedJavadocProjects.add(p.path)
    44        }
    45      }
    46    }
    47    return exportedJavadocProjects
    48  }
    49  
    50  task allJavadoc() {
    51    def exportedJavadocProjects = getExportedJavadocProjects()
    52    dependsOn exportedJavadocProjects.collect { "$it:javadoc" }
    53  }
    54  
    55  task aggregateJavadoc(type: Javadoc) {
    56    def createJavadocIOUrlForDependency = {
    57      def dependency = dependencies.create(it)
    58      return 'https://static.javadoc.io/' + dependency.getGroup() + '/' + dependency.getName() + '/' + dependency.getVersion()
    59    }
    60  
    61    def exportedJavadocProjects = getExportedJavadocProjects()
    62    source exportedJavadocProjects.collect { project(it).sourceSets.main.allJava }
    63    classpath = files(exportedJavadocProjects.collect { project(it).sourceSets.main.compileClasspath })
    64    destinationDir = file("${buildDir}/docs/javadoc")
    65    failOnError = true
    66  
    67    exclude "org/apache/beam/examples/*"
    68    exclude "org/apache/beam/fn/harness/*"
    69    exclude "org/apache/beam/runners/core/*"
    70    exclude "org/apache/beam/runners/dataflow/internal/*"
    71    exclude "org/apache/beam/runners/flink/examples/*"
    72    exclude "org/apache/beam/runners/flink/translation/*"
    73    exclude "org/apache/beam/runners/spark/examples/*"
    74    exclude "org/apache/beam/runners/spark/translation/*"
    75    exclude "org/apache/beam/sdk/transforms/reflect/*"
    76    exclude "org/apache/beam/sdk/runners/*"
    77    exclude "org/apache/beam/sdk/util/*"
    78  
    79    options.with {
    80      title "Apache Beam " + project.version
    81      overview 'overview.html'
    82      for (dep in project.library.java.values()) {
    83        links createJavadocIOUrlForDependency(dep)
    84      }
    85    }
    86  }