@@ -122,7 +122,7 @@ jobs:
122122 JOB_TYPE : install
123123 - name : Conditionally set jvmopts
124124 if : ${{ matrix.java == 25 }}
125- run : echo " EXTRA_BAZEL_ARGS=' --jvmopt=-Dcom.google.testing.junit.runner.shouldInstallTestSecurityManager=false'" >> $GITHUB_ENV
125+ run : echo ' EXTRA_BAZEL_ARGS=" --jvmopt=-Dcom.google.testing.junit.runner.shouldInstallTestSecurityManager=false"' >> $GITHUB_ENV
126126 - name : Integration Tests
127127 run : |
128128 bazelisk --batch test //sdk-platform-java/test/integration/... ${EXTRA_BAZEL_ARGS}
@@ -232,6 +232,40 @@ jobs:
232232 pushd /tmp/java-compute/google-cloud-compute-small-v1-java
233233 ./gradlew clean build publishToMavenLocal sourcesJar allJars
234234 popd
235+
236+ java8-compatibility :
237+ needs : filter
238+ if : ${{ needs.filter.outputs.library == 'true' }}
239+ runs-on : ubuntu-latest
240+ steps :
241+ - uses : actions/checkout@v4
242+ - uses : actions/setup-java@v4
243+ with :
244+ java-version : 17
245+ distribution : temurin
246+ cache : maven
247+ - name : Install sdk-platform-modules to local Maven repository
248+ shell : bash
249+ run : .kokoro/build.sh
250+ env :
251+ BUILD_SUBDIR : sdk-platform-java
252+ JOB_TYPE : install
253+ - name : Check Java 8 compatibility for class files
254+ shell : bash
255+ run : |
256+ find . -type f -name "*.class" -path "*/classes/*" \
257+ -not -path "*/grpc-*/*" \
258+ -not -path "*/proto-*/*" \
259+ -not -path "*/gapic-generator-java/*" -print |\
260+ while IFS= read -r class_file; do
261+ version=$(javap -v "${class_file}" | grep "major version" | cut -d ' ' -f 5)
262+ if [[ "${version}" != "52" ]]; then
263+ echo "${class_file} is not compatible with Java 8."
264+ exit 1
265+ fi
266+ done
267+ echo "All class files are compatible with Java 8."
268+ working-directory : sdk-platform-java
235269
236270 build-java8-showcase :
237271 needs : filter
0 commit comments