This is an automated email from the ASF dual-hosted git repository. yhu pushed a commit to branch fixjavadoc in repository https://gitbox.apache.org/repos/asf/beam.git
commit fab2340aacbe40c2d2c589e07545bce4edd5e40c Author: Yi Hu <[email protected]> AuthorDate: Wed Jul 9 17:22:17 2025 -0400 Fix javadoc workflow --- .github/trigger_files/beam_PostCommit_Javadoc.json | 1 + .github/workflows/beam_PostCommit_Javadoc.yml | 2 ++ runners/flink/flink_runner.gradle | 2 ++ .../resources/beam/checkstyle/suppressions.xml | 3 +++ sdks/java/javadoc/build.gradle | 26 +++++++++++++++++----- ...sAssumeRoleForFederatedCredentialsProvider.java | 20 +++++++++++++++++ .../sdk/io/solace/data/AutoValue_Semp_Queue.java | 22 ++++++++++++++++++ .../io/solace/data/AutoValue_Semp_QueueData.java | 22 ++++++++++++++++++ 8 files changed, 92 insertions(+), 6 deletions(-) diff --git a/.github/trigger_files/beam_PostCommit_Javadoc.json b/.github/trigger_files/beam_PostCommit_Javadoc.json new file mode 100644 index 00000000000..0967ef424bc --- /dev/null +++ b/.github/trigger_files/beam_PostCommit_Javadoc.json @@ -0,0 +1 @@ +{} diff --git a/.github/workflows/beam_PostCommit_Javadoc.yml b/.github/workflows/beam_PostCommit_Javadoc.yml index a007ca07087..558145244f6 100644 --- a/.github/workflows/beam_PostCommit_Javadoc.yml +++ b/.github/workflows/beam_PostCommit_Javadoc.yml @@ -74,6 +74,8 @@ jobs: github_job: ${{ matrix.job_name }} (${{ matrix.job_phrase }}) - name: Setup environment uses: ./.github/actions/setup-environment-action + with: + java-version: 21 - name: run aggregateJavadoc script uses: ./.github/actions/gradle-command-self-hosted-action with: diff --git a/runners/flink/flink_runner.gradle b/runners/flink/flink_runner.gradle index f831ec86319..ed4ecf4e950 100644 --- a/runners/flink/flink_runner.gradle +++ b/runners/flink/flink_runner.gradle @@ -48,6 +48,8 @@ applyJavaNature( enableStrictDependencies:true, automaticModuleName: 'org.apache.beam.runners.flink', archivesBaseName: archivesBaseName, + // flink runner jars are in same package name. Publish javadoc once. + exportJavadoc: project.ext.flink_version.startsWith(all_versions.last()) ) description = "Apache Beam :: Runners :: Flink $flink_version" diff --git a/sdks/java/build-tools/src/main/resources/beam/checkstyle/suppressions.xml b/sdks/java/build-tools/src/main/resources/beam/checkstyle/suppressions.xml index af384ff19c0..53249ac8d0d 100644 --- a/sdks/java/build-tools/src/main/resources/beam/checkstyle/suppressions.xml +++ b/sdks/java/build-tools/src/main/resources/beam/checkstyle/suppressions.xml @@ -34,6 +34,9 @@ <suppress checks=".*" files=".+[\\\/]generated-test-avro-java[\\\/].+\.java" /> <suppress checks=".*" files=".+[\\\/]generated-test-sources[\\\/].+\.java" /> + <!-- suppress all checks in javadoc placeholder classes --> + <suppress checks=".*" files="sdks.*java.*javadoc.*src.*main.*java.*\.java" /> + <!-- Guava use exceptions --> <!-- Non-vendored guava imports are allowed for files that depend on libraries that expose guava in its public API --> <suppress id="ForbidNonVendoredGuava" files=".*kinesis.*KinesisIO\.java" /> diff --git a/sdks/java/javadoc/build.gradle b/sdks/java/javadoc/build.gradle index 284cef130bd..c3c7c67e347 100644 --- a/sdks/java/javadoc/build.gradle +++ b/sdks/java/javadoc/build.gradle @@ -52,7 +52,7 @@ task allJavadoc() { dependsOn exportedJavadocProjects.collect { "$it:javadoc" } } -task aggregateJavadoc(type: Javadoc) { +task aggregateJavadoc(type: Javadoc) { it -> def createJavadocIOUrlForDependency = { def dependency = dependencies.create(it) return 'https://static.javadoc.io/' + dependency.getGroup() + '/' + dependency.getName() + '/' + dependency.getVersion() @@ -60,18 +60,19 @@ task aggregateJavadoc(type: Javadoc) { def exportedJavadocProjects = getExportedJavadocProjects() source exportedJavadocProjects.collect { project(it).sourceSets.main.allJava } - classpath = files(exportedJavadocProjects.collect { project(it).sourceSets.main.compileClasspath }) - destinationDir = file("${buildDir}/docs/javadoc") + source project.sourceSets.main.allJava + classpath = files(exportedJavadocProjects.collect { project(it).configurations.compileClasspath }) + // Placeholder classes that were generated by annotation processor and cannot + // be found in allJava. Missing them caused failing javadoc generation in Java11+ + destinationDir = new File(layout.buildDirectory.dir("docs/javadoc").get().toString()) + // many external link fails, this is expected. failOnError = false exclude "org/apache/beam/examples/*" exclude "org/apache/beam/fn/harness/*" exclude "org/apache/beam/runners/core/*" - exclude "org/apache/beam/runners/dataflow/internal/*" exclude "org/apache/beam/runners/flink/examples/*" - exclude "org/apache/beam/runners/flink/translation/*" exclude "org/apache/beam/runners/spark/examples/*" - exclude "org/apache/beam/runners/spark/translation/*" exclude "org/apache/beam/sdk/transforms/reflect/*" exclude "org/apache/beam/sdk/runners/*" exclude "org/apache/beam/sdk/util/*" @@ -83,4 +84,17 @@ task aggregateJavadoc(type: Javadoc) { links createJavadocIOUrlForDependency(dep) } } + + doLast { + File myFile = new File(layout.buildDirectory.dir("docs/javadoc/index.html").get().toString()) + + // Because we set failOnError false, Check if the doc successfully generated + if (!myFile.exists()) { + throw new GradleException("Javadoc not generated. Check logs for errors") + } + } } + +// This project is used to generate javadoc for the whole Beam Java SDK. +// Disable :sdks:java:javadoc:javadoc itself. +tasks.javadoc { enabled = false } diff --git a/sdks/java/javadoc/src/main/java/org/apache/beam/sdk/io/aws2/auth/AutoValue_StsAssumeRoleForFederatedCredentialsProvider.java b/sdks/java/javadoc/src/main/java/org/apache/beam/sdk/io/aws2/auth/AutoValue_StsAssumeRoleForFederatedCredentialsProvider.java new file mode 100644 index 00000000000..b34e72fd852 --- /dev/null +++ b/sdks/java/javadoc/src/main/java/org/apache/beam/sdk/io/aws2/auth/AutoValue_StsAssumeRoleForFederatedCredentialsProvider.java @@ -0,0 +1,20 @@ +/* + * 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. + */ +package org.apache.beam.sdk.io.aws2.auth; + +class AutoValue_StsAssumeRoleForFederatedCredentialsProvider {} diff --git a/sdks/java/javadoc/src/main/java/org/apache/beam/sdk/io/solace/data/AutoValue_Semp_Queue.java b/sdks/java/javadoc/src/main/java/org/apache/beam/sdk/io/solace/data/AutoValue_Semp_Queue.java new file mode 100644 index 00000000000..1235a26aa4f --- /dev/null +++ b/sdks/java/javadoc/src/main/java/org/apache/beam/sdk/io/solace/data/AutoValue_Semp_Queue.java @@ -0,0 +1,22 @@ +/* + * 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. + */ +package org.apache.beam.sdk.io.solace.data; + +class AutoValue_Semp_Queue { + static class Builder {} +} diff --git a/sdks/java/javadoc/src/main/java/org/apache/beam/sdk/io/solace/data/AutoValue_Semp_QueueData.java b/sdks/java/javadoc/src/main/java/org/apache/beam/sdk/io/solace/data/AutoValue_Semp_QueueData.java new file mode 100644 index 00000000000..085a0c77737 --- /dev/null +++ b/sdks/java/javadoc/src/main/java/org/apache/beam/sdk/io/solace/data/AutoValue_Semp_QueueData.java @@ -0,0 +1,22 @@ +/* + * 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. + */ +package org.apache.beam.sdk.io.solace.data; + +class AutoValue_Semp_QueueData { + static class Builder {} +}
