Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[bazel][java] Use a transition to target Java 11 for our maven artifacts #14830

Open
wants to merge 2 commits into
base: trunk
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 7 additions & 8 deletions .bazelrc
Original file line number Diff line number Diff line change
Expand Up @@ -20,14 +20,13 @@ build --flag_alias=headless=//common:headless

# Set the default java toolchain

build --java_language_version=17
build --java_runtime_version=remotejdk_17
build --tool_java_language_version=17
build --tool_java_runtime_version=remotejdk_17

# We target java 11 by default

build --javacopt="--release 11"
# This is the version of Java used by Selenium's build and tooling.
# We use a transition in `export.bzl` to set the version of Java we
# target for the binaries we ship to 11.
build --java_language_version=21
build --java_runtime_version=remotejdk_21
build --tool_java_language_version=21
build --tool_java_runtime_version=remotejdk_21

# Require java dependencies to be used and first-order

Expand Down
1 change: 1 addition & 0 deletions MODULE.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ bazel_dep(name = "rules_pkg", version = "0.10.1")
bazel_dep(name = "rules_python", version = "0.33.0")
bazel_dep(name = "rules_proto", version = "6.0.0")
bazel_dep(name = "rules_ruby", version = "0.13.0")
bazel_dep(name = "with_cfg.bzl", version = "0.6.0")

linter = use_extension("@apple_rules_lint//lint:extensions.bzl", "linter")
linter.configure(
Expand Down
7 changes: 6 additions & 1 deletion java/private/export.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,12 @@ load(
load("@rules_jvm_external//private/rules:maven_bom_fragment.bzl", "maven_bom_fragment")
load("@rules_jvm_external//private/rules:maven_project_jar.bzl", "maven_project_jar")
load("@rules_jvm_external//private/rules:maven_publish.bzl", "maven_publish")
load("//java/private:module.bzl", "java_module")
load("@with_cfg.bzl", "with_cfg")
load("//java/private:module.bzl", _java_module = "java_module")

_builder = with_cfg(_java_module)
_builder.set("java_language_version", "11").set("java_runtime_version", "remotejdk_11")
java_module, _ = _builder.build()

def java_export(
name,
Expand Down
Loading