Skip to content

Commit 729ac42

Browse files
l46kokcopybara-github
authored andcommitted
Change default java toolchain and build from 8 to 11. Add separate CI for Java 8 builds
Note: Java 8 compatibility is still retained for published maven artifacts. JDK 11 is required to invoke android_local_test. PiperOrigin-RevId: 731512926
1 parent ae1cb15 commit 729ac42

File tree

4 files changed

+10
-6
lines changed

4 files changed

+10
-6
lines changed

.bazelrc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
common --noenable_bzlmod
22
common --enable_workspace
3-
build --java_runtime_version=remotejdk_8
4-
build --java_language_version=8
3+
build --java_runtime_version=remotejdk_11
4+
build --java_language_version=11
55

66
# Hide Java 8 deprecation warnings.
77
common --javacopt=-Xlint:-options

.github/workflows/workflow.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,8 @@ jobs:
3535
repository-cache: true
3636
- name: Bazel Output Version
3737
run: bazelisk --version
38+
- name: Java 8 Build
39+
run: bazel build ... --java_language_version=8 --java_runtime_version=8
3840
- name: Bazel Test
3941
# Exclude codelab exercises as they are intentionally made to fail
4042
run: bazelisk test ... --deleted_packages=//codelab/src/test/codelab --test_output=errors

BUILD.bazel

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -96,8 +96,8 @@ default_java_toolchain(
9696
package_configuration = [
9797
":error_prone",
9898
],
99-
source_version = "8",
100-
target_version = "8",
99+
source_version = "11",
100+
target_version = "11",
101101
)
102102

103103
# This associates a set of javac flags with a set of packages

publish/publish.sh

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626

2727

2828
ALL_TARGETS=("//publish:cel.publish" "//publish:cel_compiler.publish" "//publish:cel_runtime.publish" "//publish:cel_v1alpha1.publish" "//publish:cel_protobuf.publish")
29+
JDK8_FLAGS="--java_language_version=8 --java_runtime_version=8"
2930

3031
function publish_maven_remote() {
3132
maven_repo_url=$1
@@ -41,7 +42,8 @@ function publish_maven_remote() {
4142
--define gpg_sign=true \
4243
--define "maven_user=$maven_user" \
4344
--define "maven_password=$maven_password" \
44-
$PUBLISH_TARGET
45+
$PUBLISH_TARGET \
46+
$JDK8_FLAGS
4547
done
4648

4749
}
@@ -78,6 +80,6 @@ else
7880
echo "Pushing to local Maven repository $local_maven_repo"
7981
for PUBLISH_TARGET in "${ALL_TARGETS[@]}"
8082
do
81-
bazel run --define "maven_repo=file://$local_maven_repo" $PUBLISH_TARGET
83+
bazel run --define "maven_repo=file://$local_maven_repo" $PUBLISH_TARGET $JDK8_FLAGS
8284
done
8385
fi

0 commit comments

Comments
 (0)