From 57fcf2e96dd3052a282ee1bb087c55f9e66e6e79 Mon Sep 17 00:00:00 2001 From: ldetmer <1771267+ldetmer@users.noreply.github.com> Date: Mon, 19 May 2025 15:08:29 -0400 Subject: [PATCH 01/13] chore: add support for jdk24 --- .bazeliskrc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.bazeliskrc b/.bazeliskrc index 6b386cf868..3f246ab8f2 100644 --- a/.bazeliskrc +++ b/.bazeliskrc @@ -1,3 +1,3 @@ # See https://github.com/bazelbuild/bazelisk # As per b/302171264#comment5, 6.4.0 supports Java 21. -USE_BAZEL_VERSION=6.4.0 +USE_BAZEL_VERSION=7.6.0rc5 From fd62209373cc48f4256a3992565aca718b949c7b Mon Sep 17 00:00:00 2001 From: ldetmer <1771267+ldetmer@users.noreply.github.com> Date: Mon, 19 May 2025 15:10:38 -0400 Subject: [PATCH 02/13] add ci check --- .github/workflows/ci.yaml | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index dfd5970a83..e92ee3c619 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -91,6 +91,39 @@ jobs: - name: Integration Tests run: | bazelisk --batch test //test/integration/... + build-java-24: + name: "build(24) except self-service clients" + # Support for Java 24 is available for all use cases except self-service clients. + runs-on: ubuntu-22.04 + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-java@v4 + with: + java-version: 24 + distribution: temurin + cache: maven + - run: java -version + - name: Unit Tests + run: | + mvn test --batch-mode --no-transfer-progress -Dcheckstyle.skip \ + -Dfmt.skip -DenableTestCoverage -Djacoco.skip=true + # The `envVarTest` profile runs tests that require an environment variable + - name: Env Var Tests + run: | + mvn test --batch-mode --no-transfer-progress -Dcheckstyle.skip \ + -Dfmt.skip -DenableTestCoverage -PenvVarTest -Djacoco.skip=true + # Set the Env Var for this step only + env: + GOOGLE_CLOUD_UNIVERSE_DOMAIN: random.com + GOOGLE_CLOUD_ENABLE_DIRECT_PATH_XDS: true + GOOGLE_SDK_JAVA_LOGGING: true + - run: bazelisk version + - name: Install Maven modules + run: | + mvn install -B -ntp -DskipTests -Dclirr.skip -Dcheckstyle.skip -Djacoco.skip=true + - name: Integration Tests + run: | + bazelisk --batch test //test/integration/... build-java8-except-gapic-generator-java: name: "build(8) except for gapic-generator-java" runs-on: ubuntu-22.04 From 95e673ededb213b144b5d7dcb053086fa3dfb5c7 Mon Sep 17 00:00:00 2001 From: ldetmer <1771267+ldetmer@users.noreply.github.com> Date: Mon, 19 May 2025 15:53:02 -0400 Subject: [PATCH 03/13] add ci check --- .bazeliskrc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.bazeliskrc b/.bazeliskrc index 3f246ab8f2..7e7f5e2bf5 100644 --- a/.bazeliskrc +++ b/.bazeliskrc @@ -1,3 +1,3 @@ # See https://github.com/bazelbuild/bazelisk # As per b/302171264#comment5, 6.4.0 supports Java 21. -USE_BAZEL_VERSION=7.6.0rc5 +USE_BAZEL_VERSION=9.0.0-pre.20241119.2 From e9ec5af6abee07221e773a6f7ee39e92a276f2db Mon Sep 17 00:00:00 2001 From: ldetmer <1771267+ldetmer@users.noreply.github.com> Date: Mon, 19 May 2025 15:55:51 -0400 Subject: [PATCH 04/13] update bazel version --- .bazeliskrc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.bazeliskrc b/.bazeliskrc index 7e7f5e2bf5..7dbb0a1459 100644 --- a/.bazeliskrc +++ b/.bazeliskrc @@ -1,3 +1,3 @@ # See https://github.com/bazelbuild/bazelisk # As per b/302171264#comment5, 6.4.0 supports Java 21. -USE_BAZEL_VERSION=9.0.0-pre.20241119.2 +USE_BAZEL_VERSION=9.0.0-pre.20250506.6 \ No newline at end of file From ebf99421c3f8ea90c242658dcc0e05ff6e1aede6 Mon Sep 17 00:00:00 2001 From: ldetmer <1771267+ldetmer@users.noreply.github.com> Date: Mon, 19 May 2025 16:01:14 -0400 Subject: [PATCH 05/13] try setting tests --- .bazeliskrc | 2 +- rules_java_gapic/java_gapic.bzl | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/.bazeliskrc b/.bazeliskrc index 7dbb0a1459..3f246ab8f2 100644 --- a/.bazeliskrc +++ b/.bazeliskrc @@ -1,3 +1,3 @@ # See https://github.com/bazelbuild/bazelisk # As per b/302171264#comment5, 6.4.0 supports Java 21. -USE_BAZEL_VERSION=9.0.0-pre.20250506.6 \ No newline at end of file +USE_BAZEL_VERSION=7.6.0rc5 diff --git a/rules_java_gapic/java_gapic.bzl b/rules_java_gapic/java_gapic.bzl index fdab81e7af..986d859dbb 100644 --- a/rules_java_gapic/java_gapic.bzl +++ b/rules_java_gapic/java_gapic.bzl @@ -379,6 +379,9 @@ def java_gapic_test(name, runtime_deps, test_classes, **kwargs): name = test_class, test_class = test_class, runtime_deps = runtime_deps, + jvm_flags = [ + "-DSHOULD_INSTALL_SECURITY_MANAGER_PROPERTY=false", + ], **kwargs ) native.test_suite( From 2bace708bf58871a1479a269cb8a4ac923bc5c51 Mon Sep 17 00:00:00 2001 From: ldetmer <1771267+ldetmer@users.noreply.github.com> Date: Mon, 19 May 2025 16:08:17 -0400 Subject: [PATCH 06/13] add -Dcom.google.testing.junit.runner.shouldInstallTestSecurityManager=false --- .github/workflows/ci.yaml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index e92ee3c619..ad125d9e6d 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -111,7 +111,7 @@ jobs: - name: Env Var Tests run: | mvn test --batch-mode --no-transfer-progress -Dcheckstyle.skip \ - -Dfmt.skip -DenableTestCoverage -PenvVarTest -Djacoco.skip=true + -Dfmt.skip -DenableTestCoverage -PenvVarTest # Set the Env Var for this step only env: GOOGLE_CLOUD_UNIVERSE_DOMAIN: random.com @@ -120,10 +120,10 @@ jobs: - run: bazelisk version - name: Install Maven modules run: | - mvn install -B -ntp -DskipTests -Dclirr.skip -Dcheckstyle.skip -Djacoco.skip=true + mvn install -B -ntp -DskipTests -Dclirr.skip -Dcheckstyle.skip - name: Integration Tests run: | - bazelisk --batch test //test/integration/... + bazelisk --batch test //test/integration/... -Dcom.google.testing.junit.runner.shouldInstallTestSecurityManager=false build-java8-except-gapic-generator-java: name: "build(8) except for gapic-generator-java" runs-on: ubuntu-22.04 From 7d1013074f2e561d703c18f3e50e26fca8d342d4 Mon Sep 17 00:00:00 2001 From: ldetmer <1771267+ldetmer@users.noreply.github.com> Date: Mon, 19 May 2025 16:15:10 -0400 Subject: [PATCH 07/13] add -Dcom.google.testing.junit.runner.shouldInstallTestSecurityManager=false --- .github/workflows/ci.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index ad125d9e6d..7c322dfb7d 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -123,7 +123,7 @@ jobs: mvn install -B -ntp -DskipTests -Dclirr.skip -Dcheckstyle.skip - name: Integration Tests run: | - bazelisk --batch test //test/integration/... -Dcom.google.testing.junit.runner.shouldInstallTestSecurityManager=false + bazelisk --batch test //test/integration/... --jvmopt=-Dcom.google.testing.junit.runner.shouldInstallTestSecurityManager=false build-java8-except-gapic-generator-java: name: "build(8) except for gapic-generator-java" runs-on: ubuntu-22.04 From 646271020813f4126588165b79af0cd945e014df Mon Sep 17 00:00:00 2001 From: ldetmer <1771267+ldetmer@users.noreply.github.com> Date: Mon, 19 May 2025 17:30:49 -0400 Subject: [PATCH 08/13] add -Dcom.google.testing.junit.runner.shouldInstallTestSecurityManager=false --- .bazeliskrc | 2 +- .github/workflows/ci.yaml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.bazeliskrc b/.bazeliskrc index 3f246ab8f2..6b386cf868 100644 --- a/.bazeliskrc +++ b/.bazeliskrc @@ -1,3 +1,3 @@ # See https://github.com/bazelbuild/bazelisk # As per b/302171264#comment5, 6.4.0 supports Java 21. -USE_BAZEL_VERSION=7.6.0rc5 +USE_BAZEL_VERSION=6.4.0 diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 7c322dfb7d..4724ffc854 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -123,7 +123,7 @@ jobs: mvn install -B -ntp -DskipTests -Dclirr.skip -Dcheckstyle.skip - name: Integration Tests run: | - bazelisk --batch test //test/integration/... --jvmopt=-Dcom.google.testing.junit.runner.shouldInstallTestSecurityManager=false + bazelisk --batch test //test/integration/... --jvmopt=-Dcom.google.testing.junit.runner.shouldInstallTestSecurityManager=false,-Djava.security.manager=disallow build-java8-except-gapic-generator-java: name: "build(8) except for gapic-generator-java" runs-on: ubuntu-22.04 From 0efe0ca09b7e17f230bf39314768850b329c3808 Mon Sep 17 00:00:00 2001 From: ldetmer <1771267+ldetmer@users.noreply.github.com> Date: Mon, 19 May 2025 17:37:55 -0400 Subject: [PATCH 09/13] need this version of bazel --- .bazeliskrc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.bazeliskrc b/.bazeliskrc index 6b386cf868..fab2807c22 100644 --- a/.bazeliskrc +++ b/.bazeliskrc @@ -1,3 +1,3 @@ # See https://github.com/bazelbuild/bazelisk # As per b/302171264#comment5, 6.4.0 supports Java 21. -USE_BAZEL_VERSION=6.4.0 +USE_BAZEL_VERSION=7.6.0rc5 \ No newline at end of file From 0e4d308bce1e73180c4e16b1e40121dfd824cc63 Mon Sep 17 00:00:00 2001 From: ldetmer <1771267+ldetmer@users.noreply.github.com> Date: Mon, 19 May 2025 17:44:34 -0400 Subject: [PATCH 10/13] transitive_deps was migrated to more specific transitive_runtime_jars and transitive_compile_time_jars --- rules_java_gapic/java_gapic_pkg.bzl | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/rules_java_gapic/java_gapic_pkg.bzl b/rules_java_gapic/java_gapic_pkg.bzl index d85083d4b9..b799be329e 100644 --- a/rules_java_gapic/java_gapic_pkg.bzl +++ b/rules_java_gapic/java_gapic_pkg.bzl @@ -149,7 +149,14 @@ def _construct_extra_deps(scope_to_deps, versions_map): if not extra_deps.get(key): extra_deps[key] = "%s project(':%s')" % (scope, pkg_dependency) elif _is_java_dependency(dep): - for f in dep[JavaInfo].transitive_deps.to_list(): + for f in dep[JavaInfo].transitive_runtime_jars.to_list(): + maven_artifact = label_name_to_maven_artifact.get(f.owner.name) + if not maven_artifact: + continue + key = "{{%s}}" % maven_artifact + if not extra_deps.get(key): + extra_deps[key] = "%s '%s'" % (scope, versions_map[key]) + for f in dep[JavaInfo].transitive_compile_time_jars.to_list(): maven_artifact = label_name_to_maven_artifact.get(f.owner.name) if not maven_artifact: continue From 0b414e2a6ecc36e409e8e8cfdd0e6f073a1dc296 Mon Sep 17 00:00:00 2001 From: ldetmer <1771267+ldetmer@users.noreply.github.com> Date: Tue, 20 May 2025 09:13:23 -0400 Subject: [PATCH 11/13] transitive_deps was migrated to more specific transitive_compile_time_jars --- rules_java_gapic/java_gapic_pkg.bzl | 7 ------- 1 file changed, 7 deletions(-) diff --git a/rules_java_gapic/java_gapic_pkg.bzl b/rules_java_gapic/java_gapic_pkg.bzl index b799be329e..de71350113 100644 --- a/rules_java_gapic/java_gapic_pkg.bzl +++ b/rules_java_gapic/java_gapic_pkg.bzl @@ -149,13 +149,6 @@ def _construct_extra_deps(scope_to_deps, versions_map): if not extra_deps.get(key): extra_deps[key] = "%s project(':%s')" % (scope, pkg_dependency) elif _is_java_dependency(dep): - for f in dep[JavaInfo].transitive_runtime_jars.to_list(): - maven_artifact = label_name_to_maven_artifact.get(f.owner.name) - if not maven_artifact: - continue - key = "{{%s}}" % maven_artifact - if not extra_deps.get(key): - extra_deps[key] = "%s '%s'" % (scope, versions_map[key]) for f in dep[JavaInfo].transitive_compile_time_jars.to_list(): maven_artifact = label_name_to_maven_artifact.get(f.owner.name) if not maven_artifact: From 812b9120baba28748579b219b16f2c390840ab7b Mon Sep 17 00:00:00 2001 From: ldetmer <1771267+ldetmer@users.noreply.github.com> Date: Tue, 20 May 2025 09:51:12 -0400 Subject: [PATCH 12/13] clean up --- .bazeliskrc | 4 ++-- .github/workflows/ci.yaml | 23 +++++++++++++++++++++-- rules_java_gapic/java_gapic.bzl | 3 --- 3 files changed, 23 insertions(+), 7 deletions(-) diff --git a/.bazeliskrc b/.bazeliskrc index fab2807c22..2a3a05047d 100644 --- a/.bazeliskrc +++ b/.bazeliskrc @@ -1,3 +1,3 @@ # See https://github.com/bazelbuild/bazelisk -# As per b/302171264#comment5, 6.4.0 supports Java 21. -USE_BAZEL_VERSION=7.6.0rc5 \ No newline at end of file +# Version required for Java 24 support (https://github.com/bazelbuild/bazel/commit/806a6e82320956b63f1351ebe2b0da8483f36f19). +USE_BAZEL_VERSION=7.6.1 \ No newline at end of file diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 4724ffc854..c5730074b3 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -106,7 +106,7 @@ jobs: - name: Unit Tests run: | mvn test --batch-mode --no-transfer-progress -Dcheckstyle.skip \ - -Dfmt.skip -DenableTestCoverage -Djacoco.skip=true + -Dfmt.skip -DenableTestCoverage # The `envVarTest` profile runs tests that require an environment variable - name: Env Var Tests run: | @@ -123,7 +123,26 @@ jobs: mvn install -B -ntp -DskipTests -Dclirr.skip -Dcheckstyle.skip - name: Integration Tests run: | - bazelisk --batch test //test/integration/... --jvmopt=-Dcom.google.testing.junit.runner.shouldInstallTestSecurityManager=false,-Djava.security.manager=disallow + bazelisk --batch test //test/integration/... --jvmopt=-Dcom.google.testing.junit.runner.shouldInstallTestSecurityManager=false + - name: Gradle Build Generated Storage Client Library + run: | + echo "Building Storage lib from generated source..." + mkdir /tmp/java-storage + bazelisk --batch build @com_google_googleapis//google/storage/v2:google-cloud-storage-v2-java + tar zxvf bazel-bin/external/com_google_googleapis/google/storage/v2/google-cloud-storage-v2-java.tar.gz -C /tmp/java-storage + pushd /tmp/java-storage/google-cloud-storage-v2-java + ./gradlew clean build publishToMavenLocal sourcesJar allJars + popd + + - name: Gradle Build Generated Compute Client Library + run: | + echo "Building Compute lib from generated source..." + mkdir /tmp/java-compute + bazelisk --batch build @com_google_googleapis//google/cloud/compute/v1small:google-cloud-compute-small-v1-java + tar zxvf bazel-bin/external/com_google_googleapis/google/cloud/compute/v1small/google-cloud-compute-small-v1-java.tar.gz -C /tmp/java-compute + pushd /tmp/java-compute/google-cloud-compute-small-v1-java + ./gradlew clean build publishToMavenLocal sourcesJar allJars + popd build-java8-except-gapic-generator-java: name: "build(8) except for gapic-generator-java" runs-on: ubuntu-22.04 diff --git a/rules_java_gapic/java_gapic.bzl b/rules_java_gapic/java_gapic.bzl index 986d859dbb..fdab81e7af 100644 --- a/rules_java_gapic/java_gapic.bzl +++ b/rules_java_gapic/java_gapic.bzl @@ -379,9 +379,6 @@ def java_gapic_test(name, runtime_deps, test_classes, **kwargs): name = test_class, test_class = test_class, runtime_deps = runtime_deps, - jvm_flags = [ - "-DSHOULD_INSTALL_SECURITY_MANAGER_PROPERTY=false", - ], **kwargs ) native.test_suite( From 0225badd595bea2e491ab42f07d665861b0852b9 Mon Sep 17 00:00:00 2001 From: ldetmer <1771267+ldetmer@users.noreply.github.com> Date: Tue, 20 May 2025 10:07:04 -0400 Subject: [PATCH 13/13] clean up --- .bazeliskrc | 2 +- .github/workflows/ci.yaml | 19 ------------------- 2 files changed, 1 insertion(+), 20 deletions(-) diff --git a/.bazeliskrc b/.bazeliskrc index 2a3a05047d..f8a95cd0a4 100644 --- a/.bazeliskrc +++ b/.bazeliskrc @@ -1,3 +1,3 @@ # See https://github.com/bazelbuild/bazelisk # Version required for Java 24 support (https://github.com/bazelbuild/bazel/commit/806a6e82320956b63f1351ebe2b0da8483f36f19). -USE_BAZEL_VERSION=7.6.1 \ No newline at end of file +USE_BAZEL_VERSION=7.6.0 \ No newline at end of file diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index c5730074b3..c61fa09f79 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -124,25 +124,6 @@ jobs: - name: Integration Tests run: | bazelisk --batch test //test/integration/... --jvmopt=-Dcom.google.testing.junit.runner.shouldInstallTestSecurityManager=false - - name: Gradle Build Generated Storage Client Library - run: | - echo "Building Storage lib from generated source..." - mkdir /tmp/java-storage - bazelisk --batch build @com_google_googleapis//google/storage/v2:google-cloud-storage-v2-java - tar zxvf bazel-bin/external/com_google_googleapis/google/storage/v2/google-cloud-storage-v2-java.tar.gz -C /tmp/java-storage - pushd /tmp/java-storage/google-cloud-storage-v2-java - ./gradlew clean build publishToMavenLocal sourcesJar allJars - popd - - - name: Gradle Build Generated Compute Client Library - run: | - echo "Building Compute lib from generated source..." - mkdir /tmp/java-compute - bazelisk --batch build @com_google_googleapis//google/cloud/compute/v1small:google-cloud-compute-small-v1-java - tar zxvf bazel-bin/external/com_google_googleapis/google/cloud/compute/v1small/google-cloud-compute-small-v1-java.tar.gz -C /tmp/java-compute - pushd /tmp/java-compute/google-cloud-compute-small-v1-java - ./gradlew clean build publishToMavenLocal sourcesJar allJars - popd build-java8-except-gapic-generator-java: name: "build(8) except for gapic-generator-java" runs-on: ubuntu-22.04