Skip to content

Commit c171b9c

Browse files
cpovirkGoogle Java Core Libraries
authored and
Google Java Core Libraries
committed
Mess around more with Javadoc and Maven toolchains:
- Use Temurin over Zulu. Per [advice](#7492 (comment)) from @ben-manes, LTS versions of Temurin [come pre-installed](https://github.com/actions/setup-java/blob/main/docs/advanced-usage.md#Hosted-Tool-Cache). - But be willing to run with any JDK of the appropriate version that's available, rather than requiring Zulu. (Not that this makes a huge difference, given that we'll still *download* Temurin JDKs. I didn't think this through much. I guess you can now at least avoiding downloading a Temurin JDK if you make sure you already have enough JDKs registered and you pass `-Dtoolchain.skip`.) - Make the test jobs fail [if they need to download a needed JDK](https://github.com/linux-china/toolchains-maven-plugin#how-to-skip-toolchains-maven-plugin-on-cicd-platform) because we didn't already put that one in place with `setup-java`. (Our other CI jobs, which publish snapshots to Sonatype and regenerate snapshot Javadoc, will continue to tolerate missing JDKs. We could change them, too, by making their scripts pass through options to identify the run as a CI run.) This should help us keep our versions in sync, and it should prevent us from silently falling back to slower downloads, per b/334979149. - Use Java 21 to generate Javadoc (as that's the best we can do now without [further trouble](#6790 (comment))). I've made sure to make Java 21 available through `setup-java`, including for generating Sonatype snapshots, which [do include Javadoc](https://oss.sonatype.org/content/repositories/snapshots/com/google/guava/guava/HEAD-jre-SNAPSHOT/). Plus, use Java 23 for the Maven VM itself there (so as to standardize on the same version as we already use for the Maven VM itself during our test workflows as of cl/711476575). - Fix a few Javadoc warnings, leaving behind only [a handful that we can't easily do anything about](#6790 (comment)). - Download Java 11 only when it is required. Currently, that's for JDiff and for our Gradle integration tests. There is a decent chance that this CL will break something, possibly not until we run the snapshot steps after submission... :) RELNOTES=n/a PiperOrigin-RevId: 711746683
1 parent 1a300f6 commit c171b9c

File tree

9 files changed

+96
-59
lines changed

9 files changed

+96
-59
lines changed

.github/workflows/ci.yml

Lines changed: 22 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -39,24 +39,24 @@ jobs:
3939
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
4040
# When we specify multiple JDKs, the final one becomes the default, which is used to execute Maven itself.
4141
# Our Maven configuration then specifies different JDKs to use for some of the steps:
42-
# - 11 for building Javadoc
42+
# - 11 (sometimes) to *download* to support anyone who runs JDiff or our Gradle integration tests (including our doc snapshots and our Java 11 CI test run) but not to use directly
43+
# - 21 for building Javadoc
4344
# - 23 for running javac (to help people who build Guava locally and might not use a recent JDK to run Maven)
44-
# (Note that we also use Java 11 for running our Gradle integration tests. But we run those only when we are already going to run tests under Java 11.)
4545
- name: 'Set up JDKs'
4646
uses: actions/setup-java@8df1039502a15bceb9433410b1a100fbe190c53b # v4.5.0
4747
with:
4848
java-version: |
4949
${{ matrix.java }}
50-
11
50+
21
5151
23
52-
distribution: 'zulu'
52+
distribution: 'temurin'
5353
cache: 'maven'
5454
- name: 'Install'
5555
shell: bash
56-
run: ./mvnw -B -Dorg.slf4j.simpleLogger.log.org.apache.maven.cli.transfer.Slf4jMavenTransferListener=warn install -U -DskipTests=true -f $ROOT_POM
56+
run: ./mvnw -B -Dorg.slf4j.simpleLogger.log.org.apache.maven.cli.transfer.Slf4jMavenTransferListener=warn -Dtoolchain.skip install -U -DskipTests=true -f $ROOT_POM
5757
- name: 'Test'
5858
shell: bash
59-
run: ./mvnw -B -P!standard-with-extra-repos verify -U -Dmaven.javadoc.skip=true -Dsurefire.toolchain.version=${{ matrix.java }} -f $ROOT_POM
59+
run: ./mvnw -B -P!standard-with-extra-repos -Dtoolchain.skip verify -U -Dmaven.javadoc.skip=true -Dsurefire.toolchain.version=${{ matrix.java }} -f $ROOT_POM
6060
- name: 'Print Surefire reports'
6161
# Note: Normally a step won't run if the job has failed, but this causes it to
6262
if: ${{ failure() }}
@@ -75,14 +75,15 @@ jobs:
7575
steps:
7676
- name: 'Check out repository'
7777
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
78-
- name: 'Set up JDK 21'
78+
- name: 'Set up JDKs'
7979
uses: actions/setup-java@8df1039502a15bceb9433410b1a100fbe190c53b # v4.5.0
8080
with:
81-
java-version: 21
82-
distribution: 'zulu'
83-
server-id: sonatype-nexus-snapshots
84-
server-username: CI_DEPLOY_USERNAME
85-
server-password: CI_DEPLOY_PASSWORD
81+
# For discussion, see the first setup-java block.
82+
# The publish-snapshot workflow doesn't run tests, so we don't have to care which version Maven would select for that step.
83+
java-version: |
84+
21
85+
23
86+
distribution: 'temurin'
8687
cache: 'maven'
8788
- name: 'Publish'
8889
env:
@@ -100,11 +101,17 @@ jobs:
100101
steps:
101102
- name: 'Check out repository'
102103
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
103-
- name: 'Set up JDK 11'
104+
- name: 'Set up JDKs'
104105
uses: actions/setup-java@8df1039502a15bceb9433410b1a100fbe190c53b # v4.5.0
105106
with:
106-
java-version: 11
107-
distribution: 'zulu'
107+
# For discussion, see the first setup-java block.
108+
# The generate-docs workflow doesn't run tests, so we don't have to care which version Maven would select for that step.
109+
# But we need Java 11 for JDiff.
110+
java-version: |
111+
11
112+
21
113+
23
114+
distribution: 'temurin'
108115
cache: 'maven'
109116
- name: 'Generate latest docs'
110117
env:

android/guava/src/com/google/common/graph/ValueGraph.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
package com.google.common.graph;
1818

1919
import com.google.common.annotations.Beta;
20+
import java.util.Collection;
2021
import java.util.Set;
2122
import org.jspecify.annotations.Nullable;
2223

android/guava/src/com/google/common/primitives/package-info.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929
* <ul>
3030
* <li>{@link ImmutableDoubleArray}
3131
* <li>{@link ImmutableIntArray}
32-
* <li>{@link ImmutableLongrray}
32+
* <li>{@link ImmutableLongArray}
3333
* <li>{@link UnsignedInteger}
3434
* <li>{@link UnsignedLong}
3535
* </ul>

android/guava/src/com/google/common/util/concurrent/ExecutionSequencer.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@
2929
import com.google.errorprone.annotations.concurrent.LazyInit;
3030
import java.util.concurrent.Callable;
3131
import java.util.concurrent.Executor;
32+
import java.util.concurrent.Future;
3233
import java.util.concurrent.atomic.AtomicReference;
3334
import org.jspecify.annotations.Nullable;
3435

android/pom.xml

Lines changed: 34 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -194,7 +194,6 @@
194194
<plugin>
195195
<groupId>org.mvnsearch</groupId>
196196
<artifactId>toolchains-maven-plugin</artifactId>
197-
<version>4.5.0</version>
198197
<executions>
199198
<!--
200199
We can apparently have only one <jdk> per execution: Others are silently ignored :(
@@ -203,15 +202,15 @@
203202
(But don't run that if you have put something into ~/.m2/toolchains.xml yourself.)
204203
-->
205204
<execution>
206-
<id>download-11</id>
205+
<id>download-21</id>
207206
<goals>
208207
<goal>toolchain</goal>
209208
</goals>
210209
<configuration>
211210
<toolchains>
212211
<jdk>
213-
<version>11</version>
214-
<vendor>zulu</vendor>
212+
<version>21</version>
213+
<vendor>temurin</vendor>
215214
</jdk>
216215
</toolchains>
217216
</configuration>
@@ -225,11 +224,11 @@
225224
<toolchains>
226225
<jdk>
227226
<version>23</version>
228-
<vendor>zulu</vendor>
227+
<vendor>temurin</vendor>
229228
</jdk>
230229
<testJdk>
231230
<version>${surefire.toolchain.version}</version>
232-
<vendor>zulu</vendor>
231+
<vendor>temurin</vendor>
233232
</testJdk>
234233
</toolchains>
235234
</configuration>
@@ -250,7 +249,6 @@
250249
<toolchains>
251250
<jdk>
252251
<version>23</version>
253-
<vendor>zulu</vendor>
254252
</jdk>
255253
</toolchains>
256254
</configuration>
@@ -332,10 +330,9 @@
332330
<artifactId>maven-javadoc-plugin</artifactId>
333331
<version>3.11.1</version>
334332
<configuration>
335-
<!-- TODO: b/286965322 - Use a newer version (probably the default javac toolchain we set up?) if it doesn't break Javadoc (including causing trouble for our later run of JDiff, which we do outside Maven, during snapshots/releases). At that point, we'll likely want to remove the no-module-directories additionalJOption, as documented below. -->
336333
<jdkToolchain>
337-
<version>11</version>
338-
<vendor>zulu</vendor>
334+
<version>21</version>
335+
<vendor>temurin</vendor>
339336
</jdkToolchain>
340337
<quiet>true</quiet>
341338
<notimestamp>true</notimestamp>
@@ -348,14 +345,6 @@
348345
</additionalOptions>
349346
<linksource>true</linksource>
350347
<source>8</source>
351-
<!--
352-
Required to make symbol search work correctly in the generated pages under JDK 11-12.
353-
354-
This flag does not exist on 9-10 and 13+ (https://bugs.openjdk.java.net/browse/JDK-8215582).
355-
356-
Consider removing it once our Javadoc generation is migrated to a recent JDK.
357-
-->
358-
<additionalJOption>--no-module-directories</additionalJOption>
359348
</configuration>
360349
<executions>
361350
<execution>
@@ -378,7 +367,6 @@
378367
<configuration>
379368
<jdkToolchain>
380369
<version>${surefire.toolchain.version}</version>
381-
<vendor>zulu</vendor>
382370
</jdkToolchain>
383371
<includes>
384372
<include>${test.include}</include>
@@ -420,6 +408,11 @@
420408
<artifactId>build-helper-maven-plugin</artifactId>
421409
<version>3.4.0</version>
422410
</plugin>
411+
<plugin>
412+
<groupId>org.mvnsearch</groupId>
413+
<artifactId>toolchains-maven-plugin</artifactId>
414+
<version>4.5.0</version>
415+
</plugin>
423416
</plugins>
424417
</pluginManagement>
425418
</build>
@@ -511,11 +504,32 @@
511504
<test.add.opens></test.add.opens>
512505
</properties>
513506
</profile>
514-
<!-- The Gradle integration tests need to set JAVA_HOME to the location of Java 11. The following profile extracts that location. -->
507+
<!-- JDiff and the Gradle integration tests need Java 11 to be installed, and they need to know where it's located so that they can set JAVA_HOME to point to it. The following profile downloads a temurin Java 11 (if one isn't already available) and writes its location to target/java_11_home. This lets our JDiff and Gradle-integration-test scripts invoke the `print-java-11-home` profile and then read that file. -->
515508
<profile>
516509
<id>print-java-11-home</id>
517510
<build>
518511
<plugins>
512+
<plugin>
513+
<groupId>org.mvnsearch</groupId>
514+
<artifactId>toolchains-maven-plugin</artifactId>
515+
<executions>
516+
<execution>
517+
<id>download-11</id>
518+
<phase>initialize</phase>
519+
<goals>
520+
<goal>toolchain</goal>
521+
</goals>
522+
<configuration>
523+
<toolchains>
524+
<jdk>
525+
<version>11</version>
526+
<vendor>temurin</vendor>
527+
</jdk>
528+
</toolchains>
529+
</configuration>
530+
</execution>
531+
</executions>
532+
</plugin>
519533
<plugin>
520534
<artifactId>maven-toolchains-plugin</artifactId>
521535
<executions>
@@ -531,7 +545,6 @@
531545
<toolchains>
532546
<jdk>
533547
<version>11</version>
534-
<vendor>zulu</vendor>
535548
</jdk>
536549
</toolchains>
537550
</configuration>

guava/src/com/google/common/graph/ValueGraph.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
package com.google.common.graph;
1818

1919
import com.google.common.annotations.Beta;
20+
import java.util.Collection;
2021
import java.util.Optional;
2122
import java.util.Set;
2223
import org.jspecify.annotations.Nullable;

guava/src/com/google/common/primitives/package-info.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929
* <ul>
3030
* <li>{@link ImmutableDoubleArray}
3131
* <li>{@link ImmutableIntArray}
32-
* <li>{@link ImmutableLongrray}
32+
* <li>{@link ImmutableLongArray}
3333
* <li>{@link UnsignedInteger}
3434
* <li>{@link UnsignedLong}
3535
* </ul>

guava/src/com/google/common/util/concurrent/ExecutionSequencer.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@
2929
import com.google.errorprone.annotations.concurrent.LazyInit;
3030
import java.util.concurrent.Callable;
3131
import java.util.concurrent.Executor;
32+
import java.util.concurrent.Future;
3233
import java.util.concurrent.atomic.AtomicReference;
3334
import org.jspecify.annotations.Nullable;
3435

0 commit comments

Comments
 (0)