Skip to content

Fix and update Bazel build/test configuration: - #82

Merged
copybara-service[bot] merged 1 commit into
masterfrom
test_996790401
Oct 13, 2026
Merged

copybara-service[bot] merged 1 commit into
masterfrom
test_996790401

Conversation

@copybara-service

@copybara-service copybara-service Bot commented Oct 9, 2026 •

Copy link
Copy Markdown

Fix and update Bazel build/test configuration:

  • Run Bazel CI tests under the configured matrix JDK runtimes rather than always using .bazelrc's default runtime (which prior to this CL was JDK 21).
  • Standardize the version matrix on [8, 11, 25].
    • I will have to bypass the Copybara presubmit for this CL because it will still be looking for a JDK 22 Flogger job instead of the new JDK 25 job (b/360096677). Maybe I should rename all our projects' "25" jobs to "latest LTS"....
    • I will "have to" update the Flogger branch-protection rules to require the new JDK 25 job instead of the JDK 22 job that I'm removing. (IIRC, nothing actually blocks on that, but it's nice for it to match our "real" rules.)
      • Huh, apparently GitHub is nudging me from branch-protection rules to "rulesets." I'm not going to worry about that now.
  • For Bazel toolchain/exec operations, use a JDK 25 (including allowing Java 25 language features), and for the bazel/mvn VM itself, have CI request JDK 27.
    • 25 (as the most recent LTS) is the newest version that Bazel has available for automatic download across all platforms. (It has 27 for Linux only.)
  • For selecting the language version, use --java_language_version=8 instead of --release or -source -target. It's shorter and more standard, and Bazel even silences the deprecation warning that we'd otherwise see when targeting 8.
  • Remove redundant debug-info javac options (-g) in Flogger: rules_java enables it (along with -parameters) by default nowadays.
  • Enable --experimental_one_version_enforcement=error as widely as we can.
  • Upgrade Flogger's bazel_common dep.
  • Set test --test_env=TZ=UTC.
  • Configure ci.yml to cache the right(?) Bazel information (~/.cache/bazel/*/cache, including cache/repos/v1, instead of ~/.cache/bazel/*/*/external).

Prep work:

  • Skip Flogger tests that use Mockito under Java 8. Mockito 5+ requires Java 11+. (It would make sense to skip under Java 9 and Java 10, too, but meh.)
  • Set --jvmopt=-Dnet.bytebuddy.experimental=true for Flogger to enable support for Java-25 class files.

Compare cl/996591293.

RELNOTES=n/a

@copybara-service copybara-service Bot changed the title Run Bazel CI tests under the configured matrix JDK runtimes rather than always using .bazelrc's default JDK 21 runtime. Fix and update Bazel build/test configuration: Oct 12, 2026
@copybara-service
copybara-service Bot force-pushed the test_996790401 branch 2 times, most recently from ea2bab7 to 26e5148 Compare October 13, 2026 20:26
- Run Bazel CI tests under the configured matrix JDK runtimes rather than always using `.bazelrc`'s default runtime (which prior to this CL was JDK 21).
- Standardize the version matrix on [8, 11, 25].
  - I will have to bypass the Copybara presubmit for this CL because it will still be looking for a JDK 22 Flogger job instead of the new JDK 25 job (b/360096677). Maybe I should rename all our projects' "25" jobs to "latest LTS"....
  - I will "have to" update [the Flogger branch-protection rules](https://github.com/google/flogger/settings/branch_protection_rules/42636378) to require the new JDK 25 job instead of the JDK 22 job that I'm removing. (IIRC, nothing actually blocks on that, but it's nice for it to match our "real" rules.)
    - Huh, apparently GitHub is nudging me from branch-protection rules to ["rulesets."](https://docs.github.com/en/repositories/configuring-branches-and-merges-in-your-repository/managing-rulesets/about-rulesets) I'm not going to worry about that now.
- For Bazel toolchain/`exec` operations, use a JDK 25 (including allowing Java 25 language features), and for the `bazel`/`mvn` VM itself, have CI request JDK 27.
  - 25 (as the most recent LTS) is the newest version that Bazel has available for automatic download across all platforms. (It has 27 for Linux only.)
- For selecting the language version, use `--java_language_version=8` instead of `--release` or `-source -target`. It's shorter and more standard, and Bazel even silences the deprecation warning that we'd otherwise see when targeting 8.
- Remove redundant debug-info javac options (`-g`) in Flogger: `rules_java` enables it (along with `-parameters`) by default nowadays.
- Enable `--experimental_one_version_enforcement=error` as widely as we can.
- Upgrade Flogger's `bazel_common` dep.
- Set `test --test_env=TZ=UTC`.
- Configure `ci.yml` to cache the right(?) Bazel information (`~/.cache/bazel/*/cache`, including `cache/repos/v1`, instead of `~/.cache/bazel/*/*/external`).

Prep work:
- Skip Flogger tests that use Mockito under Java 8. Mockito 5+ requires Java 11+. (It would make sense to skip under Java 9 and Java 10, too, but meh.)
- Set `--jvmopt=-Dnet.bytebuddy.experimental=true` for Flogger to enable support for Java-25 class files.

Compare cl/996591293.

RELNOTES=n/a
PiperOrigin-RevId: 998856377
@copybara-service
copybara-service Bot merged commit c1b4403 into master Oct 13, 2026
5 checks passed
@copybara-service
copybara-service Bot deleted the test_996790401 branch October 13, 2026 20:33
copybara-service Bot pushed a commit to bazelbuild/bazel that referenced this pull request Oct 15, 2026
…th JSpecify.

Bundling `error_prone_annotations` in particular into the Bazel `Runner_deploy.jar` causes one-version violations for `java_test` targets that depend on a different version of `error_prone_annotations`: See google/inject-common#82.

And overall, it's nice to put as little on the classpath as we can: It helps people who want to test how their code behaves with minimal dependencies, and it avoids the challenges around JSR-305 in particular. Here are some past notes about test-runner deps:
- #1150
- #1634
- #2146
- https://github.com/bazelbuild/bazel/blob/a369be1fdb06b465ad272891c987b264659b0349/src/main/java/com/google/devtools/build/lib/rules/java/JavaOptions.java#L194-L206

PiperOrigin-RevId: 1000079080
Change-Id: I766a7756a9abc1b0f707c18257451f3c178831de
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant