diff --git a/.cloudbuild/google-cloud-sdk.repo b/.cloudbuild/google-cloud-sdk.repo deleted file mode 100644 index 8c654dc317..0000000000 --- a/.cloudbuild/google-cloud-sdk.repo +++ /dev/null @@ -1,8 +0,0 @@ -[google-cloud-sdk] -name=Google Cloud SDK -baseurl=https://packages.cloud.google.com/yum/repos/cloud-sdk-el7-x86_64 -enabled=1 -gpgcheck=1 -repo_gpgcheck=0 -gpgkey=https://packages.cloud.google.com/yum/doc/yum-key.gpg - https://packages.cloud.google.com/yum/doc/rpm-package-key.gpg diff --git a/.cloudbuild/cloudbuild-test-a.yaml b/.cloudbuild/graalvm/cloudbuild-test-a.yaml similarity index 87% rename from .cloudbuild/cloudbuild-test-a.yaml rename to .cloudbuild/graalvm/cloudbuild-test-a.yaml index 6727039eb0..8c829b592b 100644 --- a/.cloudbuild/cloudbuild-test-a.yaml +++ b/.cloudbuild/graalvm/cloudbuild-test-a.yaml @@ -14,14 +14,14 @@ timeout: 7200s # 2 hours substitutions: - _SHARED_DEPENDENCIES_VERSION: '3.25.1-SNAPSHOT' # {x-version-update:google-cloud-shared-dependencies:current} - _JAVA_SHARED_CONFIG_VERSION: '1.7.1' + _SHARED_DEPENDENCIES_VERSION: '3.27.1-SNAPSHOT' # {x-version-update:google-cloud-shared-dependencies:current} + _JAVA_SHARED_CONFIG_VERSION: '1.7.4' steps: # GraalVM A build - name: gcr.io/cloud-builders/docker args: ["build", "-t", "gcr.io/cloud-devrel-public-resources/graalvm_sdk_platform_a:${_SHARED_DEPENDENCIES_VERSION}", "--file", "graalvm_a.Dockerfile", "--build-arg", "JAVA_SHARED_CONFIG_VERSION=$_JAVA_SHARED_CONFIG_VERSION", "."] - dir: .cloudbuild + dir: .cloudbuild/graalvm id: graalvm-a-build waitFor: ["-"] - name: gcr.io/cloud-devrel-public-resources/graalvm_sdk_platform_a:${_SHARED_DEPENDENCIES_VERSION} @@ -30,4 +30,4 @@ steps: waitFor: [ "graalvm-a-build" ] env: - 'MODULES_UNDER_TEST=java-kms' - - 'GOOGLE_CLOUD_PROJECT=cloud-java-ci-test' \ No newline at end of file + - 'GOOGLE_CLOUD_PROJECT=cloud-java-ci-test' diff --git a/.cloudbuild/cloudbuild-test-b.yaml b/.cloudbuild/graalvm/cloudbuild-test-b.yaml similarity index 87% rename from .cloudbuild/cloudbuild-test-b.yaml rename to .cloudbuild/graalvm/cloudbuild-test-b.yaml index 219aacc491..b223279693 100644 --- a/.cloudbuild/cloudbuild-test-b.yaml +++ b/.cloudbuild/graalvm/cloudbuild-test-b.yaml @@ -14,14 +14,14 @@ timeout: 7200s # 2 hours substitutions: - _SHARED_DEPENDENCIES_VERSION: '3.25.1-SNAPSHOT' # {x-version-update:google-cloud-shared-dependencies:current} - _JAVA_SHARED_CONFIG_VERSION: '1.7.1' + _SHARED_DEPENDENCIES_VERSION: '3.27.1-SNAPSHOT' # {x-version-update:google-cloud-shared-dependencies:current} + _JAVA_SHARED_CONFIG_VERSION: '1.7.4' steps: # GraalVM A build - name: gcr.io/cloud-builders/docker args: ["build", "-t", "gcr.io/cloud-devrel-public-resources/graalvm_sdk_platform_b:${_SHARED_DEPENDENCIES_VERSION}", "--file", "graalvm_b.Dockerfile", "--build-arg", "JAVA_SHARED_CONFIG_VERSION=$_JAVA_SHARED_CONFIG_VERSION", "."] - dir: .cloudbuild + dir: .cloudbuild/graalvm id: graalvm-b-build waitFor: ["-"] - name: gcr.io/cloud-devrel-public-resources/graalvm_sdk_platform_b:${_SHARED_DEPENDENCIES_VERSION} @@ -30,4 +30,4 @@ steps: waitFor: [ "graalvm-b-build" ] env: - 'MODULES_UNDER_TEST=java-kms' - - 'GOOGLE_CLOUD_PROJECT=cloud-java-ci-test' \ No newline at end of file + - 'GOOGLE_CLOUD_PROJECT=cloud-java-ci-test' diff --git a/.cloudbuild/cloudbuild.yaml b/.cloudbuild/graalvm/cloudbuild.yaml similarity index 90% rename from .cloudbuild/cloudbuild.yaml rename to .cloudbuild/graalvm/cloudbuild.yaml index 0f26b79b23..e4e3ed9048 100644 --- a/.cloudbuild/cloudbuild.yaml +++ b/.cloudbuild/graalvm/cloudbuild.yaml @@ -14,20 +14,20 @@ timeout: 7200s # 2 hours substitutions: - _SHARED_DEPENDENCIES_VERSION: '3.25.1-SNAPSHOT' # {x-version-update:google-cloud-shared-dependencies:current} - _JAVA_SHARED_CONFIG_VERSION: '1.7.1' + _SHARED_DEPENDENCIES_VERSION: '3.27.1-SNAPSHOT' # {x-version-update:google-cloud-shared-dependencies:current} + _JAVA_SHARED_CONFIG_VERSION: '1.7.4' steps: # GraalVM A build - name: gcr.io/cloud-builders/docker args: ["build", "-t", "gcr.io/cloud-devrel-public-resources/graalvm_sdk_platform_a:${_SHARED_DEPENDENCIES_VERSION}", "--file", "graalvm_a.Dockerfile", "--build-arg", "JAVA_SHARED_CONFIG_VERSION=$_JAVA_SHARED_CONFIG_VERSION", "."] - dir: .cloudbuild + dir: .cloudbuild/graalvm id: graalvm-a-build waitFor: ["-"] # GraalVM B build - name: gcr.io/cloud-builders/docker args: [ "build", "-t", "gcr.io/cloud-devrel-public-resources/graalvm_sdk_platform_b:${_SHARED_DEPENDENCIES_VERSION}", "--file", "graalvm_b.Dockerfile", "--build-arg", "JAVA_SHARED_CONFIG_VERSION=$_JAVA_SHARED_CONFIG_VERSION", "." ] - dir: .cloudbuild + dir: .cloudbuild/graalvm id: graalvm-b-build waitFor: [ "-" ] diff --git a/.cloudbuild/graalvm_a.Dockerfile b/.cloudbuild/graalvm/graalvm_a.Dockerfile similarity index 100% rename from .cloudbuild/graalvm_a.Dockerfile rename to .cloudbuild/graalvm/graalvm_a.Dockerfile diff --git a/.cloudbuild/graalvm_b.Dockerfile b/.cloudbuild/graalvm/graalvm_b.Dockerfile similarity index 100% rename from .cloudbuild/graalvm_b.Dockerfile rename to .cloudbuild/graalvm/graalvm_b.Dockerfile diff --git a/.cloudbuild/library_generation/cloudbuild-library-generation-push.yaml b/.cloudbuild/library_generation/cloudbuild-library-generation-push.yaml new file mode 100644 index 0000000000..296cdb6db5 --- /dev/null +++ b/.cloudbuild/library_generation/cloudbuild-library-generation-push.yaml @@ -0,0 +1,33 @@ +# Copyright 2024 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +timeout: 7200s # 2 hours +substitutions: + _IMAGE_NAME: "gcr.io/cloud-devrel-public-resources/java-library-generation" + _SHA_IMAGE_ID: "${_IMAGE_NAME}:${COMMIT_SHA}" + _LATEST_IMAGE_ID: "${_IMAGE_NAME}:latest" +steps: + # Library generation build + - name: gcr.io/cloud-builders/docker + args: [ + "build", + "-t", "${_SHA_IMAGE_ID}", + "-t", "${_LATEST_IMAGE_ID}", + "--file", ".cloudbuild/library_generation/library_generation.Dockerfile", "."] + id: library-generation-build + waitFor: ["-"] + +images: + - ${_SHA_IMAGE_ID} + - ${_LATEST_IMAGE_ID} diff --git a/.cloudbuild/library_generation/cloudbuild-library-generation-release.yaml b/.cloudbuild/library_generation/cloudbuild-library-generation-release.yaml new file mode 100644 index 0000000000..c5be471583 --- /dev/null +++ b/.cloudbuild/library_generation/cloudbuild-library-generation-release.yaml @@ -0,0 +1,31 @@ +# Copyright 2024 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +timeout: 7200s # 2 hours +substitutions: + _GAPIC_GENERATOR_JAVA_VERSION: '2.37.1-SNAPSHOT' # {x-version-update:gapic-generator-java:current} + _IMAGE_ID: "gcr.io/cloud-devrel-public-resources/java-library-generation:${_GAPIC_GENERATOR_JAVA_VERSION}" +steps: + # Library generation build + - name: gcr.io/cloud-builders/docker + args: [ + "build", + "-t", "${_IMAGE_ID}", + "--file", ".cloudbuild/library_generation/library_generation.Dockerfile", "."] + id: library-generation-build + waitFor: ["-"] + +images: + - ${_IMAGE_ID} + diff --git a/.cloudbuild/library_generation/cloudbuild-test-library-generation.yaml b/.cloudbuild/library_generation/cloudbuild-test-library-generation.yaml new file mode 100644 index 0000000000..6cdb333f19 --- /dev/null +++ b/.cloudbuild/library_generation/cloudbuild-test-library-generation.yaml @@ -0,0 +1,31 @@ +# Copyright 2024 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +timeout: 7200s # 2 hours +substitutions: + _TEST_IMAGE_ID: 'gcr.io/cloud-devrel-public-resources/java-library-generation:${COMMIT_SHA}' + +steps: + # Library generation build + - name: gcr.io/cloud-builders/docker + args: ["build", "-t", "${_TEST_IMAGE_ID}", "--file", ".cloudbuild/library_generation/library_generation.Dockerfile", "."] + id: library-generation-build + waitFor: ["-"] + - name: ${_TEST_IMAGE_ID} + entrypoint: bash + args: [ './library_generation/test/container_integration_tests.sh' ] + waitFor: [ "library-generation-build" ] + env: + - 'TEST_IMAGE_ID=${_TEST_IMAGE_ID}' + diff --git a/.cloudbuild/library_generation/library_generation.Dockerfile b/.cloudbuild/library_generation/library_generation.Dockerfile new file mode 100644 index 0000000000..4b3b1f4b1c --- /dev/null +++ b/.cloudbuild/library_generation/library_generation.Dockerfile @@ -0,0 +1,40 @@ +# Copyright 2024 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# build from the root of this repo: +FROM gcr.io/cloud-devrel-public-resources/python + +# install tools +RUN apt-get update && apt-get install -y \ + unzip openjdk-17-jdk rsync maven jq \ + && apt-get clean + +COPY library_generation /src + +RUN rm $(which python3) +RUN ln -s $(which python3.11) /usr/local/bin/python +RUN ln -s $(which python3.11) /usr/local/bin/python3 +RUN python -m pip install --upgrade pip +RUN cd /src && python -m pip install -r requirements.in +RUN cd /src && python -m pip install . + +# set dummy git credentials for empty commit used in postprocessing +RUN git config --global user.email "cloud-java-bot@google.com" +RUN git config --global user.name "Cloud Java Bot" + +WORKDIR /workspace +RUN chmod 750 /workspace +RUN chmod 750 /src/generate_repo.py + +CMD [ "/src/generate_repo.py" ] diff --git a/.github/release-please.yml b/.github/release-please.yml index c964bc6236..c335a3f0aa 100644 --- a/.github/release-please.yml +++ b/.github/release-please.yml @@ -3,4 +3,4 @@ bumpMinorPreMajor: true handleGHRelease: true primaryBranch: main manifest: true -extraFiles: ["WORKSPACE", ".cloudbuild/cloudbuild.yaml", ".cloudbuild/cloudbuild-test-a.yaml", ".cloudbuild/cloudbuild-test-b.yaml" ] +extraFiles: ["WORKSPACE", ".cloudbuild/graalvm/cloudbuild.yaml", ".cloudbuild/graalvm/cloudbuild-test-a.yaml", ".cloudbuild/graalvm/cloudbuild-test-b.yaml", ".cloudbuild/library_generation/cloudbuild-library-generation-release.yaml" ] diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 5344f99886..55ed9b62e6 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -22,6 +22,14 @@ jobs: run: | mvn test --batch-mode --no-transfer-progress -Dcheckstyle.skip \ -Dfmt.skip -DenableTestCoverage + # 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 + # Set the Env Var for this step only + env: + GOOGLE_CLOUD_UNIVERSE_DOMAIN: random.com - run: bazelisk version - name: Install Maven modules run: | @@ -64,6 +72,14 @@ jobs: run: | mvn test --batch-mode --no-transfer-progress -Dcheckstyle.skip \ -Dfmt.skip -DenableTestCoverage + # 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 + # Set the Env Var for this step only + env: + GOOGLE_CLOUD_UNIVERSE_DOMAIN: random.com - run: bazelisk version - name: Install Maven modules run: | @@ -98,6 +114,22 @@ jobs: mvn verify --batch-mode --no-transfer-progress -Dcheckstyle.skip \ -Dfmt.skip \ -Djvm="${JAVA8_HOME}/bin/java" + # The `envVarTest` profile runs tests that require an environment variable + - name: Compile with Java 17 and run tests with Java 8 (Env Var Tests) + shell: bash + run: | + set -x + export JAVA_HOME=$JAVA_HOME + export PATH=${JAVA_HOME}/bin:$PATH + # Maven surefire plugin lets us to specify the JVM when running tests via + # the "jvm" system property. + export GOOGLE_CLOUD_UNIVERSE_DOMAIN=random.com + mvn test --batch-mode --no-transfer-progress -Dcheckstyle.skip \ + -Dfmt.skip -DenableTestCoverage -Dsurefire.failIfNoSpecifiedTests=false \ + -PenvVarTest + # Set the Env Var for this step only + env: + GOOGLE_CLOUD_UNIVERSE_DOMAIN: random.com build-java8-gapic-generator-java: name: "build(8) for gapic-generator-java" @@ -295,7 +327,7 @@ jobs: run: | mvn install -B -ntp -DskipTests -Dclirr.skip -Dcheckstyle.skip - name: Validate gapic-generator-java-bom - uses: googleapis/java-cloud-bom/tests/validate-bom@ac9893c4ba759cda192b11c2e8bac0d5a6bd60a5 + uses: googleapis/java-cloud-bom/tests/validate-bom@3f93d58a049cf6089a930c55cc23ff0c0869a12f with: bom-path: gapic-generator-java-bom/pom.xml diff --git a/.github/workflows/sonar.yaml b/.github/workflows/sonar.yaml index 013ff88b36..585893942e 100644 --- a/.github/workflows/sonar.yaml +++ b/.github/workflows/sonar.yaml @@ -47,6 +47,10 @@ jobs: tar -xf showcase-* ./gapic-showcase run & cd - + # Intentionally do not run the Env Var Tests (no -PenvVarTests) as setting the Env Var + # may alter the results for other tests that use Env Var in the logic. Adding a Sonar + # step for a few tests (env var tests) may be overkill and should be better covered + # when we can upgrade to JUnit 5 (https://github.com/googleapis/sdk-platform-java/issues/1611#issuecomment-1970079325) - name: Build and analyze for full test coverage env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Needed to get PR information, if any @@ -59,7 +63,6 @@ jobs: -Dsonar.projectKey=googleapis_gapic-generator-java \ -Dsonar.organization=googleapis \ -Dsonar.host.url=https://sonarcloud.io - - name: Build and analyze Showcase Integration Tests Coverage env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Needed to get PR information, if any diff --git a/.github/workflows/verify_library_generation.yaml b/.github/workflows/verify_library_generation.yaml index 89cec5ddc9..b5707b443d 100644 --- a/.github/workflows/verify_library_generation.yaml +++ b/.github/workflows/verify_library_generation.yaml @@ -15,13 +15,13 @@ jobs: java: [ 11 ] runs-on: ubuntu-22.04 steps: - - uses: actions/checkout@v3 - - uses: actions/setup-java@v3 + - uses: actions/checkout@v4 + - uses: actions/setup-java@v4 with: java-version: ${{ matrix.java }} distribution: temurin cache: maven - - uses: actions/setup-python@v4 + - uses: actions/setup-python@v5 with: python-version: 3.11 - name: install pyenv @@ -58,14 +58,14 @@ jobs: os: [ ubuntu-22.04, macos-12 ] runs-on: ${{ matrix.os }} steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: install utils (macos) if: matrix.os == 'macos-12' shell: bash run: | brew update --preinstall brew install coreutils - - uses: actions/setup-python@v4 + - uses: actions/setup-python@v5 with: python-version: 3.11 - name: install python dependencies @@ -97,11 +97,11 @@ jobs: - name: Run python unit tests run: | set -x - python -m unittest library_generation/test/unit_tests.py + python -m unittest discover -s library_generation/test/ -p "*unit_tests.py" lint-shell: runs-on: ubuntu-22.04 steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: Run ShellCheck uses: ludeeus/action-shellcheck@2.0.0 with: @@ -111,7 +111,7 @@ jobs: lint-python: runs-on: ubuntu-22.04 steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: install python dependencies shell: bash run: | diff --git a/.gitignore b/.gitignore index 5a54c06a20..201526885b 100644 --- a/.gitignore +++ b/.gitignore @@ -25,6 +25,7 @@ target/ **/output/ **/googleapis library_generation/test/**/golden*/ -library_generation/test/resources/test_repo_level_postprocess/ +library_generation/test/resources/test_monorepo_postprocessing/ **/*egg-info/ **/build/ +**/dist/ diff --git a/.release-please-manifest.json b/.release-please-manifest.json index 517b0cf98a..28c811f943 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,3 +1,3 @@ { - ".": "2.35.0" + ".": "2.37.0" } \ No newline at end of file diff --git a/CHANGELOG.md b/CHANGELOG.md index a034a206c1..7de5bc6816 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,45 @@ # Changelog +## [2.37.0](https://github.com/googleapis/sdk-platform-java/compare/v2.36.0...v2.37.0) (2024-02-29) + + +### Features + +* improve batching summary errors ([#2509](https://github.com/googleapis/sdk-platform-java/issues/2509)) ([d6964a4](https://github.com/googleapis/sdk-platform-java/commit/d6964a4cfda60ef7c5f1871b215a9cf222361e7e)) + + +### Bug Fixes + +* adjust release please config to reflect file location change. ([#2524](https://github.com/googleapis/sdk-platform-java/issues/2524)) ([1e5af1e](https://github.com/googleapis/sdk-platform-java/commit/1e5af1e651a079220b8a63952b7dbc68586d9b7d)) + +## [2.36.0](https://github.com/googleapis/sdk-platform-java/compare/v2.35.0...v2.36.0) (2024-02-29) + + +### Features + +* check library_name is unique among libraries ([#2490](https://github.com/googleapis/sdk-platform-java/issues/2490)) ([8123f0b](https://github.com/googleapis/sdk-platform-java/commit/8123f0b15970c76b08086d8988de14e1ed58a77e)) + + +### Bug Fixes + +* cleanup @BetaApi from Resource Name Builder Methods ([#2450](https://github.com/googleapis/sdk-platform-java/issues/2450)) ([6e8d098](https://github.com/googleapis/sdk-platform-java/commit/6e8d09845610401665556118cd78c7229c46d426)), closes [#2099](https://github.com/googleapis/sdk-platform-java/issues/2099) +* Fix watchdog to start with WAITING state ([#2468](https://github.com/googleapis/sdk-platform-java/issues/2468)) ([dedc40f](https://github.com/googleapis/sdk-platform-java/commit/dedc40fb451633b11be10013b74a91053e155620)) +* ignore comment in BUILD ([#2492](https://github.com/googleapis/sdk-platform-java/issues/2492)) ([6ca20e5](https://github.com/googleapis/sdk-platform-java/commit/6ca20e529a86561cdc935d0d44dd971de3b9e4b2)) +* remove @BetaApi from ApiFutures and ApiService ([#2454](https://github.com/googleapis/sdk-platform-java/issues/2454)) ([f59e717](https://github.com/googleapis/sdk-platform-java/commit/f59e717402d00bc953648e1e780dd84dda7915b3)), closes [#2098](https://github.com/googleapis/sdk-platform-java/issues/2098) + + +### Dependencies + +* grandfathering the dependencies for java-pubsublite and java-bigquery ([#2504](https://github.com/googleapis/sdk-platform-java/issues/2504)) ([9ceab23](https://github.com/googleapis/sdk-platform-java/commit/9ceab23144ba7a9ca9114d585376e09587fd1bee)) +* update dependency gradle to v7.6.4 ([#2474](https://github.com/googleapis/sdk-platform-java/issues/2474)) ([607dc59](https://github.com/googleapis/sdk-platform-java/commit/607dc59f8eb5a70f8807c4d5f7d0745438842381)) +* update dependency org.graalvm.sdk:graal-sdk to v22.3.5 ([#2475](https://github.com/googleapis/sdk-platform-java/issues/2475)) ([2de487b](https://github.com/googleapis/sdk-platform-java/commit/2de487b34c43fee3b81e4af7a2dfe4f2eb6418ac)) +* update grpc dependencies to v1.62.2 ([#2506](https://github.com/googleapis/sdk-platform-java/issues/2506)) ([f438603](https://github.com/googleapis/sdk-platform-java/commit/f4386038766c2381e141d7073959cc6bde896efb)) + + +### Documentation + +* Add contribution guidelines. ([#2045](https://github.com/googleapis/sdk-platform-java/issues/2045)) ([9939b43](https://github.com/googleapis/sdk-platform-java/commit/9939b43dce041c75405cea66a0dde171d991d3eb)) + ## [2.35.0](https://github.com/googleapis/sdk-platform-java/compare/v2.34.0...v2.35.0) (2024-02-13) diff --git a/WORKSPACE b/WORKSPACE index 9d178ad9a8..87c270e6aa 100644 --- a/WORKSPACE +++ b/WORKSPACE @@ -60,7 +60,7 @@ maven_install( repositories = ["https://repo.maven.apache.org/maven2/"], ) -_gapic_generator_java_version = "2.35.1-SNAPSHOT" # {x-version-update:gapic-generator-java:current} +_gapic_generator_java_version = "2.37.1-SNAPSHOT" # {x-version-update:gapic-generator-java:current} maven_install( artifacts = [ diff --git a/api-common-java/pom.xml b/api-common-java/pom.xml index 1cee861f26..502c56a8d0 100644 --- a/api-common-java/pom.xml +++ b/api-common-java/pom.xml @@ -5,14 +5,14 @@ com.google.api api-common jar - 2.26.1-SNAPSHOT + 2.28.1-SNAPSHOT API Common Common utilities for Google APIs in Java com.google.api gapic-generator-java-pom-parent - 2.35.1-SNAPSHOT + 2.37.1-SNAPSHOT ../gapic-generator-java-pom-parent @@ -77,7 +77,7 @@ com.google.truth truth - 1.2.0 + 1.4.2 test diff --git a/api-common-java/src/main/java/com/google/api/core/ApiFutures.java b/api-common-java/src/main/java/com/google/api/core/ApiFutures.java index 4c263ce845..780c50a783 100644 --- a/api-common-java/src/main/java/com/google/api/core/ApiFutures.java +++ b/api-common-java/src/main/java/com/google/api/core/ApiFutures.java @@ -161,7 +161,6 @@ public static ApiFuture catching( * callback} * @see Futures#catchingAsync(ListenableFuture, Class, AsyncFunction, Executor) */ - @BetaApi public static ApiFuture catchingAsync( ApiFuture input, Class exceptionType, diff --git a/api-common-java/src/main/java/com/google/api/core/ApiService.java b/api-common-java/src/main/java/com/google/api/core/ApiService.java index ee49e78f3c..cd3545d8b9 100644 --- a/api-common-java/src/main/java/com/google/api/core/ApiService.java +++ b/api-common-java/src/main/java/com/google/api/core/ApiService.java @@ -165,7 +165,6 @@ public interface ApiService { * {@code A.compareTo(B) < 0} then there is not guaranteed to be a valid state transition * {@code A -> B}. */ - @BetaApi enum State { /** * A service in this state has encountered a problem and may not be operational. It cannot be @@ -198,7 +197,6 @@ enum State { * *

All methods are no-ops by default, implementors should override the ones they care about. */ - @BetaApi abstract class Listener { /** * Called when the service transitions to the {@linkplain State#FAILED FAILED} state. The diff --git a/coverage-report/pom.xml b/coverage-report/pom.xml index 72b712ed06..d27157fcc0 100644 --- a/coverage-report/pom.xml +++ b/coverage-report/pom.xml @@ -31,22 +31,22 @@ com.google.api gax - 2.43.1-SNAPSHOT + 2.45.1-SNAPSHOT com.google.api gax-grpc - 2.43.1-SNAPSHOT + 2.45.1-SNAPSHOT com.google.api gax-httpjson - 2.43.1-SNAPSHOT + 2.45.1-SNAPSHOT com.google.api api-common - 2.26.1-SNAPSHOT + 2.28.1-SNAPSHOT diff --git a/gapic-generator-java-bom/pom.xml b/gapic-generator-java-bom/pom.xml index e0f21fb910..026e0b016b 100644 --- a/gapic-generator-java-bom/pom.xml +++ b/gapic-generator-java-bom/pom.xml @@ -4,7 +4,7 @@ com.google.api gapic-generator-java-bom pom - 2.35.1-SNAPSHOT + 2.37.1-SNAPSHOT GAPIC Generator Java BOM BOM for the libraries in gapic-generator-java repository. Users should not @@ -15,7 +15,7 @@ com.google.api gapic-generator-java-pom-parent - 2.35.1-SNAPSHOT + 2.37.1-SNAPSHOT ../gapic-generator-java-pom-parent @@ -75,61 +75,61 @@ com.google.api api-common - 2.26.1-SNAPSHOT + 2.28.1-SNAPSHOT com.google.api gax-bom - 2.43.1-SNAPSHOT + 2.45.1-SNAPSHOT pom import com.google.api gapic-generator-java - 2.35.1-SNAPSHOT + 2.37.1-SNAPSHOT com.google.api.grpc grpc-google-common-protos - 2.34.1-SNAPSHOT + 2.36.1-SNAPSHOT com.google.api.grpc proto-google-common-protos - 2.34.1-SNAPSHOT + 2.36.1-SNAPSHOT com.google.api.grpc proto-google-iam-v1 - 1.29.1-SNAPSHOT + 1.31.1-SNAPSHOT com.google.api.grpc proto-google-iam-v2 - 1.29.1-SNAPSHOT + 1.31.1-SNAPSHOT com.google.api.grpc proto-google-iam-v2beta - 1.29.1-SNAPSHOT + 1.31.1-SNAPSHOT com.google.api.grpc grpc-google-iam-v1 - 1.29.1-SNAPSHOT + 1.31.1-SNAPSHOT com.google.api.grpc grpc-google-iam-v2 - 1.29.1-SNAPSHOT + 1.31.1-SNAPSHOT com.google.api.grpc grpc-google-iam-v2beta - 1.29.1-SNAPSHOT + 1.31.1-SNAPSHOT diff --git a/gapic-generator-java-pom-parent/pom.xml b/gapic-generator-java-pom-parent/pom.xml index 5154540493..d4529348c7 100644 --- a/gapic-generator-java-pom-parent/pom.xml +++ b/gapic-generator-java-pom-parent/pom.xml @@ -5,7 +5,7 @@ 4.0.0 com.google.api gapic-generator-java-pom-parent - 2.35.1-SNAPSHOT + 2.37.1-SNAPSHOT pom GAPIC Generator Java POM Parent https://github.com/googleapis/sdk-platform-java @@ -15,7 +15,7 @@ com.google.cloud google-cloud-shared-config - 1.7.1 + 1.7.4 @@ -26,7 +26,7 @@ 1.3.2 - 1.61.1 + 1.62.2 1.23.0 1.44.1 2.10.1 @@ -177,6 +177,23 @@ + + envVarTest + + + + org.apache.maven.plugins + maven-surefire-plugin + + + + **/*.java + + + + + + diff --git a/gapic-generator-java/pom.xml b/gapic-generator-java/pom.xml index 757862fa37..f4128af38d 100644 --- a/gapic-generator-java/pom.xml +++ b/gapic-generator-java/pom.xml @@ -4,7 +4,7 @@ 4.0.0 com.google.api gapic-generator-java - 2.35.1-SNAPSHOT + 2.37.1-SNAPSHOT GAPIC Generator Java GAPIC generator Java @@ -22,7 +22,7 @@ com.google.api gapic-generator-java-pom-parent - 2.35.1-SNAPSHOT + 2.37.1-SNAPSHOT ../gapic-generator-java-pom-parent @@ -31,7 +31,7 @@ com.google.api gapic-generator-java-bom - 2.35.1-SNAPSHOT + 2.37.1-SNAPSHOT pom import @@ -351,7 +351,7 @@ org.apache.maven.plugins maven-shade-plugin - 3.5.1 + 3.5.2 package @@ -467,7 +467,7 @@ com.google.truth truth - 1.2.0 + 1.4.2 test diff --git a/gapic-generator-java/src/main/java/com/google/api/generator/gapic/composer/common/AbstractServiceClientClassComposer.java b/gapic-generator-java/src/main/java/com/google/api/generator/gapic/composer/common/AbstractServiceClientClassComposer.java index 987cd9adc8..5f8456aa97 100644 --- a/gapic-generator-java/src/main/java/com/google/api/generator/gapic/composer/common/AbstractServiceClientClassComposer.java +++ b/gapic-generator-java/src/main/java/com/google/api/generator/gapic/composer/common/AbstractServiceClientClassComposer.java @@ -839,13 +839,6 @@ private static MethodDefinition createMethodDefaultMethod( .copyAndSetGenerics( Arrays.asList( lro.responseType().reference(), lro.metadataType().reference()))); - if (method.lro().operationServiceStubType() != null) { - annotations.add( - AnnotationNode.withTypeAndDescription( - typeStore.get("BetaApi"), - "The surface for long-running operations is not stable yet and may change in the" - + " future.")); - } } // Construct the method that accepts a request proto. diff --git a/gapic-generator-java/src/main/java/com/google/api/generator/gapic/composer/common/AbstractServiceStubClassComposer.java b/gapic-generator-java/src/main/java/com/google/api/generator/gapic/composer/common/AbstractServiceStubClassComposer.java index c9835c69e4..cb06d34303 100644 --- a/gapic-generator-java/src/main/java/com/google/api/generator/gapic/composer/common/AbstractServiceStubClassComposer.java +++ b/gapic-generator-java/src/main/java/com/google/api/generator/gapic/composer/common/AbstractServiceStubClassComposer.java @@ -235,7 +235,7 @@ private List createLongRunningClientGetters(TypeStore typeStor createCallableGetterMethodDefinition( TypeNode.withReference(ConcreteReference.withClazz(LongRunningClient.class)), "longRunningClient", - ImmutableList.of(AnnotationNode.withType(typeStore.get("BetaApi"))), + Collections.emptyList(), typeStore)); } diff --git a/gapic-generator-java/src/main/java/com/google/api/generator/gapic/composer/common/AbstractServiceStubSettingsClassComposer.java b/gapic-generator-java/src/main/java/com/google/api/generator/gapic/composer/common/AbstractServiceStubSettingsClassComposer.java index 4c7bf86f8c..a64992df89 100644 --- a/gapic-generator-java/src/main/java/com/google/api/generator/gapic/composer/common/AbstractServiceStubSettingsClassComposer.java +++ b/gapic-generator-java/src/main/java/com/google/api/generator/gapic/composer/common/AbstractServiceStubSettingsClassComposer.java @@ -2023,13 +2023,6 @@ private static List createNestedClassSettingsBuilderGetterMeth t.reference() .copyAndSetGenerics(ImmutableList.of()) .equals(operationCallSettingsBuilderRef); - AnnotationNode lroBetaAnnotation = - AnnotationNode.builder() - .setType(FIXED_TYPESTORE.get("BetaApi")) - .setDescription( - "The surface for use by generated code is not stable yet and may change in the" - + " future.") - .build(); AnnotationNode deprecatedAnnotation = AnnotationNode.withType(TypeNode.DEPRECATED); List javaMethods = new ArrayList<>(); @@ -2037,13 +2030,7 @@ private static List createNestedClassSettingsBuilderGetterMeth nestedMethodSettingsMemberVarExprs.entrySet()) { String varName = settingsVarEntry.getKey(); VariableExpr settingsVarExpr = settingsVarEntry.getValue(); - boolean isOperationCallSettings = - isOperationCallSettingsBuilderFn.apply(settingsVarExpr.type()); - List annotations = new ArrayList<>(); - if (isOperationCallSettings) { - annotations.add(lroBetaAnnotation); - } boolean isDeprecated = nestedDeprecatedSettingVarNames.contains(varName); if (isDeprecated) { diff --git a/gapic-generator-java/src/main/java/com/google/api/generator/gapic/composer/resourcename/ResourceNameHelperClassComposer.java b/gapic-generator-java/src/main/java/com/google/api/generator/gapic/composer/resourcename/ResourceNameHelperClassComposer.java index b558a9d715..73529ab21c 100644 --- a/gapic-generator-java/src/main/java/com/google/api/generator/gapic/composer/resourcename/ResourceNameHelperClassComposer.java +++ b/gapic-generator-java/src/main/java/com/google/api/generator/gapic/composer/resourcename/ResourceNameHelperClassComposer.java @@ -14,7 +14,6 @@ package com.google.api.generator.gapic.composer.resourcename; -import com.google.api.core.BetaApi; import com.google.api.generator.engine.ast.AnnotationNode; import com.google.api.generator.engine.ast.AssignmentExpr; import com.google.api.generator.engine.ast.AssignmentOperationExpr; @@ -60,7 +59,6 @@ import com.google.common.collect.ImmutableMap; import java.util.ArrayList; import java.util.Arrays; -import java.util.Collections; import java.util.HashMap; import java.util.Iterator; import java.util.LinkedHashSet; @@ -503,13 +501,6 @@ private static List createBuilderCreatorMethods( ResourceName resourceName, List> tokenHierarchies, TypeStore typeStore) { List javaMethods = new ArrayList<>(); String newMethodNameFormat = "new%s"; - AnnotationNode betaAnnotation = - AnnotationNode.builder() - .setType(FIXED_TYPESTORE.get("BetaApi")) - .setDescription( - "The per-pattern Builders are not stable yet and may be changed in the future.") - .build(); - List annotations = Arrays.asList(betaAnnotation); // Create the newBuilder and variation methods here. // Variation example: newProjectLocationAutoscalingPolicyBuilder(). @@ -533,17 +524,13 @@ private static List createBuilderCreatorMethods( String variantName = getBuilderTypeName(tokenHierarchies, i); javaMethods.add( - methodDefStarterFn - .apply(String.format(newMethodNameFormat, variantName)) - .setAnnotations(i == 0 ? Collections.emptyList() : annotations) - .build()); + methodDefStarterFn.apply(String.format(newMethodNameFormat, variantName)).build()); if (i == 0 && tokenHierarchies.size() > 1) { // Create another builder creator method, but with the per-variant name. javaMethods.add( methodDefStarterFn .apply( String.format(newMethodNameFormat, getBuilderTypeName(tokenHierarchies.get(i)))) - .setAnnotations(annotations) .build()); } } @@ -597,15 +584,6 @@ private static List createOfOrFormatMethodHelper( String setMethodNameFormat = "set%s"; String buildMethodName = "build"; String toStringMethodName = "toString"; - AnnotationNode betaAnnotation = - AnnotationNode.builder() - .setType(FIXED_TYPESTORE.get("BetaApi")) - .setDescription( - String.format( - "The static %s methods are not stable yet and may be changed in the future.", - isFormatMethod ? "format" : "create")) - .build(); - List annotations = Arrays.asList(betaAnnotation); TypeNode thisClassType = typeStore.get(getThisClassName(resourceName)); TypeNode returnType = isFormatMethod ? TypeNode.STRING : thisClassType; @@ -624,7 +602,6 @@ private static List createOfOrFormatMethodHelper( MethodDefinition.builder() .setScope(ScopeNode.PUBLIC) .setIsStatic(true) - .setAnnotations(annotations) .setReturnType(returnType) .setName( String.format(methodNameFormat, concatToUpperCamelCaseName(tokens) + "Name")) @@ -682,7 +659,6 @@ private static List createOfOrFormatMethodHelper( MethodDefinition.builder() .setScope(ScopeNode.PUBLIC) .setIsStatic(true) - .setAnnotations(i == 0 ? Collections.emptyList() : annotations) .setReturnType(returnType) .setName( String.format( @@ -696,7 +672,6 @@ private static List createOfOrFormatMethodHelper( MethodDefinition.builder() .setScope(ScopeNode.PUBLIC) .setIsStatic(true) - .setAnnotations(annotations) .setReturnType(returnType) .setName( String.format( @@ -1701,21 +1676,12 @@ private static ClassDefinition createNestedBuilderClass( nestedClassMethods.add(buildMethod); // Return the class. - AnnotationNode betaAnnotation = - AnnotationNode.builder() - .setType(FIXED_TYPESTORE.get("BetaApi")) - .setDescription( - "The per-pattern Builders are not stable yet and may be changed in the future.") - .build(); - List classAnnotations = - isDefaultClass ? Collections.emptyList() : Arrays.asList(betaAnnotation); return ClassDefinition.builder() .setHeaderCommentStatements( CommentStatement.withComment( JavaDocComment.withComment( String.format(BUILDER_CLASS_HEADER_PATTERN, resourceNamePattern)))) - .setAnnotations(classAnnotations) .setIsNested(true) .setScope(ScopeNode.PUBLIC) .setIsStatic(true) @@ -1729,7 +1695,6 @@ private static TypeStore createStaticTypes() { List> concreteClazzes = Arrays.asList( ArrayList.class, - BetaApi.class, Generated.class, ImmutableMap.class, List.class, diff --git a/gapic-generator-java/src/main/java/com/google/api/generator/gapic/composer/rest/HttpJsonServiceCallableFactoryClassComposer.java b/gapic-generator-java/src/main/java/com/google/api/generator/gapic/composer/rest/HttpJsonServiceCallableFactoryClassComposer.java index 9a973a2b76..af70ab9208 100644 --- a/gapic-generator-java/src/main/java/com/google/api/generator/gapic/composer/rest/HttpJsonServiceCallableFactoryClassComposer.java +++ b/gapic-generator-java/src/main/java/com/google/api/generator/gapic/composer/rest/HttpJsonServiceCallableFactoryClassComposer.java @@ -18,7 +18,6 @@ import com.google.api.gax.httpjson.HttpJsonOperationSnapshotCallable; import com.google.api.gax.rpc.OperationCallable; import com.google.api.gax.rpc.UnaryCallable; -import com.google.api.generator.engine.ast.AnnotationNode; import com.google.api.generator.engine.ast.AssignmentExpr; import com.google.api.generator.engine.ast.ConcreteReference; import com.google.api.generator.engine.ast.ExprStatement; @@ -36,6 +35,7 @@ import com.google.longrunning.Operation; import java.util.ArrayList; import java.util.Arrays; +import java.util.Collections; import java.util.List; import java.util.stream.Collectors; @@ -55,20 +55,6 @@ public static HttpJsonServiceCallableFactoryClassComposer instance() { return INSTANCE; } - @Override - protected List createClassAnnotations(Service service, TypeStore typeStore) { - List annotations = super.createClassAnnotations(service, typeStore); - // Always add @BetaApi annotation to the generated CallableFactory for now. It is a public class - // for technical reasons, end users are not expected to interact with it, but it may change - // when we add LRO support, that is why making it @BetaApi for now. - // - // Remove the @BetaApi annotation once the LRO feature is fully implemented and stabilized. - if (annotations.stream().noneMatch(a -> a.type().equals(typeStore.get("BetaApi")))) { - annotations.add(AnnotationNode.withType(typeStore.get("BetaApi"))); - } - return annotations; - } - @Override protected List createClassImplements(Service service, TypeStore typeStore) { TypeNode operationsStubType = getOperationsStubType(service); @@ -104,16 +90,6 @@ protected MethodDefinition createOperationCallableMethod(Service service, TypeSt List methodTemplateNames = Arrays.asList(requestTemplateName, responseTemplateName, "MetadataT"); - // Always add @BetaApi annotation to the generated createOperationCallable() method for now, - // until LRO is fully implemented. - // - // Remove the @BetaApi annotation once the LRO feature is fully implemented and stabilized. - AnnotationNode betaAnnotation = - AnnotationNode.withTypeAndDescription( - typeStore.get("BetaApi"), - "The surface for long-running operations is not stable yet and may change in the" - + " future."); - // Generate generic method without the body TypeNode operationType = service.operationType(); if (operationType == null) { @@ -133,7 +109,7 @@ protected MethodDefinition createOperationCallableMethod(Service service, TypeSt /*callSettingsTemplateObjects=*/ methodTemplateNames.stream() .map(n -> (Object) n) .collect(Collectors.toList()), - Arrays.asList(betaAnnotation)); + Collections.emptyList()); List createOperationCallableBody = new ArrayList<>(); List arguments = new ArrayList<>(method.arguments()); diff --git a/gapic-generator-java/src/test/java/com/google/api/generator/gapic/composer/grpc/goldens/EchoStubSettings.golden b/gapic-generator-java/src/test/java/com/google/api/generator/gapic/composer/grpc/goldens/EchoStubSettings.golden index 597ed4d3ba..aea2307b7f 100644 --- a/gapic-generator-java/src/test/java/com/google/api/generator/gapic/composer/grpc/goldens/EchoStubSettings.golden +++ b/gapic-generator-java/src/test/java/com/google/api/generator/gapic/composer/grpc/goldens/EchoStubSettings.golden @@ -620,8 +620,6 @@ public class EchoStubSettings extends StubSettings { } /** Returns the builder for the settings used for calls to wait. */ - @BetaApi( - "The surface for use by generated code is not stable yet and may change in the future.") public OperationCallSettings.Builder waitOperationSettings() { return waitOperationSettings; diff --git a/gapic-generator-java/src/test/java/com/google/api/generator/gapic/composer/grpcrest/goldens/EchoStubSettings.golden b/gapic-generator-java/src/test/java/com/google/api/generator/gapic/composer/grpcrest/goldens/EchoStubSettings.golden index 5cade6cd1b..6b8181e8a0 100644 --- a/gapic-generator-java/src/test/java/com/google/api/generator/gapic/composer/grpcrest/goldens/EchoStubSettings.golden +++ b/gapic-generator-java/src/test/java/com/google/api/generator/gapic/composer/grpcrest/goldens/EchoStubSettings.golden @@ -659,8 +659,6 @@ public class EchoStubSettings extends StubSettings { } /** Returns the builder for the settings used for calls to wait. */ - @BetaApi( - "The surface for use by generated code is not stable yet and may change in the future.") public OperationCallSettings.Builder waitOperationSettings() { return waitOperationSettings; diff --git a/gapic-generator-java/src/test/java/com/google/api/generator/gapic/composer/grpcrest/goldens/HttpJsonEchoCallableFactory.golden b/gapic-generator-java/src/test/java/com/google/api/generator/gapic/composer/grpcrest/goldens/HttpJsonEchoCallableFactory.golden index 3996e0747e..5da8337d63 100644 --- a/gapic-generator-java/src/test/java/com/google/api/generator/gapic/composer/grpcrest/goldens/HttpJsonEchoCallableFactory.golden +++ b/gapic-generator-java/src/test/java/com/google/api/generator/gapic/composer/grpcrest/goldens/HttpJsonEchoCallableFactory.golden @@ -57,8 +57,6 @@ public class HttpJsonEchoCallableFactory httpJsonCallSettings, callSettings, clientContext); } - @BetaApi( - "The surface for long-running operations is not stable yet and may change in the future.") @Override public OperationCallable createOperationCallable( diff --git a/gapic-generator-java/src/test/java/com/google/api/generator/gapic/composer/resourcename/goldens/AgentName.golden b/gapic-generator-java/src/test/java/com/google/api/generator/gapic/composer/resourcename/goldens/AgentName.golden index 7b73d8c9c4..2eb43f4f39 100644 --- a/gapic-generator-java/src/test/java/com/google/api/generator/gapic/composer/resourcename/goldens/AgentName.golden +++ b/gapic-generator-java/src/test/java/com/google/api/generator/gapic/composer/resourcename/goldens/AgentName.golden @@ -1,6 +1,5 @@ package com.google.cloud.dialogflow.v2beta1; -import com.google.api.core.BetaApi; import com.google.api.pathtemplate.PathTemplate; import com.google.api.pathtemplate.ValidationException; import com.google.api.resourcenames.ResourceName; @@ -55,12 +54,10 @@ public class AgentName implements ResourceName { return new Builder(); } - @BetaApi("The per-pattern Builders are not stable yet and may be changed in the future.") public static Builder newProjectLocationBuilder() { return new Builder(); } - @BetaApi("The per-pattern Builders are not stable yet and may be changed in the future.") public static ProjectBuilder newProjectBuilder() { return new ProjectBuilder(); } @@ -73,12 +70,10 @@ public class AgentName implements ResourceName { return newBuilder().setProject(project).setLocation(location).build(); } - @BetaApi("The static create methods are not stable yet and may be changed in the future.") public static AgentName ofProjectLocationName(String project, String location) { return newBuilder().setProject(project).setLocation(location).build(); } - @BetaApi("The static create methods are not stable yet and may be changed in the future.") public static AgentName ofProjectName(String project) { return newProjectBuilder().setProject(project).build(); } @@ -87,12 +82,10 @@ public class AgentName implements ResourceName { return newBuilder().setProject(project).setLocation(location).build().toString(); } - @BetaApi("The static format methods are not stable yet and may be changed in the future.") public static String formatProjectLocationName(String project, String location) { return newBuilder().setProject(project).setLocation(location).build().toString(); } - @BetaApi("The static format methods are not stable yet and may be changed in the future.") public static String formatProjectName(String project) { return newProjectBuilder().setProject(project).build().toString(); } @@ -227,7 +220,6 @@ public class AgentName implements ResourceName { } /** Builder for projects/{project}/agent. */ - @BetaApi("The per-pattern Builders are not stable yet and may be changed in the future.") public static class ProjectBuilder { private String project; diff --git a/gapic-generator-java/src/test/java/com/google/api/generator/gapic/composer/resourcename/goldens/FoobarName.golden b/gapic-generator-java/src/test/java/com/google/api/generator/gapic/composer/resourcename/goldens/FoobarName.golden index 7a96c37d77..4dcf36186a 100644 --- a/gapic-generator-java/src/test/java/com/google/api/generator/gapic/composer/resourcename/goldens/FoobarName.golden +++ b/gapic-generator-java/src/test/java/com/google/api/generator/gapic/composer/resourcename/goldens/FoobarName.golden @@ -1,6 +1,5 @@ package com.google.showcase.v1beta1; -import com.google.api.core.BetaApi; import com.google.api.pathtemplate.PathTemplate; import com.google.api.pathtemplate.ValidationException; import com.google.api.resourcenames.ResourceName; @@ -92,22 +91,18 @@ public class FoobarName implements ResourceName { return new Builder(); } - @BetaApi("The per-pattern Builders are not stable yet and may be changed in the future.") public static Builder newProjectFoobarBuilder() { return new Builder(); } - @BetaApi("The per-pattern Builders are not stable yet and may be changed in the future.") public static ProjectVariantFoobarBuilder newProjectVariantFoobarBuilder() { return new ProjectVariantFoobarBuilder(); } - @BetaApi("The per-pattern Builders are not stable yet and may be changed in the future.") public static FoobarBuilder newFoobarBuilder() { return new FoobarBuilder(); } - @BetaApi("The per-pattern Builders are not stable yet and may be changed in the future.") public static BarFooFoobarBuilder newBarFooFoobarBuilder() { return new BarFooFoobarBuilder(); } @@ -120,12 +115,10 @@ public class FoobarName implements ResourceName { return newBuilder().setProject(project).setFoobar(foobar).build(); } - @BetaApi("The static create methods are not stable yet and may be changed in the future.") public static FoobarName ofProjectFoobarName(String project, String foobar) { return newBuilder().setProject(project).setFoobar(foobar).build(); } - @BetaApi("The static create methods are not stable yet and may be changed in the future.") public static FoobarName ofProjectVariantFoobarName( String project, String variant, String foobar) { return newProjectVariantFoobarBuilder() @@ -135,12 +128,10 @@ public class FoobarName implements ResourceName { .build(); } - @BetaApi("The static create methods are not stable yet and may be changed in the future.") public static FoobarName ofFoobarName(String foobar) { return newFoobarBuilder().setFoobar(foobar).build(); } - @BetaApi("The static create methods are not stable yet and may be changed in the future.") public static FoobarName ofBarFooFoobarName(String barFoo, String foobar) { return newBarFooFoobarBuilder().setBarFoo(barFoo).setFoobar(foobar).build(); } @@ -149,12 +140,10 @@ public class FoobarName implements ResourceName { return newBuilder().setProject(project).setFoobar(foobar).build().toString(); } - @BetaApi("The static format methods are not stable yet and may be changed in the future.") public static String formatProjectFoobarName(String project, String foobar) { return newBuilder().setProject(project).setFoobar(foobar).build().toString(); } - @BetaApi("The static format methods are not stable yet and may be changed in the future.") public static String formatProjectVariantFoobarName( String project, String variant, String foobar) { return newProjectVariantFoobarBuilder() @@ -165,12 +154,10 @@ public class FoobarName implements ResourceName { .toString(); } - @BetaApi("The static format methods are not stable yet and may be changed in the future.") public static String formatFoobarName(String foobar) { return newFoobarBuilder().setFoobar(foobar).build().toString(); } - @BetaApi("The static format methods are not stable yet and may be changed in the future.") public static String formatBarFooFoobarName(String barFoo, String foobar) { return newBarFooFoobarBuilder().setBarFoo(barFoo).setFoobar(foobar).build().toString(); } @@ -327,7 +314,6 @@ public class FoobarName implements ResourceName { } /** Builder for projects/{project}/chocolate/variants/{variant}/foobars/{foobar}. */ - @BetaApi("The per-pattern Builders are not stable yet and may be changed in the future.") public static class ProjectVariantFoobarBuilder { private String project; private String variant; @@ -368,7 +354,6 @@ public class FoobarName implements ResourceName { } /** Builder for foobars/{foobar}. */ - @BetaApi("The per-pattern Builders are not stable yet and may be changed in the future.") public static class FoobarBuilder { private String foobar; @@ -389,7 +374,6 @@ public class FoobarName implements ResourceName { } /** Builder for bar_foos/{bar_foo}/foobars/{foobar}. */ - @BetaApi("The per-pattern Builders are not stable yet and may be changed in the future.") public static class BarFooFoobarBuilder { private String barFoo; private String foobar; diff --git a/gapic-generator-java/src/test/java/com/google/api/generator/gapic/composer/rest/goldens/HttpJsonComplianceCallableFactory.golden b/gapic-generator-java/src/test/java/com/google/api/generator/gapic/composer/rest/goldens/HttpJsonComplianceCallableFactory.golden index 6e9ff65f91..25f9086a13 100644 --- a/gapic-generator-java/src/test/java/com/google/api/generator/gapic/composer/rest/goldens/HttpJsonComplianceCallableFactory.golden +++ b/gapic-generator-java/src/test/java/com/google/api/generator/gapic/composer/rest/goldens/HttpJsonComplianceCallableFactory.golden @@ -57,8 +57,6 @@ public class HttpJsonComplianceCallableFactory httpJsonCallSettings, callSettings, clientContext); } - @BetaApi( - "The surface for long-running operations is not stable yet and may change in the future.") @Override public OperationCallable createOperationCallable( diff --git a/gax-java/README.md b/gax-java/README.md index 4414ab4722..92b910cc8c 100644 --- a/gax-java/README.md +++ b/gax-java/README.md @@ -34,27 +34,27 @@ If you are using Maven, add this to your pom.xml file com.google.api gax - 2.43.0 + 2.45.0 com.google.api gax-grpc - 2.43.0 + 2.45.0 ``` If you are using Gradle, add this to your dependencies ```Groovy -compile 'com.google.api:gax:2.43.0', - 'com.google.api:gax-grpc:2.43.0' +compile 'com.google.api:gax:2.45.0', + 'com.google.api:gax-grpc:2.45.0' ``` If you are using SBT, add this to your dependencies ```Scala -libraryDependencies += "com.google.api" % "gax" % "2.43.0" -libraryDependencies += "com.google.api" % "gax-grpc" % "2.43.0" +libraryDependencies += "com.google.api" % "gax" % "2.45.0" +libraryDependencies += "com.google.api" % "gax-grpc" % "2.45.0" ``` [//]: # ({x-version-update-end}) diff --git a/gax-java/dependencies.properties b/gax-java/dependencies.properties index 73d27a6eb7..5cb17321ed 100644 --- a/gax-java/dependencies.properties +++ b/gax-java/dependencies.properties @@ -8,16 +8,16 @@ # Versions of oneself # {x-version-update-start:gax:current} -version.gax=2.43.1-SNAPSHOT +version.gax=2.45.1-SNAPSHOT # {x-version-update-end} # {x-version-update-start:gax:current} -version.gax_grpc=2.43.1-SNAPSHOT +version.gax_grpc=2.45.1-SNAPSHOT # {x-version-update-end} # {x-version-update-start:gax:current} -version.gax_bom=2.43.1-SNAPSHOT +version.gax_bom=2.45.1-SNAPSHOT # {x-version-update-end} # {x-version-update-start:gax:current} -version.gax_httpjson=2.43.1-SNAPSHOT +version.gax_httpjson=2.45.1-SNAPSHOT # {x-version-update-end} # Versions for dependencies which actual artifacts differ between Bazel and Gradle. @@ -28,32 +28,32 @@ version.gax_httpjson=2.43.1-SNAPSHOT version.com_google_protobuf=3.25.2 version.google_java_format=1.15.0 -version.io_grpc=1.61.1 +version.io_grpc=1.62.2 # Maven artifacts. # Note, the actual name of each property matters (bazel build scripts depend on it). # It should be constructed the following way: # 1) Take full artifact id (including the group and classifier (if any) portions) and remove version portion. # 2) Replace all characters which are neither alphabetic nor digits with the underscore ('_') character -maven.com_google_api_grpc_proto_google_common_protos=com.google.api.grpc:proto-google-common-protos:2.33.0 -maven.com_google_api_grpc_grpc_google_common_protos=com.google.api.grpc:grpc-google-common-protos:2.33.0 +maven.com_google_api_grpc_proto_google_common_protos=com.google.api.grpc:proto-google-common-protos:2.34.0 +maven.com_google_api_grpc_grpc_google_common_protos=com.google.api.grpc:grpc-google-common-protos:2.34.0 maven.com_google_auth_google_auth_library_oauth2_http=com.google.auth:google-auth-library-oauth2-http:1.23.0 maven.com_google_auth_google_auth_library_credentials=com.google.auth:google-auth-library-credentials:1.23.0 maven.io_opencensus_opencensus_api=io.opencensus:opencensus-api:0.31.1 maven.io_opencensus_opencensus_contrib_grpc_metrics=io.opencensus:opencensus-contrib-grpc-metrics:0.31.1 maven.io_opencensus_opencensus_contrib_http_util=io.opencensus:opencensus-contrib-http-util:0.31.1 -maven.io_netty_netty_tcnative_boringssl_static=io.netty:netty-tcnative-boringssl-static:2.0.62.Final -maven.io_netty_netty_handler=io.netty:netty-handler:4.1.105.Final -maven.io_netty_netty_common=io.netty:netty-common:4.1.105.Final -maven.io_netty_netty_codec_socks=io.netty:netty-codec-socks:4.1.105.Final -maven.io_netty_netty_codec_http2=io.netty:netty-codec-http2:4.1.105.Final -maven.io_netty_netty_codec_http=io.netty:netty-codec-http:4.1.105.Final -maven.io_netty_netty_codec=io.netty:netty-codec:4.1.105.Final -maven.io_netty_netty_buffer=io.netty:netty-buffer:4.1.105.Final -maven.io_netty_netty_resolver=io.netty:netty-resolver:4.1.105.Final -maven.io_netty_netty_transport=io.netty:netty-transport:4.1.105.Final -maven.io_netty_netty_handler_proxy=io.netty:netty-handler-proxy:4.1.105.Final -maven.io_netty_netty_transport_native_unix_common=io.netty:netty-transport-native-unix-common:4.1.105.Final +maven.io_netty_netty_tcnative_boringssl_static=io.netty:netty-tcnative-boringssl-static:2.0.63.Final +maven.io_netty_netty_handler=io.netty:netty-handler:4.1.107.Final +maven.io_netty_netty_common=io.netty:netty-common:4.1.107.Final +maven.io_netty_netty_codec_socks=io.netty:netty-codec-socks:4.1.107.Final +maven.io_netty_netty_codec_http2=io.netty:netty-codec-http2:4.1.107.Final +maven.io_netty_netty_codec_http=io.netty:netty-codec-http:4.1.107.Final +maven.io_netty_netty_codec=io.netty:netty-codec:4.1.107.Final +maven.io_netty_netty_buffer=io.netty:netty-buffer:4.1.107.Final +maven.io_netty_netty_resolver=io.netty:netty-resolver:4.1.107.Final +maven.io_netty_netty_transport=io.netty:netty-transport:4.1.107.Final +maven.io_netty_netty_handler_proxy=io.netty:netty-handler-proxy:4.1.107.Final +maven.io_netty_netty_transport_native_unix_common=io.netty:netty-transport-native-unix-common:4.1.107.Final maven.io_perfmark_perfmark_api=io.perfmark:perfmark-api:0.27.0 maven.org_apache_tomcat_annotations_api=org.apache.tomcat:annotations-api:6.0.53 maven.com_google_code_gson_gson=com.google.code.gson:gson:2.10.1 @@ -66,21 +66,21 @@ maven.com_google_errorprone_error_prone_annotations=com.google.errorprone:error_ maven.com_google_j2objc_j2objc_annotations=com.google.j2objc:j2objc-annotations:2.8 maven.com_google_auto_value_auto_value=com.google.auto.value:auto-value:1.10.4 maven.com_google_auto_value_auto_value_annotations=com.google.auto.value:auto-value-annotations:1.10.4 -maven.com_google_api_api_common=com.google.api:api-common:2.25.0 +maven.com_google_api_api_common=com.google.api:api-common:2.26.0 maven.org_threeten_threetenbp=org.threeten:threetenbp:1.6.8 -maven.com_google_api_grpc_grpc_google_iam_v1=com.google.api.grpc:grpc-google-iam-v1:1.28.0 -maven.com_google_api_grpc_proto_google_iam_v1=com.google.api.grpc:proto-google-iam-v1:1.28.0 +maven.com_google_api_grpc_grpc_google_iam_v1=com.google.api.grpc:grpc-google-iam-v1:1.29.0 +maven.com_google_api_grpc_proto_google_iam_v1=com.google.api.grpc:proto-google-iam-v1:1.29.0 maven.com_google_http_client_google_http_client=com.google.http-client:google-http-client:1.44.1 maven.com_google_http_client_google_http_client_gson=com.google.http-client:google-http-client-gson:1.44.1 maven.org_codehaus_mojo_animal_sniffer_annotations=org.codehaus.mojo:animal-sniffer-annotations:1.23 maven.javax_annotation_javax_annotation_api=javax.annotation:javax.annotation-api:1.3.2 -maven.org_graalvm_sdk=org.graalvm.sdk:graal-sdk:22.3.3 +maven.org_graalvm_sdk=org.graalvm.sdk:graal-sdk:22.3.5 # Testing maven artifacts maven.junit_junit=junit:junit:4.13.2 maven.org_mockito_mockito_core=org.mockito:mockito-core:2.28.2 maven.org_hamcrest_hamcrest_core=org.hamcrest:hamcrest-core:1.3 -maven.com_google_truth_truth=com.google.truth:truth:1.2.0 +maven.com_google_truth_truth=com.google.truth:truth:1.4.2 maven.com_googlecode_java_diff_utils_diffutils=com.googlecode.java-diff-utils:diffutils:1.3.0 maven.net_bytebuddy_byte_buddy=net.bytebuddy:byte-buddy:1.14.12 maven.org_objenesis_objenesis=org.objenesis:objenesis:2.6 diff --git a/gax-java/gax-bom/pom.xml b/gax-java/gax-bom/pom.xml index fad06ff2cf..69a849f8fb 100644 --- a/gax-java/gax-bom/pom.xml +++ b/gax-java/gax-bom/pom.xml @@ -3,7 +3,7 @@ 4.0.0 com.google.api gax-bom - 2.43.1-SNAPSHOT + 2.45.1-SNAPSHOT pom GAX (Google Api eXtensions) for Java (BOM) Google Api eXtensions for Java (BOM) @@ -11,7 +11,7 @@ com.google.cloud google-cloud-shared-config - 1.7.1 + 1.7.4 @@ -43,55 +43,55 @@ com.google.api gax - 2.43.1-SNAPSHOT + 2.45.1-SNAPSHOT com.google.api gax - 2.43.1-SNAPSHOT + 2.45.1-SNAPSHOT test-jar testlib com.google.api gax - 2.43.1-SNAPSHOT + 2.45.1-SNAPSHOT testlib com.google.api gax-grpc - 2.43.1-SNAPSHOT + 2.45.1-SNAPSHOT com.google.api gax-grpc - 2.43.1-SNAPSHOT + 2.45.1-SNAPSHOT test-jar testlib com.google.api gax-grpc - 2.43.1-SNAPSHOT + 2.45.1-SNAPSHOT testlib com.google.api gax-httpjson - 2.43.1-SNAPSHOT + 2.45.1-SNAPSHOT com.google.api gax-httpjson - 2.43.1-SNAPSHOT + 2.45.1-SNAPSHOT test-jar testlib com.google.api gax-httpjson - 2.43.1-SNAPSHOT + 2.45.1-SNAPSHOT testlib diff --git a/gax-java/gax-grpc/pom.xml b/gax-java/gax-grpc/pom.xml index cabf96e9bf..c66b645a86 100644 --- a/gax-java/gax-grpc/pom.xml +++ b/gax-java/gax-grpc/pom.xml @@ -3,7 +3,7 @@ 4.0.0 gax-grpc - 2.43.1-SNAPSHOT + 2.45.1-SNAPSHOT jar GAX (Google Api eXtensions) for Java (gRPC) Google Api eXtensions for Java (gRPC) @@ -11,7 +11,7 @@ com.google.api gax-parent - 2.43.1-SNAPSHOT + 2.45.1-SNAPSHOT diff --git a/gax-java/gax-httpjson/pom.xml b/gax-java/gax-httpjson/pom.xml index b4504dcfcb..120ab765d7 100644 --- a/gax-java/gax-httpjson/pom.xml +++ b/gax-java/gax-httpjson/pom.xml @@ -3,7 +3,7 @@ 4.0.0 gax-httpjson - 2.43.1-SNAPSHOT + 2.45.1-SNAPSHOT jar GAX (Google Api eXtensions) for Java (HTTP JSON) Google Api eXtensions for Java (HTTP JSON) @@ -11,7 +11,7 @@ com.google.api gax-parent - 2.43.1-SNAPSHOT + 2.45.1-SNAPSHOT diff --git a/gax-java/gax/pom.xml b/gax-java/gax/pom.xml index 57fb6f5799..e56ebadb17 100644 --- a/gax-java/gax/pom.xml +++ b/gax-java/gax/pom.xml @@ -3,7 +3,7 @@ 4.0.0 gax - 2.43.1-SNAPSHOT + 2.45.1-SNAPSHOT jar GAX (Google Api eXtensions) for Java (Core) Google Api eXtensions for Java (Core) @@ -11,7 +11,7 @@ com.google.api gax-parent - 2.43.1-SNAPSHOT + 2.45.1-SNAPSHOT @@ -99,8 +99,27 @@ maven-surefire-plugin -Djava.util.logging.SimpleFormatter.format="%1$tY %1$tl:%1$tM:%1$tS.%1$tL %2$s %4$s: %5$s%6$s%n" + + !EndpointContextTest#endpointContextBuild_universeDomainEnvVarSet+endpointContextBuild_multipleUniverseDomainConfigurations_clientSettingsHasPriority + + + + envVarTest + + + + org.apache.maven.plugins + maven-surefire-plugin + + EndpointContextTest#endpointContextBuild_universeDomainEnvVarSet+endpointContextBuild_multipleUniverseDomainConfigurations_clientSettingsHasPriority + + + + + + \ No newline at end of file diff --git a/gax-java/gax/src/main/java/com/google/api/gax/batching/BatcherStats.java b/gax-java/gax/src/main/java/com/google/api/gax/batching/BatcherStats.java index 784af6f599..20b0f95954 100644 --- a/gax-java/gax/src/main/java/com/google/api/gax/batching/BatcherStats.java +++ b/gax-java/gax/src/main/java/com/google/api/gax/batching/BatcherStats.java @@ -31,7 +31,9 @@ import com.google.api.gax.rpc.ApiException; import com.google.api.gax.rpc.StatusCode.Code; +import com.google.common.base.Joiner; import com.google.common.base.MoreObjects; +import com.google.common.collect.EvictingQueue; import java.util.HashMap; import java.util.Iterator; import java.util.List; @@ -52,6 +54,21 @@ class BatcherStats { private final Map entryExceptionCounts = new HashMap<>(); private final Map entryStatusCounts = new HashMap<>(); + /** + * The maximum number of error messages that a Batcher instance will retain. By default, a Batcher + * instance will retain 50 entry error messages and 50 RPC error messages. This limit can be + * temporarily increased by setting the {@code com.google.api.gax.batching.errors.max-samples} + * system property. This should only be needed in very rare situations and should not be + * considered part of the public api. + */ + private final int MAX_ERROR_MSG_SAMPLES = + Integer.getInteger("com.google.api.gax.batching.errors.max-samples", 50); + + private final EvictingQueue sampleOfRpcErrors = + EvictingQueue.create(MAX_ERROR_MSG_SAMPLES); + private final EvictingQueue sampleOfEntryErrors = + EvictingQueue.create(MAX_ERROR_MSG_SAMPLES); + /** * Records the count of the exception and it's type when a complete batch failed to apply. * @@ -69,6 +86,8 @@ synchronized void recordBatchFailure(Throwable throwable) { requestStatusCounts.put(code, oldStatusCount + 1); } + sampleOfRpcErrors.add(throwable.toString()); + int oldExceptionCount = MoreObjects.firstNonNull(requestExceptionCounts.get(exceptionClass), 0); requestExceptionCounts.put(exceptionClass, oldExceptionCount + 1); } @@ -96,6 +115,8 @@ synchronized void recordBatchElementsCompletion( Throwable actualCause = throwable.getCause(); Class exceptionClass = actualCause.getClass(); + sampleOfEntryErrors.add(actualCause.toString()); + if (actualCause instanceof ApiException) { Code code = ((ApiException) actualCause).getStatusCode().getCode(); exceptionClass = ApiException.class; @@ -144,6 +165,17 @@ synchronized BatchingException asException() { .append(buildExceptionList(entryExceptionCounts, entryStatusCounts)) .append("."); } + + if (!sampleOfRpcErrors.isEmpty()) { + messageBuilder.append(" Sample of RPC errors: "); + messageBuilder.append(Joiner.on(", ").join(sampleOfRpcErrors)); + messageBuilder.append("."); + } + if (!sampleOfEntryErrors.isEmpty()) { + messageBuilder.append(" Sample of entry errors: "); + messageBuilder.append(Joiner.on(", ").join(sampleOfEntryErrors)); + messageBuilder.append("."); + } return new BatchingException(messageBuilder.toString()); } diff --git a/gax-java/gax/src/main/java/com/google/api/gax/rpc/EndpointContext.java b/gax-java/gax/src/main/java/com/google/api/gax/rpc/EndpointContext.java index b33a97cd0a..5b1f14fdaf 100644 --- a/gax-java/gax/src/main/java/com/google/api/gax/rpc/EndpointContext.java +++ b/gax-java/gax/src/main/java/com/google/api/gax/rpc/EndpointContext.java @@ -47,6 +47,7 @@ @InternalApi @AutoValue public abstract class EndpointContext { + private static final String GOOGLE_CLOUD_UNIVERSE_DOMAIN = "GOOGLE_CLOUD_UNIVERSE_DOMAIN"; private static final String INVALID_UNIVERSE_DOMAIN_ERROR_TEMPLATE = "The configured universe domain (%s) does not match the universe domain found in the credentials (%s). If you haven't configured the universe domain explicitly, `googleapis.com` is the default."; public static final String UNABLE_TO_RETRIEVE_CREDENTIALS_ERROR_MESSAGE = @@ -201,20 +202,27 @@ public abstract static class Builder { abstract EndpointContext autoBuild(); private String determineUniverseDomain() { + String universeDomain = universeDomain(); if (usingGDCH()) { // GDC-H has no concept of Universe Domain. User should not set a custom value - if (universeDomain() != null) { + if (universeDomain != null) { throw new IllegalArgumentException( "Universe domain configuration is incompatible with GDC-H"); } return Credentials.GOOGLE_DEFAULT_UNIVERSE; } // Check for "" (empty string) - if (universeDomain() != null && universeDomain().isEmpty()) { + if (universeDomain != null && universeDomain.isEmpty()) { throw new IllegalArgumentException("The universe domain value cannot be empty."); } - // Override with user set universe domain if provided - return universeDomain() != null ? universeDomain() : Credentials.GOOGLE_DEFAULT_UNIVERSE; + // If the universe domain wasn't configured explicitly in the settings, check the + // environment variable for the value + if (universeDomain == null) { + universeDomain = System.getenv(GOOGLE_CLOUD_UNIVERSE_DOMAIN); + } + // If the universe domain is configured by the user, the universe domain will either be + // from the settings or from the env var. The value from ClientSettings has priority. + return universeDomain != null ? universeDomain : Credentials.GOOGLE_DEFAULT_UNIVERSE; } /** Determines the fully resolved endpoint and universe domain values */ diff --git a/gax-java/gax/src/main/java/com/google/api/gax/rpc/Watchdog.java b/gax-java/gax/src/main/java/com/google/api/gax/rpc/Watchdog.java index df975fd2a3..f28bb19dee 100644 --- a/gax-java/gax/src/main/java/com/google/api/gax/rpc/Watchdog.java +++ b/gax-java/gax/src/main/java/com/google/api/gax/rpc/Watchdog.java @@ -193,8 +193,11 @@ class WatchdogStream extends StateCheckingResponseObserver private final ResponseObserver outerResponseObserver; private volatile StreamController innerController; + // When a stream is created it has automatic inbound flow control enabled. The stream + // won't wait for the caller to request a message. Setting the default to WAITING + // to reflect this state. @GuardedBy("lock") - private State state = State.IDLE; + private State state = State.WAITING; @GuardedBy("lock") private int pendingCount = 0; @@ -220,6 +223,16 @@ public void onStartImpl(StreamController controller) { public void disableAutoInboundFlowControl() { Preconditions.checkState( !hasStarted, "Can't disable automatic flow control after the stream has started"); + + // Adding the lock only to satisfy the annotation. It doesn't matter because before + // the stream is started, this is only accessed by the caller. + synchronized (lock) { + // When auto flow control is disabled, caller needs to call onRequest() to request a + // message. Setting the state to IDLE because now we're waiting for caller to call + // onRequest(). + state = State.IDLE; + } + autoAutoFlowControl = false; innerController.disableAutoInboundFlowControl(); } diff --git a/gax-java/gax/src/test/java/com/google/api/gax/batching/BatcherImplTest.java b/gax-java/gax/src/test/java/com/google/api/gax/batching/BatcherImplTest.java index 314fa81ae2..70340d77d6 100644 --- a/gax-java/gax/src/test/java/com/google/api/gax/batching/BatcherImplTest.java +++ b/gax-java/gax/src/test/java/com/google/api/gax/batching/BatcherImplTest.java @@ -873,7 +873,7 @@ public void testThrottlingBlocking() throws Exception { public void run() { batcherAddThreadHolder.add(Thread.currentThread()); batcher.add(1); - logger.info("Called batcher.add(1)"); + logger.fine("Called batcher.add(1)"); } }); @@ -893,20 +893,20 @@ public void run() { () -> { try { Thread.sleep(throttledTime); - logger.info("Calling flowController.release"); + logger.fine("Calling flowController.release"); flowController.release(1, 1); - logger.info("Called flowController.release"); + logger.fine("Called flowController.release"); } catch (InterruptedException e) { } }); try { - logger.info("Calling future.get(10 ms)"); + logger.fine("Calling future.get(10 ms)"); future.get(10, TimeUnit.MILLISECONDS); long afterGetCall = System.currentTimeMillis(); long actualWaitTimeMs = afterGetCall - beforeGetCall; - logger.info("future.get(10 ms) unexpectedly returned. Wait time: " + actualWaitTimeMs); + logger.fine("future.get(10 ms) unexpectedly returned. Wait time: " + actualWaitTimeMs); // In a flaky test troubleshooting // (https://github.com/googleapis/sdk-platform-java/issues/1931), we observed that // "future.get" method did not throw TimeoutException in this multithreaded test. @@ -919,7 +919,7 @@ public void run() { .isAtLeast(10); } catch (TimeoutException e) { // expected - logger.info("future.get(10 ms) timed out expectedly."); + logger.fine("future.get(10 ms) timed out expectedly."); } try { diff --git a/gax-java/gax/src/test/java/com/google/api/gax/batching/BatcherStatsTest.java b/gax-java/gax/src/test/java/com/google/api/gax/batching/BatcherStatsTest.java index 1a95e4d3cb..1d10917aeb 100644 --- a/gax-java/gax/src/test/java/com/google/api/gax/batching/BatcherStatsTest.java +++ b/gax-java/gax/src/test/java/com/google/api/gax/batching/BatcherStatsTest.java @@ -55,7 +55,10 @@ public void testRequestFailuresOnly() { batcherStats.recordBatchFailure( ApiExceptionFactory.createException( - new RuntimeException(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false)); + "fake api error", + new RuntimeException(), + FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), + false)); batcherStats.recordBatchFailure(new RuntimeException("Request failed")); @@ -65,6 +68,10 @@ public void testRequestFailuresOnly() { assertThat(exception).hasMessageThat().contains("1 RuntimeException"); assertThat(exception).hasMessageThat().contains("1 ApiException(1 INVALID_ARGUMENT)"); assertThat(exception).hasMessageThat().contains("and 0 partial failures."); + assertThat(exception) + .hasMessageThat() + .contains( + "com.google.api.gax.rpc.InvalidArgumentException: fake api error, java.lang.RuntimeException: Request failed."); } @Test @@ -79,7 +86,10 @@ public void testEntryFailureOnly() { SettableApiFuture batchTwoResult = SettableApiFuture.create(); batchTwoResult.setException( ApiExceptionFactory.createException( - new RuntimeException(), FakeStatusCode.of(StatusCode.Code.UNAVAILABLE), false)); + "fake entry error", + new RuntimeException(), + FakeStatusCode.of(StatusCode.Code.UNAVAILABLE), + false)); batcherStats.recordBatchElementsCompletion( ImmutableList.of(BatchEntry.create(2, batchTwoResult))); @@ -89,6 +99,10 @@ public void testEntryFailureOnly() { .contains("The 2 partial failures contained 2 entries that failed with:"); assertThat(ex).hasMessageThat().contains("1 ApiException(1 UNAVAILABLE)"); assertThat(ex).hasMessageThat().contains("1 IllegalStateException"); + assertThat(ex) + .hasMessageThat() + .contains( + "Sample of entry errors: java.lang.IllegalStateException: local element failure, com.google.api.gax.rpc.UnavailableException: fake entry error."); } @Test @@ -110,6 +124,8 @@ public void testRequestAndEntryFailures() { .contains( "Batching finished with 1 batches failed to apply due to: 1 RuntimeException and 1 " + "partial failures. The 1 partial failures contained 1 entries that failed with:" - + " 1 ApiException(1 ALREADY_EXISTS)."); + + " 1 ApiException(1 ALREADY_EXISTS)." + + " Sample of RPC errors: java.lang.RuntimeException: Batch failure." + + " Sample of entry errors: com.google.api.gax.rpc.AlreadyExistsException: java.lang.RuntimeException."); } } diff --git a/gax-java/gax/src/test/java/com/google/api/gax/rpc/EndpointContextTest.java b/gax-java/gax/src/test/java/com/google/api/gax/rpc/EndpointContextTest.java index f0dbae60f2..54b7d0e756 100644 --- a/gax-java/gax/src/test/java/com/google/api/gax/rpc/EndpointContextTest.java +++ b/gax-java/gax/src/test/java/com/google/api/gax/rpc/EndpointContextTest.java @@ -340,6 +340,41 @@ public void endpointContextBuild_gdchFlow_noUniverseDomain_customEndpoint() thro .isEqualTo(Credentials.GOOGLE_DEFAULT_UNIVERSE); } + // This Universe Domain should match the `GOOGLE_CLOUD_UNIVERSE_DOMAIN` Env Var + // For this test running locally or in CI, check that the Env Var is set properly. + // This test should only run when the maven profile `EnvVarTest` is enabled. + @Test + public void endpointContextBuild_universeDomainEnvVarSet() throws IOException { + String envVarUniverseDomain = "random.com"; + EndpointContext endpointContext = + defaultEndpointContextBuilder + .setUniverseDomain(null) + .setClientSettingsEndpoint(null) + .build(); + Truth.assertThat(endpointContext.resolvedEndpoint()).isEqualTo("test.random.com:443"); + Truth.assertThat(endpointContext.resolvedUniverseDomain()).isEqualTo(envVarUniverseDomain); + } + + // This Universe Domain should match the `GOOGLE_CLOUD_UNIVERSE_DOMAIN` Env Var + // For this test running locally or in CI, check that the Env Var is set properly. + // This test should only run when the maven profile `EnvVarTest` is enabled. + @Test + public void endpointContextBuild_multipleUniverseDomainConfigurations_clientSettingsHasPriority() + throws IOException { + // This test has `GOOGLE_CLOUD_UNIVERSE_DOMAIN` = `random.com` + String clientSettingsUniverseDomain = "clientSettingsUniverseDomain.com"; + EndpointContext endpointContext = + defaultEndpointContextBuilder + .setUniverseDomain(clientSettingsUniverseDomain) + .setClientSettingsEndpoint(null) + .build(); + Truth.assertThat(endpointContext.resolvedEndpoint()) + .isEqualTo("test.clientSettingsUniverseDomain.com:443"); + // Client Settings Universe Domain (if set) takes priority + Truth.assertThat(endpointContext.resolvedUniverseDomain()) + .isEqualTo(clientSettingsUniverseDomain); + } + @Test public void hasValidUniverseDomain_gdchFlow_anyCredentials() throws IOException { Credentials noCredentials = NoCredentialsProvider.create().getCredentials(); diff --git a/gax-java/gax/src/test/java/com/google/api/gax/rpc/WatchdogTest.java b/gax-java/gax/src/test/java/com/google/api/gax/rpc/WatchdogTest.java index e20218452c..d82fbeec49 100644 --- a/gax-java/gax/src/test/java/com/google/api/gax/rpc/WatchdogTest.java +++ b/gax-java/gax/src/test/java/com/google/api/gax/rpc/WatchdogTest.java @@ -154,6 +154,31 @@ public void testTimedOutBeforeStart() throws InterruptedException { assertThat(error).isInstanceOf(WatchdogTimeoutException.class); } + @Test + public void testTimedOutBeforeResponse() throws InterruptedException { + MockServerStreamingCallable autoFlowControlCallable = + new MockServerStreamingCallable<>(); + AutoFlowControlObserver downstreamObserver = new AutoFlowControlObserver<>(); + + autoFlowControlCallable.call("request", watchdog.watch(downstreamObserver, waitTime, idleTime)); + MockServerStreamingCall call1 = autoFlowControlCallable.popLastCall(); + + clock.incrementNanoTime(idleTime.toNanos() + 1); + watchdog.run(); + assertThat(downstreamObserver.done.isDone()).isFalse(); + assertThat(call1.getController().isCancelled()).isTrue(); + call1.getController().getObserver().onError(new CancellationException("cancelled")); + + Throwable actualError = null; + try { + downstreamObserver.done.get(); + } catch (ExecutionException e) { + actualError = e.getCause(); + } + assertThat(actualError).isInstanceOf(WatchdogTimeoutException.class); + assertThat(actualError.getMessage()).contains("waiting for next response"); + } + @Test public void testMultiple() throws Exception { // Start stream1 @@ -310,4 +335,30 @@ public void onComplete() { done.set(null); } } + + static class AutoFlowControlObserver implements ResponseObserver { + SettableApiFuture controller = SettableApiFuture.create(); + Queue responses = Queues.newLinkedBlockingDeque(); + SettableApiFuture done = SettableApiFuture.create(); + + @Override + public void onStart(StreamController controller) { + this.controller.set(controller); + } + + @Override + public void onResponse(T response) { + responses.add(response); + } + + @Override + public void onError(Throwable t) { + done.setException(t); + } + + @Override + public void onComplete() { + done.set(null); + } + } } diff --git a/gax-java/pom.xml b/gax-java/pom.xml index 5e98463187..0eea8df344 100644 --- a/gax-java/pom.xml +++ b/gax-java/pom.xml @@ -4,14 +4,14 @@ com.google.api gax-parent pom - 2.43.1-SNAPSHOT + 2.45.1-SNAPSHOT GAX (Google Api eXtensions) for Java (Parent) Google Api eXtensions for Java (Parent) com.google.api gapic-generator-java-pom-parent - 2.35.1-SNAPSHOT + 2.37.1-SNAPSHOT ../gapic-generator-java-pom-parent @@ -50,7 +50,7 @@ com.google.api api-common - 2.26.1-SNAPSHOT + 2.28.1-SNAPSHOT com.google.auth @@ -108,24 +108,24 @@ com.google.api gax - 2.43.1-SNAPSHOT + 2.45.1-SNAPSHOT com.google.api gax - 2.43.1-SNAPSHOT + 2.45.1-SNAPSHOT test-jar testlib com.google.api.grpc proto-google-common-protos - 2.34.1-SNAPSHOT + 2.36.1-SNAPSHOT com.google.api.grpc grpc-google-common-protos - 2.34.1-SNAPSHOT + 2.36.1-SNAPSHOT io.grpc @@ -176,7 +176,7 @@ com.google.truth truth - 1.2.0 + 1.4.2 org.checkerframework diff --git a/java-common-protos/.OwlBot.yaml b/java-common-protos/.OwlBot.yaml index 4aa7962d4f..14bb0edc75 100644 --- a/java-common-protos/.OwlBot.yaml +++ b/java-common-protos/.OwlBot.yaml @@ -28,9 +28,20 @@ deep-copy-regex: - source: "/google/cloud/audit/google-cloud-audit-java/proto-google-cloud-audit-java/src" dest: "/owl-bot-staging/java-common-protos/v1/proto-google-common-protos/src" +# For geo common protos - source: "/google/geo/type/google-geo-type-java/proto-google-geo-type-java/src" dest: "/owl-bot-staging/java-common-protos/v1/proto-google-common-protos/src" +# For shopping common protos +- source: "/google/shopping/merchant/reports/v1beta/google-cloud-merchant-reports-v1beta-java" + dest: "/owl-bot-staging/java-common-protos/v1/proto-google-common-protos/src" + +# It is only used once in https://github.com/googleapis/googleapis/blob/master/google/chat/v1/BUILD.bazel#L47, +# and technically not a common proto, maybe a violation of AIP-215 if it is not. +# However, it's better to put it here so that we don't have to manually add it to BUILD.bazel file and hermetic build scripts. +- source: "/google/apps/card/v1/google-apps-card-v1-java/proto-google-apps-card-v1-java" + dest: "/owl-bot-staging/java-common-protos/v1/proto-google-common-protos/src" + - source: "/google/logging/type/google-logging-type-java/proto-google-logging-type-java/src" dest: "/owl-bot-staging/java-common-protos/v1/proto-google-common-protos/src" diff --git a/java-common-protos/grpc-google-common-protos/pom.xml b/java-common-protos/grpc-google-common-protos/pom.xml index 2f650fa397..dc2ba76c2a 100644 --- a/java-common-protos/grpc-google-common-protos/pom.xml +++ b/java-common-protos/grpc-google-common-protos/pom.xml @@ -4,13 +4,13 @@ 4.0.0 com.google.api.grpc grpc-google-common-protos - 2.34.1-SNAPSHOT + 2.36.1-SNAPSHOT grpc-google-common-protos GRPC library for grpc-google-common-protos com.google.api.grpc google-common-protos-parent - 2.34.1-SNAPSHOT + 2.36.1-SNAPSHOT diff --git a/java-common-protos/pom.xml b/java-common-protos/pom.xml index 041ea3589c..4ab623205f 100644 --- a/java-common-protos/pom.xml +++ b/java-common-protos/pom.xml @@ -4,7 +4,7 @@ com.google.api.grpc google-common-protos-parent pom - 2.34.1-SNAPSHOT + 2.36.1-SNAPSHOT Google Common Protos Parent Java idiomatic client for Google Cloud Platform services. @@ -13,7 +13,7 @@ com.google.api gapic-generator-java-pom-parent - 2.35.1-SNAPSHOT + 2.37.1-SNAPSHOT ../gapic-generator-java-pom-parent @@ -61,7 +61,7 @@ com.google.cloud third-party-dependencies - 3.25.1-SNAPSHOT + 3.27.1-SNAPSHOT pom import @@ -75,7 +75,7 @@ com.google.api.grpc grpc-google-common-protos - 2.34.1-SNAPSHOT + 2.36.1-SNAPSHOT io.grpc @@ -87,7 +87,7 @@ com.google.api.grpc proto-google-common-protos - 2.34.1-SNAPSHOT + 2.36.1-SNAPSHOT com.google.guava diff --git a/java-common-protos/proto-google-common-protos/pom.xml b/java-common-protos/proto-google-common-protos/pom.xml index 2b9e21566f..dec29c99d5 100644 --- a/java-common-protos/proto-google-common-protos/pom.xml +++ b/java-common-protos/proto-google-common-protos/pom.xml @@ -3,13 +3,13 @@ 4.0.0 com.google.api.grpc proto-google-common-protos - 2.34.1-SNAPSHOT + 2.36.1-SNAPSHOT proto-google-common-protos PROTO library for proto-google-common-protos com.google.api.grpc google-common-protos-parent - 2.34.1-SNAPSHOT + 2.36.1-SNAPSHOT diff --git a/java-core/google-cloud-core-bom/pom.xml b/java-core/google-cloud-core-bom/pom.xml index f1ae640cc7..0077cd6a09 100644 --- a/java-core/google-cloud-core-bom/pom.xml +++ b/java-core/google-cloud-core-bom/pom.xml @@ -3,13 +3,13 @@ 4.0.0 com.google.cloud google-cloud-core-bom - 2.33.1-SNAPSHOT + 2.35.1-SNAPSHOT pom com.google.api gapic-generator-java-pom-parent - 2.35.1-SNAPSHOT + 2.37.1-SNAPSHOT ../../gapic-generator-java-pom-parent @@ -23,17 +23,17 @@ com.google.cloud google-cloud-core - 2.33.1-SNAPSHOT + 2.35.1-SNAPSHOT com.google.cloud google-cloud-core-grpc - 2.33.1-SNAPSHOT + 2.35.1-SNAPSHOT com.google.cloud google-cloud-core-http - 2.33.1-SNAPSHOT + 2.35.1-SNAPSHOT diff --git a/java-core/google-cloud-core-grpc/pom.xml b/java-core/google-cloud-core-grpc/pom.xml index 6cc246f188..1f9251afac 100644 --- a/java-core/google-cloud-core-grpc/pom.xml +++ b/java-core/google-cloud-core-grpc/pom.xml @@ -3,7 +3,7 @@ 4.0.0 com.google.cloud google-cloud-core-grpc - 2.33.1-SNAPSHOT + 2.35.1-SNAPSHOT jar Google Cloud Core gRPC @@ -12,7 +12,7 @@ com.google.cloud google-cloud-core-parent - 2.33.1-SNAPSHOT + 2.35.1-SNAPSHOT google-cloud-core-grpc diff --git a/java-core/google-cloud-core-http/pom.xml b/java-core/google-cloud-core-http/pom.xml index e8f580f411..57407ebe73 100644 --- a/java-core/google-cloud-core-http/pom.xml +++ b/java-core/google-cloud-core-http/pom.xml @@ -3,7 +3,7 @@ 4.0.0 com.google.cloud google-cloud-core-http - 2.33.1-SNAPSHOT + 2.35.1-SNAPSHOT jar Google Cloud Core HTTP @@ -12,7 +12,7 @@ com.google.cloud google-cloud-core-parent - 2.33.1-SNAPSHOT + 2.35.1-SNAPSHOT google-cloud-core-http diff --git a/java-core/google-cloud-core/pom.xml b/java-core/google-cloud-core/pom.xml index 06a83e5170..7dab5b72dd 100644 --- a/java-core/google-cloud-core/pom.xml +++ b/java-core/google-cloud-core/pom.xml @@ -3,7 +3,7 @@ 4.0.0 com.google.cloud google-cloud-core - 2.33.1-SNAPSHOT + 2.35.1-SNAPSHOT jar Google Cloud Core @@ -12,7 +12,7 @@ com.google.cloud google-cloud-core-parent - 2.33.1-SNAPSHOT + 2.35.1-SNAPSHOT google-cloud-core diff --git a/java-core/pom.xml b/java-core/pom.xml index 95715809d0..168704c6d7 100644 --- a/java-core/pom.xml +++ b/java-core/pom.xml @@ -4,7 +4,7 @@ com.google.cloud google-cloud-core-parent pom - 2.33.1-SNAPSHOT + 2.35.1-SNAPSHOT Google Cloud Core Parent Java idiomatic client for Google Cloud Platform services. @@ -13,7 +13,7 @@ com.google.api gapic-generator-java-pom-parent - 2.35.1-SNAPSHOT + 2.37.1-SNAPSHOT ../gapic-generator-java-pom-parent @@ -33,7 +33,7 @@ com.google.cloud google-cloud-shared-dependencies - 3.25.1-SNAPSHOT + 3.27.1-SNAPSHOT pom import @@ -47,7 +47,7 @@ com.google.truth truth - 1.2.0 + 1.4.2 test diff --git a/java-iam/grpc-google-iam-v1/pom.xml b/java-iam/grpc-google-iam-v1/pom.xml index dec5af5f8c..67380b8d99 100644 --- a/java-iam/grpc-google-iam-v1/pom.xml +++ b/java-iam/grpc-google-iam-v1/pom.xml @@ -4,13 +4,13 @@ 4.0.0 com.google.api.grpc grpc-google-iam-v1 - 1.29.1-SNAPSHOT + 1.31.1-SNAPSHOT grpc-google-iam-v1 GRPC library for grpc-google-iam-v1 com.google.cloud google-iam-parent - 1.29.1-SNAPSHOT + 1.31.1-SNAPSHOT diff --git a/java-iam/grpc-google-iam-v2/pom.xml b/java-iam/grpc-google-iam-v2/pom.xml index a5ef2d9d33..62eb63b981 100644 --- a/java-iam/grpc-google-iam-v2/pom.xml +++ b/java-iam/grpc-google-iam-v2/pom.xml @@ -4,13 +4,13 @@ 4.0.0 com.google.api.grpc grpc-google-iam-v2 - 1.29.1-SNAPSHOT + 1.31.1-SNAPSHOT grpc-google-iam-v2 GRPC library for proto-google-iam-v2 com.google.cloud google-iam-parent - 1.29.1-SNAPSHOT + 1.31.1-SNAPSHOT diff --git a/java-iam/grpc-google-iam-v2beta/pom.xml b/java-iam/grpc-google-iam-v2beta/pom.xml index 908fc382e7..94c8b5fe2a 100644 --- a/java-iam/grpc-google-iam-v2beta/pom.xml +++ b/java-iam/grpc-google-iam-v2beta/pom.xml @@ -4,13 +4,13 @@ 4.0.0 com.google.api.grpc grpc-google-iam-v2beta - 1.29.1-SNAPSHOT + 1.31.1-SNAPSHOT grpc-google-iam-v2beta GRPC library for proto-google-iam-v1 com.google.cloud google-iam-parent - 1.29.1-SNAPSHOT + 1.31.1-SNAPSHOT diff --git a/java-iam/pom.xml b/java-iam/pom.xml index 471c24acc7..29b3d14a01 100644 --- a/java-iam/pom.xml +++ b/java-iam/pom.xml @@ -4,7 +4,7 @@ com.google.cloud google-iam-parent pom - 1.29.1-SNAPSHOT + 1.31.1-SNAPSHOT Google IAM Parent Java idiomatic client for Google Cloud Platform services. @@ -13,7 +13,7 @@ com.google.api gapic-generator-java-pom-parent - 2.35.1-SNAPSHOT + 2.37.1-SNAPSHOT ../gapic-generator-java-pom-parent @@ -60,7 +60,7 @@ com.google.cloud third-party-dependencies - 3.25.1-SNAPSHOT + 3.27.1-SNAPSHOT pom import @@ -88,44 +88,44 @@ com.google.api gax-bom - 2.43.1-SNAPSHOT + 2.45.1-SNAPSHOT pom import com.google.api.grpc proto-google-iam-v2 - 1.29.1-SNAPSHOT + 1.31.1-SNAPSHOT com.google.api.grpc grpc-google-iam-v2 - 1.29.1-SNAPSHOT + 1.31.1-SNAPSHOT com.google.api.grpc proto-google-common-protos - 2.34.1-SNAPSHOT + 2.36.1-SNAPSHOT com.google.api.grpc proto-google-iam-v2beta - 1.29.1-SNAPSHOT + 1.31.1-SNAPSHOT com.google.api.grpc grpc-google-iam-v1 - 1.29.1-SNAPSHOT + 1.31.1-SNAPSHOT com.google.api.grpc grpc-google-iam-v2beta - 1.29.1-SNAPSHOT + 1.31.1-SNAPSHOT com.google.api.grpc proto-google-iam-v1 - 1.29.1-SNAPSHOT + 1.31.1-SNAPSHOT javax.annotation diff --git a/java-iam/proto-google-iam-v1/pom.xml b/java-iam/proto-google-iam-v1/pom.xml index 9d0686668d..b9c3485deb 100644 --- a/java-iam/proto-google-iam-v1/pom.xml +++ b/java-iam/proto-google-iam-v1/pom.xml @@ -3,13 +3,13 @@ 4.0.0 com.google.api.grpc proto-google-iam-v1 - 1.29.1-SNAPSHOT + 1.31.1-SNAPSHOT proto-google-iam-v1 PROTO library for proto-google-iam-v1 com.google.cloud google-iam-parent - 1.29.1-SNAPSHOT + 1.31.1-SNAPSHOT diff --git a/java-iam/proto-google-iam-v2/pom.xml b/java-iam/proto-google-iam-v2/pom.xml index 5d4c8340d0..7388a05717 100644 --- a/java-iam/proto-google-iam-v2/pom.xml +++ b/java-iam/proto-google-iam-v2/pom.xml @@ -4,13 +4,13 @@ 4.0.0 com.google.api.grpc proto-google-iam-v2 - 1.29.1-SNAPSHOT + 1.31.1-SNAPSHOT proto-google-iam-v2 Proto library for proto-google-iam-v1 com.google.cloud google-iam-parent - 1.29.1-SNAPSHOT + 1.31.1-SNAPSHOT diff --git a/java-iam/proto-google-iam-v2beta/pom.xml b/java-iam/proto-google-iam-v2beta/pom.xml index ef7bda3be4..a7f9552344 100644 --- a/java-iam/proto-google-iam-v2beta/pom.xml +++ b/java-iam/proto-google-iam-v2beta/pom.xml @@ -4,13 +4,13 @@ 4.0.0 com.google.api.grpc proto-google-iam-v2beta - 1.29.1-SNAPSHOT + 1.31.1-SNAPSHOT proto-google-iam-v2beta Proto library for proto-google-iam-v1 com.google.cloud google-iam-parent - 1.29.1-SNAPSHOT + 1.31.1-SNAPSHOT diff --git a/java-shared-dependencies/README.md b/java-shared-dependencies/README.md index 4c0e79e467..b5889ad650 100644 --- a/java-shared-dependencies/README.md +++ b/java-shared-dependencies/README.md @@ -14,7 +14,7 @@ If you are using Maven, add this to the `dependencyManagement` section. com.google.cloud google-cloud-shared-dependencies - 3.25.0 + 3.27.0 pom import diff --git a/java-shared-dependencies/dependency-convergence-check/pom.xml b/java-shared-dependencies/dependency-convergence-check/pom.xml index f599b9ddcc..9b9aa08e00 100644 --- a/java-shared-dependencies/dependency-convergence-check/pom.xml +++ b/java-shared-dependencies/dependency-convergence-check/pom.xml @@ -3,7 +3,7 @@ 4.0.0 com.google.cloud shared-dependencies-dependency-convergence-test - 3.25.1-SNAPSHOT + 3.27.1-SNAPSHOT Dependency convergence test for certain artifacts in Google Cloud Shared Dependencies An dependency convergence test case for the shared dependencies BOM. A failure of this test case means diff --git a/java-shared-dependencies/first-party-dependencies/pom.xml b/java-shared-dependencies/first-party-dependencies/pom.xml index ca857100ff..f3d73b7550 100644 --- a/java-shared-dependencies/first-party-dependencies/pom.xml +++ b/java-shared-dependencies/first-party-dependencies/pom.xml @@ -6,7 +6,7 @@ com.google.cloud first-party-dependencies pom - 3.25.1-SNAPSHOT + 3.27.1-SNAPSHOT Google Cloud First-party Shared Dependencies Shared first-party dependencies for Google Cloud Java libraries. @@ -15,7 +15,7 @@ com.google.cloud google-cloud-shared-config - 1.7.1 + 1.7.4 @@ -33,7 +33,7 @@ com.google.api gapic-generator-java-bom - 2.35.1-SNAPSHOT + 2.37.1-SNAPSHOT pom import @@ -45,7 +45,7 @@ com.google.cloud google-cloud-core-bom - 2.33.1-SNAPSHOT + 2.35.1-SNAPSHOT pom import @@ -69,13 +69,13 @@ com.google.cloud google-cloud-core - 2.33.1-SNAPSHOT + 2.35.1-SNAPSHOT test-jar com.google.cloud google-cloud-core - 2.33.1-SNAPSHOT + 2.35.1-SNAPSHOT tests diff --git a/java-shared-dependencies/pom.xml b/java-shared-dependencies/pom.xml index c29010084b..cd9ab47851 100644 --- a/java-shared-dependencies/pom.xml +++ b/java-shared-dependencies/pom.xml @@ -4,7 +4,7 @@ com.google.cloud google-cloud-shared-dependencies pom - 3.25.1-SNAPSHOT + 3.27.1-SNAPSHOT first-party-dependencies third-party-dependencies @@ -17,7 +17,7 @@ com.google.api gapic-generator-java-pom-parent - 2.35.1-SNAPSHOT + 2.37.1-SNAPSHOT ../gapic-generator-java-pom-parent @@ -31,14 +31,14 @@ com.google.cloud first-party-dependencies - 3.25.1-SNAPSHOT + 3.27.1-SNAPSHOT pom import com.google.cloud third-party-dependencies - 3.25.1-SNAPSHOT + 3.27.1-SNAPSHOT pom import diff --git a/java-shared-dependencies/third-party-dependencies/pom.xml b/java-shared-dependencies/third-party-dependencies/pom.xml index 3eb48c6852..9b96f8643d 100644 --- a/java-shared-dependencies/third-party-dependencies/pom.xml +++ b/java-shared-dependencies/third-party-dependencies/pom.xml @@ -6,7 +6,7 @@ com.google.cloud third-party-dependencies pom - 3.25.1-SNAPSHOT + 3.27.1-SNAPSHOT Google Cloud Third-party Shared Dependencies Shared third-party dependencies for Google Cloud Java libraries. @@ -15,7 +15,7 @@ com.google.cloud google-cloud-shared-config - 1.7.1 + 1.7.4 @@ -24,12 +24,13 @@ ${project.artifactId} 1.6.8 + 1.7.2 1.3.2 1.23 0.31.1 3.0.2 2.16.1 - 2.24.1 + 2.26.1 1.16.1 4.4.16 4.5.14 @@ -37,11 +38,28 @@ 3.42.0 0.27.0 2.8 - 1.34.1 + 1.35.0 + 0.8 + 15.0.0 + + org.apache.arrow + arrow-memory-core + ${arrow.version} + + + org.apache.arrow + arrow-memory-netty + ${arrow.version} + + + org.apache.arrow + arrow-vector + ${arrow.version} + org.apache.httpcomponents httpcore @@ -57,6 +75,11 @@ threetenbp ${threeten.version} + + org.threeten + threeten-extra + ${threeten-extra.version} + javax.annotation javax.annotation-api @@ -78,6 +101,18 @@ error_prone_annotations ${errorprone.version} + + + com.google.flogger + google-extensions + ${flogger.version} + + + com.google.flogger + flogger-system-backend + ${flogger.version} + com.fasterxml.jackson jackson-bom diff --git a/java-shared-dependencies/unmanaged-dependency-check/pom.xml b/java-shared-dependencies/unmanaged-dependency-check/pom.xml index 5383658501..5c591b76f7 100644 --- a/java-shared-dependencies/unmanaged-dependency-check/pom.xml +++ b/java-shared-dependencies/unmanaged-dependency-check/pom.xml @@ -67,18 +67,18 @@ com.google.truth truth - 1.2.0 + 1.4.2 test org.slf4j slf4j-api - 2.0.11 + 2.0.12 org.slf4j slf4j-simple - 2.0.11 + 2.0.12 diff --git a/java-shared-dependencies/upper-bound-check/pom.xml b/java-shared-dependencies/upper-bound-check/pom.xml index 9c9f00a1ef..4921fbfe9c 100644 --- a/java-shared-dependencies/upper-bound-check/pom.xml +++ b/java-shared-dependencies/upper-bound-check/pom.xml @@ -4,7 +4,7 @@ com.google.cloud shared-dependencies-upper-bound-test pom - 3.25.1-SNAPSHOT + 3.27.1-SNAPSHOT Upper bound test for Google Cloud Shared Dependencies An upper bound test case for the shared dependencies BOM. A failure of this test case means @@ -16,7 +16,7 @@ com.google.cloud google-cloud-shared-config - 1.7.1 + 1.7.4 @@ -30,7 +30,7 @@ com.google.cloud google-cloud-shared-dependencies - 3.25.1-SNAPSHOT + 3.27.1-SNAPSHOT pom import diff --git a/library_generation/README.md b/library_generation/README.md index 8381422982..75fc32695d 100644 --- a/library_generation/README.md +++ b/library_generation/README.md @@ -101,26 +101,29 @@ The library level parameters define how to generate a (multi-versions) GAPIC library. They are shared by all GAPICs of a library. -| Name | Required | Notes | -|:---------------------|:--------:|:------------------------------------------------------------------| -| api_shortname | Yes | | -| api_description | Yes | | -| name_pretty | Yes | | -| product_docs | Yes | | -| library_type | No | `GAPIC_AUTO` if not specified | -| release_level | No | `preview` if not specified | -| api_id | No | `{api_shortname}.googleapis.com` if not specified | -| api_reference | No | | -| client_documentation | No | | -| distribution_name | No | `{group_id}:google-{cloud_prefix}{library_name}` if not specified | -| googleapis_commitish | No | use repository level `googleapis_commitish` if not specified. | -| group_id | No | `com.google.cloud` if not specified | -| issue_tracker | No | | -| library_name | No | `api_shortname` is not specified | -| rest_documentation | No | | -| rpc_documentation | No | | -| cloud_api | No | `true` if not specified | -| requires-billing | No | `true` if not specified | +| Name | Required | Notes | +|:----------------------|:--------:|:-----------------------------------------------------------------------------------| +| api_shortname | Yes | | +| api_description | Yes | | +| name_pretty | Yes | | +| product_docs | Yes | | +| library_type | No | `GAPIC_AUTO` if not specified | +| release_level | No | `preview` if not specified | +| api_id | No | `{api_shortname}.googleapis.com` if not specified | +| api_reference | No | | +| codeowner_team | No | | +| client_documentation | No | | +| distribution_name | No | `{group_id}:google-{cloud_prefix}{library_name}` if not specified | +| excluded_poms | No | | +| excluded_dependencies | No | | +| googleapis_commitish | No | use repository level `googleapis_commitish` if not specified. | +| group_id | No | `com.google.cloud` if not specified | +| issue_tracker | No | | +| library_name | No | `api_shortname` is not specified. This value should be unique among all libraries. | +| rest_documentation | No | | +| rpc_documentation | No | | +| cloud_api | No | `true` if not specified | +| requires-billing | No | `true` if not specified | Note that `cloud_prefix` is `cloud-` if `cloud_api` is `true`; empty otherwise. diff --git a/library_generation/cli/generate_monorepo_gapic_bom.py b/library_generation/cli/generate_monorepo_gapic_bom.py new file mode 100644 index 0000000000..999c9e5ebf --- /dev/null +++ b/library_generation/cli/generate_monorepo_gapic_bom.py @@ -0,0 +1,50 @@ +# Copyright 2024 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +import click as click + +from library_generation.utils.pom_generator import generate_gapic_bom +from library_generation.utils.pom_generator import generate_root_pom + + +@click.group(invoke_without_command=False) +@click.pass_context +@click.version_option(message="%(version)s") +def main(ctx): + pass + + +@main.command() +@click.option( + "--repository-path", + required=True, + type=str, + help=""" + Path to which the generated pom.xml goes. + """, +) +@click.option( + "--versions-file", + required=True, + type=str, + help=""" + The file containing version of libraries. + Throw FileNotFoundError if the file doesn't exist. + """, +) +def generate(repository_path: str, versions_file: str) -> None: + generate_gapic_bom(repository_path=repository_path, versions_file=versions_file) + + +if __name__ == "__main__": + main() diff --git a/library_generation/cli/generate_monorepo_root_pom.py b/library_generation/cli/generate_monorepo_root_pom.py new file mode 100644 index 0000000000..8f129b63f0 --- /dev/null +++ b/library_generation/cli/generate_monorepo_root_pom.py @@ -0,0 +1,39 @@ +# Copyright 2024 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +import click as click +from library_generation.utils.pom_generator import generate_root_pom + + +@click.group(invoke_without_command=False) +@click.pass_context +@click.version_option(message="%(version)s") +def main(ctx): + pass + + +@main.command() +@click.option( + "--repository-path", + required=True, + type=str, + help=""" + Path to which the generated pom.xml goes. + """, +) +def generate(repository_path: str) -> None: + generate_root_pom(repository_path=repository_path) + + +if __name__ == "__main__": + main() diff --git a/library_generation/configuration/owlbot-cli-sha b/library_generation/configuration/owlbot-cli-sha deleted file mode 100644 index aad884ebfc..0000000000 --- a/library_generation/configuration/owlbot-cli-sha +++ /dev/null @@ -1,2 +0,0 @@ -# owlbot-cli image from 20231010 -sha256:623647ee79ac605858d09e60c1382a716c125fb776f69301b72de1cd35d49409 diff --git a/library_generation/configuration/python-version b/library_generation/configuration/python-version deleted file mode 100644 index 1e33456831..0000000000 --- a/library_generation/configuration/python-version +++ /dev/null @@ -1 +0,0 @@ -3.11.2 diff --git a/library_generation/configuration/synthtool-commitish b/library_generation/configuration/synthtool-commitish deleted file mode 100644 index 5603b9055b..0000000000 --- a/library_generation/configuration/synthtool-commitish +++ /dev/null @@ -1 +0,0 @@ -59fe44fde9866a26e7ee4e4450fd79f67f8cf599 diff --git a/library_generation/dockerignore b/library_generation/dockerignore new file mode 100644 index 0000000000..7e978caea9 --- /dev/null +++ b/library_generation/dockerignore @@ -0,0 +1,6 @@ +README.md +**/__pycache__/ +**/*.egg-info/ +**/output/ +**/build/ +**/google-cloud-java/ diff --git a/library_generation/generate_composed_library.py b/library_generation/generate_composed_library.py index 37a1e75e75..4caf0c45ff 100755 --- a/library_generation/generate_composed_library.py +++ b/library_generation/generate_composed_library.py @@ -62,7 +62,6 @@ def generate_composed_library( config=config, library=library, output_folder=output_folder ) - is_monorepo = util.check_monorepo(config=config) base_arguments = __construct_tooling_arg(config=config) owlbot_cli_source_folder = util.sh_util("mktemp -d") os.makedirs(f"{library_path}", exist_ok=True) @@ -80,8 +79,7 @@ def generate_composed_library( transport=gapic_inputs.transport, library_path=library_path, ) - service_version = gapic.proto_path.split("/")[-1] - temp_destination_path = f"java-{library.api_shortname}-{service_version}" + temp_destination_path = f"java-{gapic.proto_path.replace('/','-')}" effective_arguments = __construct_effective_arg( base_arguments=base_arguments, gapic=gapic, @@ -113,7 +111,7 @@ def generate_composed_library( owlbot_cli_source_folder, config.owlbot_cli_image, config.synthtool_commitish, - str(is_monorepo).lower(), + str(config.is_monorepo).lower(), config.path_to_yaml, ], "Library postprocessing", diff --git a/library_generation/generate_library.sh b/library_generation/generate_library.sh index 9691f063e6..a23cf14653 100755 --- a/library_generation/generate_library.sh +++ b/library_generation/generate_library.sh @@ -175,12 +175,6 @@ case "${proto_path}" in removed_proto="google/rpc/http.proto" proto_files="${proto_files//${removed_proto}/}" ;; - "google/shopping"*) - # this proto is included in //google/shopping/css/v1:google-cloud-shopping-css-v1-java - # and //google/shopping/merchant/inventories/v1beta:google-cloud-merchant-inventories-v1beta-java - # and //google/shopping/merchant/reports/v1beta:google-cloud-merchant-reports-v1beta-java - proto_files="${proto_files} google/shopping/type/types.proto" - ;; esac # download gapic-generator-java, protobuf and grpc plugin. download_tools "${gapic_generator_version}" "${protobuf_version}" "${grpc_version}" "${os_architecture}" @@ -284,8 +278,7 @@ case "${proto_path}" in esac # copy proto files to proto-*/src/main/proto for proto_src in ${proto_files}; do - if [[ "${proto_src}" == "google/cloud/common/operation_metadata.proto" ]] || - [[ "${proto_src}" == "google/shopping/type/types.proto" ]]; then + if [[ "${proto_src}" == "google/cloud/common/operation_metadata.proto" ]]; then continue fi mkdir -p "${temp_destination_path}/proto-${folder_name}/src/main/proto" diff --git a/library_generation/generate_pr_description.py b/library_generation/generate_pr_description.py new file mode 100644 index 0000000000..e44d28a21a --- /dev/null +++ b/library_generation/generate_pr_description.py @@ -0,0 +1,184 @@ +#!/usr/bin/env python3 +# Copyright 2024 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +import os +import shutil +from typing import Dict + +import click +from git import Commit, Repo +from library_generation.model.generation_config import from_yaml +from library_generation.utilities import find_versioned_proto_path +from library_generation.utils.commit_message_formatter import format_commit_message +from library_generation.utilities import get_file_paths +from library_generation.utils.commit_message_formatter import wrap_nested_commit + + +@click.group(invoke_without_command=False) +@click.pass_context +@click.version_option(message="%(version)s") +def main(ctx): + pass + + +@main.command() +@click.option( + "--generation-config-yaml", + required=True, + type=str, + help=""" + Path to generation_config.yaml that contains the metadata about + library generation. + The googleapis commit in the configuration is the latest commit, + inclusively, from which the commit message is considered. + """, +) +@click.option( + "--baseline-commit", + required=True, + type=str, + help=""" + The baseline (oldest) commit, exclusively, from which the commit message is + considered. + This commit should be an ancestor of googleapis commit in configuration. + """, +) +@click.option( + "--repo-url", + type=str, + default="https://github.com/googleapis/googleapis.git", + show_default=True, + help=""" + GitHub repository URL. + """, +) +def generate( + generation_config_yaml: str, + repo_url: str, + baseline_commit: str, +) -> str: + description = generate_pr_descriptions( + generation_config_yaml=generation_config_yaml, + repo_url=repo_url, + baseline_commit=baseline_commit, + ) + idx = generation_config_yaml.rfind("/") + config_path = generation_config_yaml[:idx] + with open(f"{config_path}/pr_description.txt", "w+") as f: + f.write(description) + return description + + +def generate_pr_descriptions( + generation_config_yaml: str, + repo_url: str, + baseline_commit: str, +) -> str: + config = from_yaml(generation_config_yaml) + paths = get_file_paths(config) + return __get_commit_messages( + repo_url=repo_url, + latest_commit=config.googleapis_commitish, + baseline_commit=baseline_commit, + paths=paths, + is_monorepo=config.is_monorepo, + ) + + +def __get_commit_messages( + repo_url: str, + latest_commit: str, + baseline_commit: str, + paths: Dict[str, str], + is_monorepo: bool, +) -> str: + """ + Combine commit messages of a repository from latest_commit to + baseline_commit. Only commits which change files in a pre-defined + file paths will be considered. + Note that baseline_commit should be an ancestor of latest_commit. + + :param repo_url: the url of the repository. + :param latest_commit: the newest commit to be considered in + selecting commit message. + :param baseline_commit: the oldest commit to be considered in + selecting commit message. This commit should be an ancestor of + :param paths: a mapping from file paths to library_name. + :param is_monorepo: whether to generate commit messages in a monorepo. + :return: commit messages. + """ + tmp_dir = "/tmp/repo" + shutil.rmtree(tmp_dir, ignore_errors=True) + os.mkdir(tmp_dir) + repo = Repo.clone_from(repo_url, tmp_dir) + commit = repo.commit(latest_commit) + qualified_commits = {} + while str(commit.hexsha) != baseline_commit: + commit_and_name = __filter_qualified_commit(paths=paths, commit=commit) + if commit_and_name != (): + qualified_commits[commit_and_name[0]] = commit_and_name[1] + commit_parents = commit.parents + if len(commit_parents) == 0: + break + commit = commit_parents[0] + shutil.rmtree(tmp_dir, ignore_errors=True) + return __combine_commit_messages( + latest_commit=latest_commit, + baseline_commit=baseline_commit, + commits=qualified_commits, + is_monorepo=is_monorepo, + ) + + +def __filter_qualified_commit(paths: Dict[str, str], commit: Commit) -> (Commit, str): + """ + Returns a tuple of a commit and libray_name. + A qualified commit means at least one file, excluding BUILD.bazel, changes + in that commit is within the versioned proto_path in paths. + + :param paths: a mapping from versioned proto_path to library_name. + :param commit: a commit under consideration. + :return: a tuple of a commit and library_name if the commit is + qualified; otherwise an empty tuple. + """ + for file in commit.stats.files.keys(): + versioned_proto_path = find_versioned_proto_path(file) + if versioned_proto_path in paths and (not file.endswith("BUILD.bazel")): + return commit, paths[versioned_proto_path] + return () + + +def __combine_commit_messages( + latest_commit: str, + baseline_commit: str, + commits: Dict[Commit, str], + is_monorepo: bool, +) -> str: + messages = [ + f"This pull request is generated with proto changes between googleapis commit {baseline_commit} (exclusive) and {latest_commit} (inclusive).", + "Qualified commits are:", + ] + for commit in commits: + short_sha = commit.hexsha[:7] + messages.append( + f"[googleapis/googleapis@{short_sha}](https://github.com/googleapis/googleapis/commit/{commit.hexsha})" + ) + + messages.extend(format_commit_message(commits=commits, is_monorepo=is_monorepo)) + + return "\n".join(messages) + + +if __name__ == "__main__": + main() diff --git a/library_generation/generate_repo.py b/library_generation/generate_repo.py old mode 100644 new mode 100755 index 85c10c029f..abe51c50f2 --- a/library_generation/generate_repo.py +++ b/library_generation/generate_repo.py @@ -15,8 +15,10 @@ import click import library_generation.utilities as util +import os from library_generation.generate_composed_library import generate_composed_library from library_generation.model.generation_config import from_yaml +from library_generation.utils.monorepo_postprocessor import monorepo_postprocessing @click.group(invoke_without_command=False) @@ -78,6 +80,11 @@ def generate_from_yaml( Parses a config yaml and generates libraries via generate_composed_library.py """ + # convert paths to absolute paths so they can be correctly referenced in + # downstream scripts + generation_config_yaml = os.path.abspath(generation_config_yaml) + repository_path = os.path.abspath(repository_path) + config = from_yaml(generation_config_yaml) target_libraries = config.libraries if target_library_api_shortname is not None: @@ -102,7 +109,11 @@ def generate_from_yaml( versions_file=repo_config.versions_file, ) - util.repo_level_post_process( + # we skip monorepo_postprocessing if not in a monorepo + if not config.is_monorepo: + return + + monorepo_postprocessing( repository_path=repository_path, versions_file=repo_config.versions_file ) diff --git a/library_generation/model/gapic_inputs.py b/library_generation/model/gapic_inputs.py index b6500a6f3d..4bb9ce64f4 100644 --- a/library_generation/model/gapic_inputs.py +++ b/library_generation/model/gapic_inputs.py @@ -31,9 +31,13 @@ (.*?) \) """ -resource_pattern = r"//google/cloud:common_resources_proto" -location_pattern = r"//google/cloud/location:location_proto" -iam_pattern = r"//google/iam/v1:iam_policy_proto" +# match a line which the first character is "#". +comment_pattern = r"^\s*\#+" +pattern_to_proto = { + r"//google/cloud:common_resources_proto": "google/cloud/common_resources.proto", + r"//google/cloud/location:location_proto": "google/cloud/location/locations.proto", + r"//google/iam/v1:iam_policy_proto": "google/iam/v1/iam_policy.proto", +} transport_pattern = r"transport = \"(.*?)\"" rest_pattern = r"rest_numeric_enums = True" gapic_yaml_pattern = r"gapic_yaml = \"(.*?)\"" @@ -97,7 +101,9 @@ def parse( if len(assembly_target) > 0: include_samples = __parse_include_samples(assembly_target[0]) if len(gapic_target) == 0: - return GapicInputs(include_samples=include_samples) + return GapicInputs( + additional_protos=additional_protos, include_samples=include_samples + ) transport = __parse_transport(gapic_target[0]) rest_numeric_enum = __parse_rest_numeric_enums(gapic_target[0]) @@ -119,12 +125,16 @@ def parse( def __parse_additional_protos(proto_library_target: str) -> str: res = [" "] - if len(re.findall(resource_pattern, proto_library_target)) != 0: - res.append("google/cloud/common_resources.proto") - if len(re.findall(location_pattern, proto_library_target)) != 0: - res.append("google/cloud/location/locations.proto") - if len(re.findall(iam_pattern, proto_library_target)) != 0: - res.append("google/iam/v1/iam_policy.proto") + lines = proto_library_target.split("\n") + for line in lines: + if len(re.findall(comment_pattern, line)) != 0: + # skip a line which the first charactor is "#" since it's + # a comment. + continue + for pattern in pattern_to_proto: + if len(re.findall(pattern, line)) == 0: + continue + res.append(pattern_to_proto[pattern]) return " ".join(res) diff --git a/library_generation/model/generation_config.py b/library_generation/model/generation_config.py index 3a59958a63..22823b903d 100644 --- a/library_generation/model/generation_config.py +++ b/library_generation/model/generation_config.py @@ -46,6 +46,8 @@ def __init__( self.libraries = libraries self.grpc_version = grpc_version self.protobuf_version = protobuf_version + # monorepos have more than one library defined in the config yaml + self.is_monorepo = len(libraries) > 1 def from_yaml(path_to_yaml: str) -> GenerationConfig: @@ -92,6 +94,9 @@ def from_yaml(path_to_yaml: str) -> GenerationConfig: rpc_documentation=__optional(library, "rpc_documentation", None), cloud_api=__optional(library, "cloud_api", True), requires_billing=__optional(library, "requires_billing", True), + extra_versioned_modules=__optional( + library, "extra_versioned_modules", None + ), ) parsed_libraries.append(new_library) diff --git a/library_generation/model/library_config.py b/library_generation/model/library_config.py index 9d281b912c..b6f8ae1b48 100644 --- a/library_generation/model/library_config.py +++ b/library_generation/model/library_config.py @@ -46,6 +46,7 @@ def __init__( rpc_documentation: Optional[str] = None, cloud_api: Optional[bool] = True, requires_billing: Optional[bool] = True, + extra_versioned_modules: Optional[str] = None, ): self.api_shortname = api_shortname self.api_description = api_description @@ -69,3 +70,4 @@ def __init__( self.rpc_documentation = rpc_documentation self.cloud_api = cloud_api self.requires_billing = requires_billing + self.extra_versioned_modules = extra_versioned_modules diff --git a/library_generation/owlbot/bin/entrypoint.sh b/library_generation/owlbot/bin/entrypoint.sh index a8d5a730e3..e7eb91c179 100755 --- a/library_generation/owlbot/bin/entrypoint.sh +++ b/library_generation/owlbot/bin/entrypoint.sh @@ -28,6 +28,7 @@ scripts_root=$1 versions_file=$2 configuration_yaml=$3 + # This script can be used to process HW libraries and monorepo # (google-cloud-java) libraries, which require a slightly different treatment # monorepo folders have an .OwlBot.yaml file in the module folder (e.g. @@ -46,7 +47,6 @@ fi # Runs template and etc in current working directory -monorepo=$1 # apply repo templates echo "Rendering templates" @@ -56,14 +56,17 @@ python3 "${scripts_root}/owlbot/src/apply_repo_templates.py" "${configuration_ya echo "Retrieving files from owl-bot-staging directory..." if [ -f "owlbot.py" ] then + # we use an empty synthtool folder to prevent cached templates from being used + export SYNTHTOOL_TEMPLATES=$(mktemp -d) # defaults to run owlbot.py python3 owlbot.py + export SYNTHTOOL_TEMPLATES="" fi echo "...done" # write or restore pom.xml files echo "Generating missing pom.xml..." -python3 "${scripts_root}/owlbot/src/fix-poms.py" "${versions_file}" "true" +python3 "${scripts_root}/owlbot/src/fix-poms.py" "${versions_file}" "${monorepo}" echo "...done" # write or restore clirr-ignored-differences.xml @@ -76,16 +79,7 @@ echo "Fixing missing license headers..." python3 "${scripts_root}/owlbot/src/fix-license-headers.py" echo "...done" -# TODO: re-enable this once we resolve thrashing -# restore license headers years -# echo "Restoring copyright years..." -# /owlbot/bin/restore_license_headers.sh -# echo "...done" - # ensure formatting on all .java files in the repository echo "Reformatting source..." -mvn fmt:format +mvn fmt:format -V --batch-mode --no-transfer-progress echo "...done" - - - diff --git a/library_generation/owlbot/src/apply_repo_templates.py b/library_generation/owlbot/src/apply_repo_templates.py index 929ffb66f2..26e9c3509d 100644 --- a/library_generation/owlbot/src/apply_repo_templates.py +++ b/library_generation/owlbot/src/apply_repo_templates.py @@ -13,7 +13,7 @@ from library_generation.model.generation_config import from_yaml script_dir = os.path.dirname(os.path.realpath(__file__)) -repo_templates_path = os.path.join(script_dir, "..", "templates", "java_library") +repo_templates_path = os.path.normpath(os.path.join(script_dir, "..", "templates")) def apply_repo_templates(configuration_yaml_path: str, monorepo: bool) -> None: diff --git a/library_generation/owlbot/src/fix-poms.py b/library_generation/owlbot/src/fix-poms.py index b57012fcf8..4bfbe05057 100644 --- a/library_generation/owlbot/src/fix-poms.py +++ b/library_generation/owlbot/src/fix-poms.py @@ -559,7 +559,5 @@ def main(versions_file, monorepo): if __name__ == "__main__": versions_file = sys.argv[1] - monorepo = sys.argv[2] - if monorepo == "true": - monorepo = True + monorepo = True if sys.argv[2].lower() == "true" else False main(versions_file, monorepo) diff --git a/library_generation/postprocess_library.sh b/library_generation/postprocess_library.sh index b4f4d11dbc..66c0c1a020 100755 --- a/library_generation/postprocess_library.sh +++ b/library_generation/postprocess_library.sh @@ -22,7 +22,7 @@ # different logic # 8 - configuration_yaml_path: path to the configuration yaml containing library # generation information for this library -set -eo pipefail +set -exo pipefail scripts_root=$(dirname "$(readlink -f "$0")") postprocessing_target=$1 @@ -61,22 +61,52 @@ fi # we determine the location of the .OwlBot.yaml file by checking if the target # folder is a monorepo folder or not -if [[ "${postprocessing_target}" == *google-cloud-java* ]]; then +if [[ "${is_monorepo}" == "true" ]]; then owlbot_yaml_relative_path=".OwlBot.yaml" else owlbot_yaml_relative_path=".github/.OwlBot.yaml" fi +# Default values for running copy-code directly from host +repo_bindings="-v ${postprocessing_target}:/workspace" +repo_workspace="/workspace" +preprocessed_libraries_binding="${owlbot_cli_source_folder}" + +# When running docker inside docker, we run into the issue of volume bindings +# being mapped from the host machine to the child container (instead of the +# parent container to child container) because we bind the `docker.sock` socket +# to the parent container (i.e. docker calls use the host's filesystem context) +# see https://serverfault.com/a/819371 +# We solve this by referencing environment variables that will be +# set to produce the correct volume mapping. +# +# The workflow is: to check if we are in a docker container (via passed env var) +# and use managed volumes (docker volume create) instead of bindings +# (-v /path:/other-path). The volume names are also received as env vars. + +if [[ -n "${RUNNING_IN_DOCKER}" ]]; then + set -u # temporarily fail on unset variables + repo_bindings="${REPO_BINDING_VOLUMES}" + set +u + library_name=$(echo "${postprocessing_target}" | rev | cut -d'/' -f1 | rev) + repo_workspace="/workspace/" + if [[ "${is_monorepo}" == "true" ]]; then + monorepo_name=$(echo "${postprocessing_target}" | rev | cut -d'/' -f2 | rev) + repo_workspace+="${monorepo_name}/" + fi + repo_workspace+="${library_name}" +fi + docker run --rm \ --user "$(id -u)":"$(id -g)" \ - -v "${postprocessing_target}:/repo" \ - -v "${owlbot_cli_source_folder}:/pre-processed-libraries" \ - -w /repo \ + ${repo_bindings} \ + -v "/tmp:/tmp" \ + -w "${repo_workspace}" \ --env HOME=/tmp \ gcr.io/cloud-devrel-public-resources/owlbot-cli@"${owlbot_cli_image_sha}" \ copy-code \ --source-repo-commit-hash=none \ - --source-repo=/pre-processed-libraries \ + --source-repo="${preprocessed_libraries_binding}" \ --config-file="${owlbot_yaml_relative_path}" # we clone the synthtool library and manually build it @@ -86,8 +116,10 @@ pushd /tmp/synthtool if [ ! -d "synthtool" ]; then git clone https://github.com/googleapis/synthtool.git fi +git config --global --add safe.directory /tmp/synthtool/synthtool pushd "synthtool" +git fetch --all git reset --hard "${synthtool_commitish}" python3 -m pip install -e . diff --git a/library_generation/setup.py b/library_generation/setup.py old mode 100644 new mode 100755 index c8b3418cf4..477346e711 --- a/library_generation/setup.py +++ b/library_generation/setup.py @@ -16,9 +16,10 @@ "templates/*.j2", "gapic-generator-java-wrapper", "requirements.*", - "owlbot/src/requirements.*", "owlbot/bin/*.sh", - "owlbot/templates/**/*.j2", + "owlbot/templates/clirr/*.j2", + "owlbot/templates/poms/*.j2", + "owlbot/templates/java_library/**/*", ], }, ) diff --git a/library_generation/test/container_integration_tests.sh b/library_generation/test/container_integration_tests.sh new file mode 100644 index 0000000000..a60c733df9 --- /dev/null +++ b/library_generation/test/container_integration_tests.sh @@ -0,0 +1,49 @@ +#!/bin/bash +# This is a wrapper of integration_tests.py that sets up the environment to run +# the script in a docker container + +set -xe +if [[ -z "${TEST_IMAGE_ID}" ]]; then + echo "required environemnt variable TEST_IMAGE_ID is not set" + exit 1 +fi + +repo_volumes="" +for repo in google-cloud-java java-bigtable; do + if [[ ! -d "${repo}" ]]; then + git clone "https://github.com/googleapis/${repo}" + fi + pushd "${repo}" + git reset --hard main + popd + + # We use a volume to hold the repositories used in the + # integration tests. This is because the test container creates a child + # container using the host machine's docker socket, meaning that we can only + # reference volumes created from within the host machine (i.e. the machine + # running this script) + # + # To summarize, we create a special volume that can be referenced both in the + # main container and in any child containers created by this one. + volume_name="repo-${repo}" + if [[ $(docker volume inspect "${volume_name}") != '[]' ]]; then + docker volume rm "${volume_name}" + fi + docker volume create \ + --name "${volume_name}" \ + --opt "type=none" \ + --opt "device=$(pwd)/${repo}" \ + --opt "o=bind" + + repo_volumes="${repo_volumes} -v ${volume_name}:/workspace/${repo}" +done + +docker run --rm \ + ${repo_volumes} \ + -v /tmp:/tmp \ + -v /var/run/docker.sock:/var/run/docker.sock \ + -e "RUNNING_IN_DOCKER=true" \ + -e "REPO_BINDING_VOLUMES=${repo_volumes}" \ + -w "/src" \ + "${TEST_IMAGE_ID}" \ + python -m unittest /src/test/integration_tests.py diff --git a/library_generation/test/integration_tests.py b/library_generation/test/integration_tests.py old mode 100644 new mode 100755 index 2380e15452..3bf50d0394 --- a/library_generation/test/integration_tests.py +++ b/library_generation/test/integration_tests.py @@ -17,16 +17,22 @@ import unittest from distutils.dir_util import copy_tree from distutils.file_util import copy_file +from filecmp import cmp from filecmp import dircmp from git import Repo from pathlib import Path from typing import List -from typing import Dict + +from library_generation.generate_pr_description import generate_pr_descriptions from library_generation.generate_repo import generate_from_yaml -from library_generation.model.generation_config import from_yaml +from library_generation.model.generation_config import from_yaml, GenerationConfig from library_generation.test.compare_poms import compare_xml -from library_generation.utilities import get_library_name +from library_generation.utilities import ( + get_library_name, + sh_util as shell_call, + run_process_and_print_output, +) config_name = "generation_config.yaml" script_dir = os.path.dirname(os.path.realpath(__file__)) @@ -36,55 +42,129 @@ config_dir = f"{script_dir}/resources/integration" golden_dir = f"{config_dir}/golden" repo_prefix = "https://github.com/googleapis" -committish_list = ["chore/test-hermetic-build"] # google-cloud-java +output_dir = shell_call("get_output_folder") +# this map tells which branch of each repo should we use for our diff tests +committish_map = { + "google-cloud-java": "chore/test-hermetic-build", + "java-bigtable": "chore/test-hermetic-build", +} class IntegrationTest(unittest.TestCase): + def test_get_commit_message_success(self): + repo_url = "https://github.com/googleapis/googleapis.git" + config_files = self.__get_config_files(config_dir) + monorepo_baseline_commit = "a17d4caf184b050d50cacf2b0d579ce72c31ce74" + split_repo_baseline_commit = "679060c64136e85b52838f53cfe612ce51e60d1d" + for repo, config_file in config_files: + baseline_commit = ( + monorepo_baseline_commit + if repo == "google-cloud-java" + else split_repo_baseline_commit + ) + description = generate_pr_descriptions( + generation_config_yaml=config_file, + repo_url=repo_url, + baseline_commit=baseline_commit, + ) + description_file = f"{config_dir}/{repo}/pr-description.txt" + if os.path.isfile(f"{description_file}"): + os.remove(f"{description_file}") + with open(f"{description_file}", "w+") as f: + f.write(description) + self.assertTrue( + cmp( + f"{config_dir}/{repo}/pr-description-golden.txt", + f"{description_file}", + ), + "The generated PR description does not match the expected golden file", + ) + os.remove(f"{description_file}") + def test_generate_repo(self): shutil.rmtree(f"{golden_dir}", ignore_errors=True) os.makedirs(f"{golden_dir}", exist_ok=True) config_files = self.__get_config_files(config_dir) - i = 0 - for repo, config_file in config_files.items(): - repo_dest = f"{golden_dir}/{repo}" - self.__pull_repo_to(Path(repo_dest), repo, committish_list[i]) - library_names = self.__get_library_names_from_config(config_file) + for repo, config_file in config_files: + config = from_yaml(config_file) + repo_dest = self.__pull_repo_to( + Path(f"{output_dir}/{repo}"), repo, committish_map[repo] + ) + library_names = self.__get_library_names_from_config(config) # prepare golden files for library_name in library_names: - copy_tree(f"{repo_dest}/{library_name}", f"{golden_dir}/{library_name}") - copy_tree( - f"{repo_dest}/gapic-libraries-bom", f"{golden_dir}/gapic-libraries-bom" - ) - copy_file(f"{repo_dest}/pom.xml", golden_dir) + if config.is_monorepo: + copy_tree( + f"{repo_dest}/{library_name}", f"{golden_dir}/{library_name}" + ) + copy_tree( + f"{repo_dest}/gapic-libraries-bom", + f"{golden_dir}/gapic-libraries-bom", + ) + copy_file(f"{repo_dest}/pom.xml", golden_dir) + else: + copy_tree(f"{repo_dest}", f"{golden_dir}/{library_name}") generate_from_yaml( generation_config_yaml=config_file, repository_path=repo_dest ) # compare result + print( + "Generation finished successfully. Will now compare differences between generated and existing libraries" + ) for library_name in library_names: - print( - f"Compare generation result: " - f"expected library in {golden_dir}/{library_name}, " - f"actual library in {repo_dest}/{library_name}." + actual_library = ( + f"{repo_dest}/{library_name}" if config.is_monorepo else repo_dest + ) + print("*" * 50) + print(f"Checking for differences in '{library_name}'.") + print(f" The expected library is in {golden_dir}/{library_name}.") + print(f" The actual library is in {actual_library}. ") + target_repo_dest = ( + f"{repo_dest}/{library_name}" if config.is_monorepo else repo_dest ) compare_result = dircmp( f"{golden_dir}/{library_name}", - f"{repo_dest}/{library_name}", + target_repo_dest, ignore=[".repo-metadata.json"], ) + diff_files = [] + golden_only = [] + generated_only = [] # compare source code - self.assertEqual([], compare_result.left_only) - self.assertEqual([], compare_result.right_only) - self.assertEqual([], compare_result.diff_files) - print("Source code comparison succeed.") + self.__recursive_diff_files( + compare_result, diff_files, golden_only, generated_only + ) + + # print all found differences for inspection + print_file = lambda f: print(f" - {f}") + if len(diff_files) > 0: + print(" Some files (found in both folders) are differing:") + [print_file(f) for f in diff_files] + if len(golden_only) > 0: + print(" There were files found only in the golden dir:") + [print_file(f) for f in golden_only] + if len(generated_only) > 0: + print(" Some files were found to have differences:") + [print_file(f) for f in generated_only] + + self.assertTrue(len(golden_only) == 0) + self.assertTrue(len(generated_only) == 0) + self.assertTrue(len(diff_files) == 0) + + print(" No differences found in {library_name}") # compare .repo-metadata.json self.assertTrue( self.__compare_json_files( f"{golden_dir}/{library_name}/.repo-metadata.json", - f"{repo_dest}/{library_name}/.repo-metadata.json", + f"{target_repo_dest}/.repo-metadata.json", ), - msg=f"The generated {library_name}/.repo-metadata.json is different from golden.", + msg=f" The generated {library_name}/.repo-metadata.json is different from golden.", ) - print(".repo-metadata.json comparison succeed.") + print(" .repo-metadata.json comparison succeed.") + + if not config.is_monorepo: + continue + # compare gapic-libraries-bom/pom.xml and pom.xml self.assertFalse( compare_xml( @@ -93,7 +173,7 @@ def test_generate_repo(self): False, ) ) - print("gapic-libraries-bom/pom.xml comparison succeed.") + print(" gapic-libraries-bom/pom.xml comparison succeed.") self.assertFalse( compare_xml( f"{golden_dir}/pom.xml", @@ -101,20 +181,37 @@ def test_generate_repo(self): False, ) ) - print("pom.xml comparison succeed.") - # remove google-cloud-java - i += 1 + print(" pom.xml comparison succeed.") @classmethod - def __pull_repo_to(cls, dest: Path, repo: str, committish: str): - repo_url = f"{repo_prefix}/{repo}" - print(f"Cloning repository {repo_url}") - repo = Repo.clone_from(repo_url, dest) + def __pull_repo_to(cls, default_dest: Path, repo: str, committish: str) -> str: + if "RUNNING_IN_DOCKER" in os.environ: + # the docker image expects the repo to be in /workspace + dest_in_docker = f"/workspace/{repo}" + run_process_and_print_output( + [ + "git", + "config", + "--global", + "--add", + "safe.directory", + dest_in_docker, + ], + f"Add /workspace/{repo} to safe directories", + ) + dest = Path(dest_in_docker) + repo = Repo(dest) + else: + dest = default_dest + shutil.rmtree(dest, ignore_errors=True) + repo_url = f"{repo_prefix}/{repo}" + print(f"Cloning repository {repo_url}") + repo = Repo.clone_from(repo_url, dest) repo.git.checkout(committish) + return str(dest) @classmethod - def __get_library_names_from_config(cls, config_path: str) -> List[str]: - config = from_yaml(config_path) + def __get_library_names_from_config(cls, config: GenerationConfig) -> List[str]: library_names = [] for library in config.libraries: library_names.append(f"java-{get_library_name(library)}") @@ -122,15 +219,16 @@ def __get_library_names_from_config(cls, config_path: str) -> List[str]: return library_names @classmethod - def __get_config_files(cls, path: str) -> Dict[str, str]: - config_files = {} + def __get_config_files(cls, path: str) -> List[tuple[str, str]]: + config_files = [] for sub_dir in Path(path).resolve().iterdir(): + if sub_dir.is_file(): + continue repo = sub_dir.name - # skip the split repo. - if repo == "golden" or repo == "java-bigtable": + if repo in ["golden", "java-bigtable"]: continue config = f"{sub_dir}/{config_name}" - config_files[repo] = config + config_files.append((repo, config)) return config_files @@ -147,3 +245,24 @@ def __load_json_to_sorted_list(cls, path: str) -> List[tuple]: res = [(key, value) for key, value in data.items()] return sorted(res, key=lambda x: x[0]) + + @classmethod + def __recursive_diff_files( + self, + dcmp: dircmp, + diff_files: List[str], + left_only: List[str], + right_only: List[str], + dirname: str = "", + ): + """ + recursively compares two subdirectories. The found differences are passed to three expected list references + """ + append_dirname = lambda d: dirname + d + diff_files.extend(map(append_dirname, dcmp.diff_files)) + left_only.extend(map(append_dirname, dcmp.left_only)) + right_only.extend(map(append_dirname, dcmp.right_only)) + for sub_dirname, sub_dcmp in dcmp.subdirs.items(): + self.__recursive_diff_files( + sub_dcmp, diff_files, left_only, right_only, dirname + sub_dirname + "/" + ) diff --git a/library_generation/test/resources/goldens/.repo-metadata-golden.json b/library_generation/test/resources/goldens/.repo-metadata-monorepo-golden.json similarity index 100% rename from library_generation/test/resources/goldens/.repo-metadata-golden.json rename to library_generation/test/resources/goldens/.repo-metadata-monorepo-golden.json diff --git a/library_generation/test/resources/goldens/.repo-metadata-non-monorepo-golden.json b/library_generation/test/resources/goldens/.repo-metadata-non-monorepo-golden.json new file mode 100644 index 0000000000..9e4a878d67 --- /dev/null +++ b/library_generation/test/resources/goldens/.repo-metadata-non-monorepo-golden.json @@ -0,0 +1,19 @@ +{ + "api_shortname": "baremetalsolution", + "name_pretty": "Bare Metal Solution", + "product_documentation": "https://cloud.google.com/bare-metal/docs", + "api_description": "Bring your Oracle workloads to Google Cloud with Bare Metal Solution and jumpstart your cloud journey with minimal risk.", + "client_documentation": "https://cloud.google.com/java/docs/reference/google-cloud-bare-metal-solution/latest/overview", + "release_level": "preview", + "transport": "grpc", + "language": "java", + "repo": "googleapis/java-bare-metal-solution", + "repo_short": "java-bare-metal-solution", + "distribution_name": "com.google.cloud:google-cloud-bare-metal-solution", + "api_id": "baremetalsolution.googleapis.com", + "library_type": "GAPIC_COMBO", + "requires_billing": true, + "rest_documentation": "https://cloud.google.com/bare-metal/docs/reference/rest", + "rpc_documentation": "https://cloud.google.com/bare-metal/docs/reference/rpc", + "extra_versioned_modules": "test-module" +} \ No newline at end of file diff --git a/library_generation/test/resources/integration/google-cloud-java/generation_config.yaml b/library_generation/test/resources/integration/google-cloud-java/generation_config.yaml index 349c10385c..839f80996e 100644 --- a/library_generation/test/resources/integration/google-cloud-java/generation_config.yaml +++ b/library_generation/test/resources/integration/google-cloud-java/generation_config.yaml @@ -1,8 +1,8 @@ -gapic_generator_version: 2.34.0 +gapic_generator_version: 2.37.0 protobuf_version: 25.2 -googleapis_commitish: 1a45bf7393b52407188c82e63101db7dc9c72026 +googleapis_commitish: 4ce0ff67a3d4509be641cbe47a35844ddc1268fc owlbot_cli_image: sha256:623647ee79ac605858d09e60c1382a716c125fb776f69301b72de1cd35d49409 -synthtool_commitish: 6612ab8f3afcd5e292aecd647f0fa68812c9f5b5 +synthtool_commitish: 5e1fb2032fa44bc170677b38713023b4fec51a4e template_excludes: - ".github/*" - ".kokoro/*" @@ -25,19 +25,34 @@ libraries: GAPICs: - proto_path: google/cloud/apigeeconnect/v1 - - api_shortname: cloudasset - name_pretty: Cloud Asset Inventory - product_documentation: "https://cloud.google.com/resource-manager/docs/cloud-asset-inventory/overview" - api_description: "provides inventory services based on a time series database. This database keeps a five week history of Google Cloud asset metadata. The Cloud Asset Inventory export service allows you to export all asset metadata at a certain timestamp or export event change history during a timeframe." - library_name: "asset" - client_documentation: "https://cloud.google.com/java/docs/reference/google-cloud-asset/latest/overview" - distribution_name: "com.google.cloud:google-cloud-asset" - release_level: "stable" - issue_tracker: "https://issuetracker.google.com/issues/new?component=187210&template=0" - api_reference: "https://cloud.google.com/resource-manager/docs/cloud-asset-inventory/overview" + - api_shortname: alloydb + name_pretty: AlloyDB + product_documentation: https://cloud.google.com/alloydb/ + api_description: AlloyDB is a fully managed, PostgreSQL-compatible database service + with industry-leading performance, availability, and scale. + rest_documentation: https://cloud.google.com/alloydb/docs/reference/rest + GAPICs: + - proto_path: google/cloud/alloydb/v1 + - proto_path: google/cloud/alloydb/v1alpha + - proto_path: google/cloud/alloydb/v1beta + + - api_shortname: alloydb + name_pretty: AlloyDB connectors + product_documentation: https://cloud.google.com/alloydb/docs + api_description: AlloyDB is a fully-managed, PostgreSQL-compatible database for + demanding transactional workloads. It provides enterprise-grade performance and + availability while maintaining 100% compatibility with open-source PostgreSQL. + library_name: alloydb-connectors + rest_documentation: https://cloud.google.com/alloydb/docs/reference/rest + GAPICs: + - proto_path: google/cloud/alloydb/connectors/v1 + - proto_path: google/cloud/alloydb/connectors/v1alpha + - proto_path: google/cloud/alloydb/connectors/v1beta + + - api_shortname: cloudcontrolspartner + name_pretty: Cloud Controls Partner API + product_documentation: https://cloud.google.com/sovereign-controls-by-partners/docs/sovereign-partners + api_description: Provides insights about your customers and their Assured Workloads based on your Sovereign Controls by Partners offering. GAPICs: - - proto_path: google/cloud/asset/v1 - - proto_path: google/cloud/asset/v1p1beta1 - - proto_path: google/cloud/asset/v1p2beta1 - - proto_path: google/cloud/asset/v1p5beta1 - - proto_path: google/cloud/asset/v1p7beta1 + - proto_path: google/cloud/cloudcontrolspartner/v1 + - proto_path: google/cloud/cloudcontrolspartner/v1beta \ No newline at end of file diff --git a/library_generation/test/resources/integration/google-cloud-java/pr-description-golden.txt b/library_generation/test/resources/integration/google-cloud-java/pr-description-golden.txt new file mode 100644 index 0000000000..0dcbacee27 --- /dev/null +++ b/library_generation/test/resources/integration/google-cloud-java/pr-description-golden.txt @@ -0,0 +1,52 @@ +This pull request is generated with proto changes between googleapis commit a17d4caf184b050d50cacf2b0d579ce72c31ce74 (exclusive) and 4ce0ff67a3d4509be641cbe47a35844ddc1268fc (inclusive). +Qualified commits are: +[googleapis/googleapis@7659dd2](https://github.com/googleapis/googleapis/commit/7659dd2244563fd902b681bdcadbe5385b8d3462) +[googleapis/googleapis@05d889e](https://github.com/googleapis/googleapis/commit/05d889e7dfe087fc2ddc9de9579f01d4e1c2f35e) +[googleapis/googleapis@aa16fda](https://github.com/googleapis/googleapis/commit/aa16fdad909bc33e2d4ff04cfde56a46d0e52b13) +[googleapis/googleapis@0733fdb](https://github.com/googleapis/googleapis/commit/0733fdb5f745192f9f3c95f8d08039286567cbcc) +[googleapis/googleapis@9e35c62](https://github.com/googleapis/googleapis/commit/9e35c620157d7b11cb5b2e5d0249c5caaee824f3) +[googleapis/googleapis@36dedd0](https://github.com/googleapis/googleapis/commit/36dedd0d9020c19d1c8259003c2fe9656ada7471) +BEGIN_NESTED_COMMIT +docs: [cloudcontrolspartner] update documentation URL + +PiperOrigin-RevId: 612723053 + +END_NESTED_COMMIT +BEGIN_NESTED_COMMIT +feat: [cloudcontrolspartner] added CloudControlsPartner API + +PiperOrigin-RevId: 612632640 + +END_NESTED_COMMIT +BEGIN_NESTED_COMMIT +feat: [alloydb] support for obtaining the public IP address of an Instance +feat: [alloydb] support for getting PSC DNS name from the GetConnectionInfo API +feat: [alloydb] add PSC cluster and instance configuration settings to enable/disable PSC and obtain the PSC endpoint name +feat: [alloydb] add new API to list the databases in a project and location +docs: [alloydb] clarified read pool config is for read pool type instances + +PiperOrigin-RevId: 610475013 + +END_NESTED_COMMIT +BEGIN_NESTED_COMMIT +feat: [alloydb] support for obtaining the public IP address of an Instance +feat: [alloydb] support for getting PSC DNS name from the GetConnectionInfo API + +PiperOrigin-RevId: 610415824 + +END_NESTED_COMMIT +BEGIN_NESTED_COMMIT +docs: [cloudcontrolspartner] Updated comment for method `ListCustomers` in service `CloudControlsPartnerCore` +docs: [cloudcontrolspartner] Updated comment for field `location` in message `.google.cloud.cloudcontrolspartner.v1beta.Workload` +docs: [cloudcontrolspartner] Updated a comment for field `partner_project_id` in message `.google.cloud.cloudcontrolspartner.v1beta.Partner` +docs: [cloudcontrolspartner] Updated documentation URL + +PiperOrigin-RevId: 609026905 + +END_NESTED_COMMIT +BEGIN_NESTED_COMMIT +feat: [cloudcontrolspartner] added CloudControlsPartner API + +PiperOrigin-RevId: 606720708 + +END_NESTED_COMMIT \ No newline at end of file diff --git a/library_generation/test/resources/integration/java-bigtable/generation_config.yaml b/library_generation/test/resources/integration/java-bigtable/generation_config.yaml index 997e2c14c7..48afd9eef7 100644 --- a/library_generation/test/resources/integration/java-bigtable/generation_config.yaml +++ b/library_generation/test/resources/integration/java-bigtable/generation_config.yaml @@ -1,9 +1,8 @@ -gapic_generator_version: 2.32.0 -grpc_version: 1.61.0 +gapic_generator_version: 2.37.0 protobuf_version: 25.2 -googleapis_commitish: 40203ca1880849480bbff7b8715491060bbccdf1 +googleapis_commitish: 9868a57470a969ffa1d21194a5c05d7a6e4e98cc owlbot_cli_image: sha256:623647ee79ac605858d09e60c1382a716c125fb776f69301b72de1cd35d49409 -synthtool_commitish: 6612ab8f3afcd5e292aecd647f0fa68812c9f5b5 +synthtool_commitish: a6fb7d5f072b75698af1cbf06c5b001565753cfb template_excludes: - ".gitignore" - ".kokoro/presubmit/integration.cfg" @@ -23,6 +22,18 @@ template_excludes: libraries: - api_shortname: bigtable name_pretty: Cloud Bigtable + api_description: "Java idiomatic client for Cloud Bigtable." + product_documentation: "https://cloud.google.com/bigtable" + client_documentation: "https://cloud.google.com/java/docs/reference/google-cloud-bigtable/latest/history" + issue_tracker: "https://issuetracker.google.com/savedsearches/559777" + release_level: "stable" + language: "java" + repo: "googleapis/java-bigtable" + repo_short: "java-bigtable" + distribution_name: "com.google.cloud:google-cloud-bigtable" + excluded_poms: "google-cloud-bigtable-bom" + extra_versioned_modules: "google-cloud-bigtable-emulator,google-cloud-bigtable-emulator-core" + codeowner_team: "@googleapis/api-bigtable @googleapis/api-bigtable-partners" library_type: GAPIC_COMBO GAPICs: - proto_path: google/bigtable/admin/v2 diff --git a/library_generation/test/resources/integration/java-bigtable/pr-description-golden.txt b/library_generation/test/resources/integration/java-bigtable/pr-description-golden.txt new file mode 100644 index 0000000000..4cb068a6ee --- /dev/null +++ b/library_generation/test/resources/integration/java-bigtable/pr-description-golden.txt @@ -0,0 +1,16 @@ +This pull request is generated with proto changes between googleapis commit 679060c64136e85b52838f53cfe612ce51e60d1d (exclusive) and fc3043ebe12fb6bc1729c175e1526c859ce751d8 (inclusive). +Qualified commits are: +[googleapis/googleapis@fbcfef0](https://github.com/googleapis/googleapis/commit/fbcfef09510b842774530989889ed1584a8b5acb) +[googleapis/googleapis@63d2a60](https://github.com/googleapis/googleapis/commit/63d2a60056ad5b156c05c7fb13138fc886c3b739) +BEGIN_NESTED_COMMIT +fix: extend timeouts for deleting snapshots, backups and tables + +PiperOrigin-RevId: 605388988 + +END_NESTED_COMMIT +BEGIN_NESTED_COMMIT +chore: update retry settings for backup rpcs + +PiperOrigin-RevId: 605367937 + +END_NESTED_COMMIT \ No newline at end of file diff --git a/library_generation/test/resources/misc/BUILD_comment_common_resources.bazel b/library_generation/test/resources/misc/BUILD_comment_common_resources.bazel new file mode 100644 index 0000000000..126ffdb7ca --- /dev/null +++ b/library_generation/test/resources/misc/BUILD_comment_common_resources.bazel @@ -0,0 +1,5 @@ +proto_library_with_info( + deps = [ + #"//google/cloud:common_resources_proto", + ] +) \ No newline at end of file diff --git a/library_generation/test/resources/misc/BUILD_comment_iam_policy.bazel b/library_generation/test/resources/misc/BUILD_comment_iam_policy.bazel new file mode 100644 index 0000000000..a9a2c1ca75 --- /dev/null +++ b/library_generation/test/resources/misc/BUILD_comment_iam_policy.bazel @@ -0,0 +1,5 @@ +proto_library_with_info( + deps = [ + # "//google/iam/v1:iam_policy_proto", + ] +) \ No newline at end of file diff --git a/library_generation/test/resources/misc/BUILD_comment_locations.bazel b/library_generation/test/resources/misc/BUILD_comment_locations.bazel new file mode 100644 index 0000000000..8b96e3ab81 --- /dev/null +++ b/library_generation/test/resources/misc/BUILD_comment_locations.bazel @@ -0,0 +1,5 @@ +proto_library_with_info( + deps = [ + # "//google/cloud/location:location_proto", + ] +) \ No newline at end of file diff --git a/library_generation/test/resources/misc/BUILD_common_resources.bazel b/library_generation/test/resources/misc/BUILD_common_resources.bazel new file mode 100644 index 0000000000..9b749e6ad5 --- /dev/null +++ b/library_generation/test/resources/misc/BUILD_common_resources.bazel @@ -0,0 +1,5 @@ +proto_library_with_info( + deps = [ + "//google/cloud:common_resources_proto", + ] +) \ No newline at end of file diff --git a/library_generation/test/resources/search_additional_protos/BUILD_iam_locations.bazel b/library_generation/test/resources/misc/BUILD_iam_locations.bazel similarity index 57% rename from library_generation/test/resources/search_additional_protos/BUILD_iam_locations.bazel rename to library_generation/test/resources/misc/BUILD_iam_locations.bazel index e8241995e2..d0c971da7c 100644 --- a/library_generation/test/resources/search_additional_protos/BUILD_iam_locations.bazel +++ b/library_generation/test/resources/misc/BUILD_iam_locations.bazel @@ -1,8 +1,6 @@ -# this file is only used in testing `get_gapic_additional_protos_from_BUILD` in utilities.sh - proto_library_with_info( deps = [ - "//google/iam/v1:iam_policy_proto", "//google/cloud/location:location_proto", + "//google/iam/v1:iam_policy_proto", ] ) \ No newline at end of file diff --git a/library_generation/test/resources/misc/BUILD_iam_policy.bazel b/library_generation/test/resources/misc/BUILD_iam_policy.bazel new file mode 100644 index 0000000000..af5d4a32f8 --- /dev/null +++ b/library_generation/test/resources/misc/BUILD_iam_policy.bazel @@ -0,0 +1,5 @@ +proto_library_with_info( + deps = [ + "//google/iam/v1:iam_policy_proto", + ] +) \ No newline at end of file diff --git a/library_generation/test/resources/misc/BUILD_locations.bazel b/library_generation/test/resources/misc/BUILD_locations.bazel new file mode 100644 index 0000000000..29ee14fdba --- /dev/null +++ b/library_generation/test/resources/misc/BUILD_locations.bazel @@ -0,0 +1,5 @@ +proto_library_with_info( + deps = [ + "//google/cloud/location:location_proto", + ] +) \ No newline at end of file diff --git a/library_generation/test/resources/misc/BUILD_no_additional_protos.bazel b/library_generation/test/resources/misc/BUILD_no_additional_protos.bazel new file mode 100644 index 0000000000..a22257cad4 --- /dev/null +++ b/library_generation/test/resources/misc/BUILD_no_additional_protos.bazel @@ -0,0 +1,4 @@ +proto_library_with_info( + deps = [ + ] +) \ No newline at end of file diff --git a/library_generation/test/resources/search_additional_protos/BUILD_common_resources.bazel b/library_generation/test/resources/search_additional_protos/BUILD_common_resources.bazel deleted file mode 100644 index 45e3987adb..0000000000 --- a/library_generation/test/resources/search_additional_protos/BUILD_common_resources.bazel +++ /dev/null @@ -1,6 +0,0 @@ -# this file is only used in testing `get_gapic_additional_protos_from_BUILD` in utilities.sh - -proto_library_with_info( - deps = [ - ] -) \ No newline at end of file diff --git a/library_generation/test/resources/search_additional_protos/BUILD_iam_policy.bazel b/library_generation/test/resources/search_additional_protos/BUILD_iam_policy.bazel deleted file mode 100644 index 81064a7eb4..0000000000 --- a/library_generation/test/resources/search_additional_protos/BUILD_iam_policy.bazel +++ /dev/null @@ -1,7 +0,0 @@ -# this file is only used in testing `get_gapic_additional_protos_from_BUILD` in utilities.sh - -proto_library_with_info( - deps = [ - "//google/iam/v1:iam_policy_proto", - ] -) \ No newline at end of file diff --git a/library_generation/test/resources/search_additional_protos/BUILD_locations.bazel b/library_generation/test/resources/search_additional_protos/BUILD_locations.bazel deleted file mode 100644 index 07faa4ac95..0000000000 --- a/library_generation/test/resources/search_additional_protos/BUILD_locations.bazel +++ /dev/null @@ -1,7 +0,0 @@ -# this file is only used in testing `get_gapic_additional_protos_from_BUILD` in utilities.sh - -proto_library_with_info( - deps = [ - "//google/cloud/location:location_proto", - ] -) \ No newline at end of file diff --git a/library_generation/test/resources/test_repo_level_postprocess/gapic-libraries-bom/pom-golden.xml b/library_generation/test/resources/test_monorepo_postprocessing/gapic-libraries-bom/pom-golden.xml similarity index 100% rename from library_generation/test/resources/test_repo_level_postprocess/gapic-libraries-bom/pom-golden.xml rename to library_generation/test/resources/test_monorepo_postprocessing/gapic-libraries-bom/pom-golden.xml diff --git a/library_generation/test/resources/test_repo_level_postprocess/java-dns/pom.xml b/library_generation/test/resources/test_monorepo_postprocessing/java-dns/pom.xml similarity index 100% rename from library_generation/test/resources/test_repo_level_postprocess/java-dns/pom.xml rename to library_generation/test/resources/test_monorepo_postprocessing/java-dns/pom.xml diff --git a/library_generation/test/resources/test_repo_level_postprocess/java-service-control/google-cloud-service-control-bom/pom.xml b/library_generation/test/resources/test_monorepo_postprocessing/java-service-control/google-cloud-service-control-bom/pom.xml similarity index 100% rename from library_generation/test/resources/test_repo_level_postprocess/java-service-control/google-cloud-service-control-bom/pom.xml rename to library_generation/test/resources/test_monorepo_postprocessing/java-service-control/google-cloud-service-control-bom/pom.xml diff --git a/library_generation/test/resources/test_repo_level_postprocess/java-tasks/google-cloud-tasks-bom/pom.xml b/library_generation/test/resources/test_monorepo_postprocessing/java-tasks/google-cloud-tasks-bom/pom.xml similarity index 100% rename from library_generation/test/resources/test_repo_level_postprocess/java-tasks/google-cloud-tasks-bom/pom.xml rename to library_generation/test/resources/test_monorepo_postprocessing/java-tasks/google-cloud-tasks-bom/pom.xml diff --git a/library_generation/test/resources/test_repo_level_postprocess/pom-golden.xml b/library_generation/test/resources/test_monorepo_postprocessing/pom-golden.xml similarity index 100% rename from library_generation/test/resources/test_repo_level_postprocess/pom-golden.xml rename to library_generation/test/resources/test_monorepo_postprocessing/pom-golden.xml diff --git a/library_generation/test/resources/test_repo_level_postprocess/versions.txt b/library_generation/test/resources/test_monorepo_postprocessing/versions.txt similarity index 100% rename from library_generation/test/resources/test_repo_level_postprocess/versions.txt rename to library_generation/test/resources/test_monorepo_postprocessing/versions.txt diff --git a/library_generation/test/test_utils.py b/library_generation/test/test_utils.py new file mode 100644 index 0000000000..890cd95362 --- /dev/null +++ b/library_generation/test/test_utils.py @@ -0,0 +1,40 @@ +# Copyright 2024 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +import unittest +from difflib import unified_diff +from pathlib import Path + +from typing import List + + +class FileComparator(unittest.TestCase): + def compare_files(self, expect: str, actual: str): + with open(expect, "r") as f: + expected_lines = f.readlines() + with open(actual, "r") as f: + actual_lines = f.readlines() + + diff = list(unified_diff(expected_lines, actual_lines)) + self.assertEqual( + first=[], second=diff, msg="Unexpected file contents:\n" + "".join(diff) + ) + + +def cleanup(files: List[str]): + for file in files: + path = Path(file).resolve() + if path.is_file(): + path.unlink() + elif path.is_dir(): + path.rmdir() diff --git a/library_generation/test/unit_tests.py b/library_generation/test/utilities_unit_tests.py similarity index 76% rename from library_generation/test/unit_tests.py rename to library_generation/test/utilities_unit_tests.py index a55cf7f6b5..aa6d99ac24 100644 --- a/library_generation/test/unit_tests.py +++ b/library_generation/test/utilities_unit_tests.py @@ -21,8 +21,6 @@ import io import contextlib from pathlib import Path -from difflib import unified_diff -from typing import List from parameterized import parameterized from library_generation import utilities as util from library_generation.model.gapic_config import GapicConfig @@ -30,11 +28,16 @@ from library_generation.model.gapic_inputs import parse as parse_build_file from library_generation.model.generation_config import from_yaml from library_generation.model.library_config import LibraryConfig +from library_generation.test.test_utils import FileComparator +from library_generation.test.test_utils import cleanup +from library_generation.utilities import find_versioned_proto_path +from library_generation.utilities import get_file_paths script_dir = os.path.dirname(os.path.realpath(__file__)) resources_dir = os.path.join(script_dir, "resources") build_file = Path(os.path.join(resources_dir, "misc")).resolve() test_config_dir = Path(os.path.join(resources_dir, "test-config")).resolve() +file_comparator = FileComparator() library_1 = LibraryConfig( api_shortname="baremetalsolution", name_pretty="Bare Metal Solution", @@ -52,6 +55,14 @@ api_description="allows you to encrypt, store, manage, and audit infrastructure and application-level secrets.", gapic_configs=list(), ) +library_3 = LibraryConfig( + api_shortname="secret", + name_pretty="Secret Management Example", + product_documentation="https://cloud.google.com/solutions/", + api_description="allows you to encrypt, store, and audit infrastructure and application-level secrets.", + library_name="secretmanager", + gapic_configs=list(), +) class UtilitiesTest(unittest.TestCase): @@ -206,6 +217,58 @@ def test_from_yaml_succeeds(self): self.assertEqual("google/cloud/asset/v1p5beta1", gapics[3].proto_path) self.assertEqual("google/cloud/asset/v1p7beta1", gapics[4].proto_path) + def test_get_file_paths_from_yaml_success(self): + paths = get_file_paths(from_yaml(f"{test_config_dir}/generation_config.yaml")) + self.assertEqual( + { + "google/cloud/asset/v1": "asset", + "google/cloud/asset/v1p1beta1": "asset", + "google/cloud/asset/v1p2beta1": "asset", + "google/cloud/asset/v1p5beta1": "asset", + "google/cloud/asset/v1p7beta1": "asset", + }, + paths, + ) + + @parameterized.expand( + [ + ( + "google/cloud/aiplatform/v1/schema/predict/params/image_classification.proto", + "google/cloud/aiplatform/v1", + ), + ( + "google/cloud/asset/v1p2beta1/assets.proto", + "google/cloud/asset/v1p2beta1", + ), + ("google/type/color.proto", "google/type/color.proto"), + ] + ) + def test_find_versioned_proto_path(self, file_path, expected): + proto_path = find_versioned_proto_path(file_path) + self.assertEqual(expected, proto_path) + + @parameterized.expand( + [ + ("BUILD_no_additional_protos.bazel", " "), + ("BUILD_common_resources.bazel", " google/cloud/common_resources.proto"), + ("BUILD_comment_common_resources.bazel", " "), + ("BUILD_locations.bazel", " google/cloud/location/locations.proto"), + ("BUILD_comment_locations.bazel", " "), + ("BUILD_iam_policy.bazel", " google/iam/v1/iam_policy.proto"), + ("BUILD_comment_iam_policy.bazel", " "), + ( + "BUILD_iam_locations.bazel", + " google/cloud/location/locations.proto google/iam/v1/iam_policy.proto", + ), + ] + ) + def test_gapic_inputs_parse_additional_protos(self, build_name, expected): + parsed = parse_build_file(build_file, "", build_name) + self.assertEqual( + expected, + parsed.additional_protos, + ) + def test_gapic_inputs_parse_grpc_only_succeeds(self): parsed = parse_build_file(build_file, "", "BUILD_grpc.bazel") self.assertEqual("grpc", parsed.transport) @@ -328,51 +391,43 @@ def test_remove_version_from_returns_self(self): "google/cloud/aiplatform", util.remove_version_from(proto_path) ) - def test_get_version_from_returns_current(self): - versions_file = f"{resources_dir}/misc/versions.txt" - artifact = "gax-grpc" - self.assertEqual( - "2.33.1-SNAPSHOT", util.get_version_from(versions_file, artifact) - ) - - def test_get_version_from_returns_released(self): - versions_file = f"{resources_dir}/misc/versions.txt" - artifact = "gax-grpc" - self.assertEqual("2.34.0", util.get_version_from(versions_file, artifact, True)) - def test_get_library_returns_library_name(self): self.assertEqual("bare-metal-solution", util.get_library_name(library_1)) def test_get_library_returns_api_shortname(self): self.assertEqual("secretmanager", util.get_library_name(library_2)) - def test_generate_prerequisite_files_success(self): - library_path = f"{resources_dir}/goldens" - files = [ + def test_generate_prerequisite_files_non_monorepo_success(self): + library_path = self.__setup_prerequisite_files( + num_libraries=1, library_type="GAPIC_COMBO" + ) + + file_comparator.compare_files( f"{library_path}/.repo-metadata.json", - f"{library_path}/.OwlBot.yaml", - f"{library_path}/owlbot.py", - ] - self.__cleanup(files) - config = self.__get_a_gen_config(1) - proto_path = "google/cloud/baremetalsolution/v2" - transport = "grpc" - util.generate_prerequisite_files( - config=config, - library=library_1, - proto_path=proto_path, - transport=transport, - library_path=library_path, + f"{library_path}/.repo-metadata-non-monorepo-golden.json", + ) + # since this is a single library, we treat this as HW repository, + # meaning that the owlbot yaml will be inside a .github folder + file_comparator.compare_files( + f"{library_path}/.github/.OwlBot.yaml", + f"{library_path}/.OwlBot-golden.yaml", ) + file_comparator.compare_files( + f"{library_path}/owlbot.py", f"{library_path}/owlbot-golden.py" + ) + + def test_generate_prerequisite_files_monorepo_success(self): + library_path = self.__setup_prerequisite_files(num_libraries=2) - self.__compare_files( + file_comparator.compare_files( f"{library_path}/.repo-metadata.json", - f"{library_path}/.repo-metadata-golden.json", + f"{library_path}/.repo-metadata-monorepo-golden.json", ) - self.__compare_files( - f"{library_path}/.OwlBot.yaml", f"{library_path}/.OwlBot-golden.yaml" + file_comparator.compare_files( + f"{library_path}/.OwlBot.yaml", + f"{library_path}/.OwlBot-golden.yaml", ) - self.__compare_files( + file_comparator.compare_files( f"{library_path}/owlbot.py", f"{library_path}/owlbot-golden.py" ) @@ -389,6 +444,17 @@ def test_prepare_repo_monorepo_success(self): ["java-bare-metal-solution", "java-secretmanager"], library_path ) + def test_prepare_repo_monorepo_duplicated_library_name_failed(self): + gen_config = self.__get_a_gen_config(3) + self.assertRaisesRegex( + ValueError, + "secretmanager", + util.prepare_repo, + gen_config, + gen_config.libraries, + f"{resources_dir}/misc", + ) + def test_prepare_repo_monorepo_failed(self): gen_config = self.__get_a_gen_config(2) self.assertRaises( @@ -410,52 +476,58 @@ def test_prepare_repo_split_repo_success(self): library_path = sorted([Path(key).name for key in repo_config.libraries]) self.assertEqual(["misc"], library_path) - def test_repo_level_post_process_success(self): - repository_path = f"{resources_dir}/test_repo_level_postprocess" - versions_file = f"{repository_path}/versions.txt" + def __setup_prerequisite_files( + self, num_libraries: int, library_type: str = "GAPIC_AUTO" + ) -> str: + library_path = f"{resources_dir}/goldens" files = [ - f"{repository_path}/pom.xml", - f"{repository_path}/gapic-libraries-bom/pom.xml", + f"{library_path}/.repo-metadata.json", + f"{library_path}/.OwlBot.yaml", + f"{library_path}/owlbot.py", ] - self.__cleanup(files) - util.repo_level_post_process( - repository_path=repository_path, versions_file=versions_file - ) - self.__compare_files( - expect=f"{repository_path}/pom-golden.xml", - actual=f"{repository_path}/pom.xml", - ) - self.__compare_files( - expect=f"{repository_path}/gapic-libraries-bom/pom-golden.xml", - actual=f"{repository_path}/gapic-libraries-bom/pom.xml", - ) - - def __compare_files(self, expect: str, actual: str): - with open(expect, "r") as f: - expected_lines = f.readlines() - with open(actual, "r") as f: - actual_lines = f.readlines() - - diff = list(unified_diff(expected_lines, actual_lines)) - self.assertEqual( - first=[], second=diff, msg="Unexpected file contents:\n" + "".join(diff) + cleanup(files) + config = self.__get_a_gen_config(num_libraries, library_type=library_type) + proto_path = "google/cloud/baremetalsolution/v2" + transport = "grpc" + util.generate_prerequisite_files( + config=config, + library=library_1, + proto_path=proto_path, + transport=transport, + library_path=library_path, ) + return library_path @staticmethod - def __get_a_gen_config(num: int): + def __get_a_gen_config( + num_libraries: int, library_type: str = "GAPIC_AUTO" + ) -> GenerationConfig: """ - Returns an object of GenerationConfig with one or two of + Returns an object of GenerationConfig with one to three of LibraryConfig objects. Other attributes are set to empty str. - :param num: the number of LibraryConfig objects associated with - the GenerationConfig. Only support one or two. + :param num_libraries: the number of LibraryConfig objects associated with + the GenerationConfig. Only support 1, 2 or 3. :return: an object of GenerationConfig """ - if num > 1: + if num_libraries == 2: libraries = [library_1, library_2] + elif num_libraries == 3: + libraries = [library_1, library_2, library_3] else: libraries = [library_1] + # update libraries with custom configuration (for now, only + # library_type) + for library in libraries: + library.library_type = library_type + if num_libraries == 1: + # treat this as a HW library case to generate a real-life + # repo-metadata + library.extra_versioned_modules = "test-module" + else: + library.extra_versioned_modules = None + return GenerationConfig( gapic_generator_version="", googleapis_commitish="", @@ -478,15 +550,6 @@ def __get_a_gen_config(num: int): libraries=libraries, ) - @staticmethod - def __cleanup(files: List[str]): - for file in files: - path = Path(file).resolve() - if path.is_file(): - path.unlink() - elif path.is_dir(): - path.rmdir() - if __name__ == "__main__": unittest.main() diff --git a/library_generation/test/utils/__init__.py b/library_generation/test/utils/__init__.py new file mode 100644 index 0000000000..e69de29bb2 diff --git a/library_generation/test/utils/commit_message_formatter_unit_tests.py b/library_generation/test/utils/commit_message_formatter_unit_tests.py new file mode 100644 index 0000000000..5fd3599963 --- /dev/null +++ b/library_generation/test/utils/commit_message_formatter_unit_tests.py @@ -0,0 +1,116 @@ +# Copyright 2024 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +import unittest +from unittest.mock import patch + +from library_generation.utils.commit_message_formatter import format_commit_message +from library_generation.utils.commit_message_formatter import wrap_nested_commit + + +class CommitMessageFormatterTest(unittest.TestCase): + def test_format_commit_message_should_add_library_name_for_conventional_commit( + self, + ): + with patch("git.Commit") as mock_commit: + commit = mock_commit.return_value + commit.message = "feat: a commit message\nPiperOrigin-RevId: 123456" + commits = {commit: "example_library"} + self.assertEqual( + [ + "BEGIN_NESTED_COMMIT", + "feat: [example_library] a commit message", + "PiperOrigin-RevId: 123456", + "END_NESTED_COMMIT", + ], + format_commit_message(commits, True), + ) + + def test_format_commit_message_should_add_library_name_for_mutliline_conventional_commit( + self, + ): + with patch("git.Commit") as mock_commit: + commit = mock_commit.return_value + commit.message = "feat: a commit message\nfix: an another commit message\nPiperOrigin-RevId: 123456" + commits = {commit: "example_library"} + self.assertEqual( + [ + "BEGIN_NESTED_COMMIT", + "feat: [example_library] a commit message", + "fix: [example_library] an another commit message", + "PiperOrigin-RevId: 123456", + "END_NESTED_COMMIT", + ], + format_commit_message(commits, True), + ) + + def test_format_commit_message_should_not_add_library_name_for_nonconvnentional_commit( + self, + ): + with patch("git.Commit") as mock_commit: + commit = mock_commit.return_value + commit.message = "PiperOrigin-RevId: 123456" + commits = {commit: "example_library"} + self.assertEqual( + [ + "BEGIN_NESTED_COMMIT", + "PiperOrigin-RevId: 123456", + "END_NESTED_COMMIT", + ], + format_commit_message(commits, True), + ) + + def test_format_commit_message_should_not_add_library_name_if_not_monorepo(self): + with patch("git.Commit") as mock_commit: + commit = mock_commit.return_value + commit.message = "feat: a commit message\nPiperOrigin-RevId: 123456" + commits = {commit: "example_library"} + self.assertEqual( + [ + "BEGIN_NESTED_COMMIT", + "feat: a commit message", + "PiperOrigin-RevId: 123456", + "END_NESTED_COMMIT", + ], + format_commit_message(commits, False), + ) + + def test_format_commit_message_should_not_add_library_name_for_multiline_commit_if_not_monorepo( + self, + ): + with patch("git.Commit") as mock_commit: + commit = mock_commit.return_value + commit.message = "feat: a commit message\nfix: an another commit message\nPiperOrigin-RevId: 123456" + commits = {commit: "example_library"} + self.assertEqual( + [ + "BEGIN_NESTED_COMMIT", + "feat: a commit message", + "fix: an another commit message", + "PiperOrigin-RevId: 123456", + "END_NESTED_COMMIT", + ], + format_commit_message(commits, False), + ) + + def test_wrap_nested_commit_success(self): + messages = ["a commit message", "another message"] + self.assertEqual( + [ + "BEGIN_NESTED_COMMIT", + "a commit message", + "another message", + "END_NESTED_COMMIT", + ], + wrap_nested_commit(messages), + ) diff --git a/library_generation/test/utils/monorepo_postprocessor_unit_tests.py b/library_generation/test/utils/monorepo_postprocessor_unit_tests.py new file mode 100644 index 0000000000..c7df83acaf --- /dev/null +++ b/library_generation/test/utils/monorepo_postprocessor_unit_tests.py @@ -0,0 +1,45 @@ +# Copyright 2024 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +import os +import unittest + +from library_generation.test.test_utils import FileComparator +from library_generation.test.test_utils import cleanup +from library_generation.utils.monorepo_postprocessor import monorepo_postprocessing + +script_dir = os.path.dirname(os.path.realpath(__file__)) +resources_dir = os.path.join(script_dir, "..", "resources") +file_comparator = FileComparator() + + +class MonorepoPostprocessorTest(unittest.TestCase): + def test_monorepo_postprocessing_valid_repository_success(self): + repository_path = f"{resources_dir}/test_monorepo_postprocessing" + versions_file = f"{repository_path}/versions.txt" + files = [ + f"{repository_path}/pom.xml", + f"{repository_path}/gapic-libraries-bom/pom.xml", + ] + cleanup(files) + monorepo_postprocessing( + repository_path=repository_path, versions_file=versions_file + ) + file_comparator.compare_files( + expect=f"{repository_path}/pom-golden.xml", + actual=f"{repository_path}/pom.xml", + ) + file_comparator.compare_files( + expect=f"{repository_path}/gapic-libraries-bom/pom-golden.xml", + actual=f"{repository_path}/gapic-libraries-bom/pom.xml", + ) diff --git a/library_generation/test/utils/pom_generator_unit_tests.py b/library_generation/test/utils/pom_generator_unit_tests.py new file mode 100644 index 0000000000..7a829e58aa --- /dev/null +++ b/library_generation/test/utils/pom_generator_unit_tests.py @@ -0,0 +1,32 @@ +# Copyright 2024 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +import os +import unittest + +from library_generation.utils.pom_generator import get_version_from + +script_dir = os.path.dirname(os.path.realpath(__file__)) +resources_dir = os.path.join(script_dir, "..", "resources") + + +class PomGeneratorTest(unittest.TestCase): + def test_get_version_from_returns_current(self): + versions_file = f"{resources_dir}/misc/versions.txt" + artifact = "gax-grpc" + self.assertEqual("2.33.1-SNAPSHOT", get_version_from(versions_file, artifact)) + + def test_get_version_from_returns_released(self): + versions_file = f"{resources_dir}/misc/versions.txt" + artifact = "gax-grpc" + self.assertEqual("2.34.0", get_version_from(versions_file, artifact, True)) diff --git a/library_generation/utilities.py b/library_generation/utilities.py index d899dd1773..29e175c1b8 100755 --- a/library_generation/utilities.py +++ b/library_generation/utilities.py @@ -18,120 +18,14 @@ import shutil import re from pathlib import Path -from lxml import etree -from library_generation.model.bom_config import BomConfig +from typing import Dict from library_generation.model.generation_config import GenerationConfig from library_generation.model.library_config import LibraryConfig from typing import List -from jinja2 import Environment, FileSystemLoader - from library_generation.model.repo_config import RepoConfig +from library_generation.utils.file_render import render script_dir = os.path.dirname(os.path.realpath(__file__)) -jinja_env = Environment(loader=FileSystemLoader(f"{script_dir}/templates")) -project_tag = "{http://maven.apache.org/POM/4.0.0}" -group_id_tag = "groupId" -artifact_tag = "artifactId" -version_tag = "version" - - -def __render(template_name: str, output_name: str, **kwargs): - template = jinja_env.get_template(template_name) - t = template.stream(kwargs) - directory = os.path.dirname(output_name) - if not os.path.isdir(directory): - os.makedirs(directory) - t.dump(str(output_name)) - - -def __search_for_java_modules( - repository_path: str, -) -> List[str]: - repo = Path(repository_path).resolve() - modules = [] - for sub_dir in repo.iterdir(): - if sub_dir.is_dir() and sub_dir.name.startswith("java-"): - modules.append(sub_dir.name) - return sorted(modules) - - -def __search_for_bom_artifact( - repository_path: str, -) -> List[BomConfig]: - repo = Path(repository_path).resolve() - module_exclusions = ["gapic-libraries-bom"] - group_id_inclusions = [ - "com.google.cloud", - "com.google.analytics", - "com.google.area120", - ] - bom_configs = [] - for module in repo.iterdir(): - if module.is_file() or module.name in module_exclusions: - continue - for sub_module in module.iterdir(): - if sub_module.is_dir() and sub_module.name.endswith("-bom"): - root = etree.parse(f"{sub_module}/pom.xml").getroot() - group_id = root.find(f"{project_tag}{group_id_tag}").text - if group_id not in group_id_inclusions: - continue - artifact_id = root.find(f"{project_tag}{artifact_tag}").text - version = root.find(f"{project_tag}{version_tag}").text - index = artifact_id.rfind("-") - version_annotation = artifact_id[:index] - bom_configs.append( - BomConfig( - group_id=group_id, - artifact_id=artifact_id, - version=version, - version_annotation=version_annotation, - ) - ) - # handle edge case: java-grafeas - bom_configs += __handle_special_bom( - repository_path=repository_path, - module="java-grafeas", - group_id="io.grafeas", - artifact_id="grafeas", - ) - # handle edge case: java-dns - bom_configs += __handle_special_bom( - repository_path=repository_path, - module="java-dns", - group_id="com.google.cloud", - artifact_id="google-cloud-dns", - ) - # handle edge case: java-notification - bom_configs += __handle_special_bom( - repository_path=repository_path, - module="java-notification", - group_id="com.google.cloud", - artifact_id="google-cloud-notification", - ) - - return sorted(bom_configs) - - -def __handle_special_bom( - repository_path: str, - module: str, - group_id: str, - artifact_id: str, -) -> List[BomConfig]: - pom = f"{repository_path}/{module}/pom.xml" - if not Path(pom).exists(): - return [] - root = etree.parse(pom).getroot() - version = root.find(f"{project_tag}{version_tag}").text - return [ - BomConfig( - group_id=group_id, - artifact_id=artifact_id, - version=version, - version_annotation=artifact_id, - is_import=False, - ) - ] def create_argument(arg_key: str, arg_container: object) -> List[str]: @@ -224,16 +118,6 @@ def remove_version_from(proto_path: str) -> str: return proto_path -def check_monorepo(config: GenerationConfig) -> bool: - """ - Check whether to generate a monorepo according to the - generation config. - :param config: the generation configuration - :return: True if it's to generate a monorepo - """ - return len(config.libraries) > 1 - - def prepare_repo( gen_config: GenerationConfig, library_config: List[LibraryConfig], @@ -251,11 +135,11 @@ def prepare_repo( :param language: programming language of the library :return: a RepoConfig object contained repository information :raise FileNotFoundError if there's no versions.txt in repo_path + :raise ValueError if two libraries have the same library_name """ output_folder = sh_util("get_output_folder") print(f"output_folder: {output_folder}") os.makedirs(output_folder, exist_ok=True) - is_monorepo = check_monorepo(gen_config) libraries = {} for library in library_config: library_name = ( @@ -263,10 +147,16 @@ def prepare_repo( if library.library_name else f"{language}-{library.api_shortname}" ) - library_path = f"{repo_path}/{library_name}" if is_monorepo else f"{repo_path}" + library_path = ( + f"{repo_path}/{library_name}" if gen_config.is_monorepo else f"{repo_path}" + ) # use absolute path because docker requires absolute path # in volume name. absolute_library_path = str(Path(library_path).resolve()) + if absolute_library_path in libraries: + # check whether the java_library is unique among all libraries + # because two libraries should not go to the same destination. + raise ValueError(f"{absolute_library_path} already exists.") libraries[absolute_library_path] = library # remove existing .repo-metadata.json json_name = ".repo-metadata.json" @@ -326,7 +216,6 @@ def generate_prerequisite_files( transport: str, library_path: str, language: str = "java", - is_monorepo: bool = True, ) -> None: """ Generate prerequisite files for a library. @@ -339,7 +228,6 @@ def generate_prerequisite_files( :param transport: transport supported by the library :param library_path: the path to which the generated file goes :param language: programming language of the library - :param is_monorepo: whether the library is in a monorepo :return: None """ cloud_prefix = "cloud-" if library.cloud_api else "" @@ -351,7 +239,9 @@ def generate_prerequisite_files( ) distribution_name_short = re.split(r"[:/]", distribution_name)[-1] repo = ( - "googleapis/google-cloud-java" if is_monorepo else f"{language}-{library_name}" + "googleapis/google-cloud-java" + if config.is_monorepo + else f"googleapis/{language}-{library_name}" ) api_id = ( library.api_id if library.api_id else f"{library.api_shortname}.googleapis.com" @@ -402,6 +292,8 @@ def generate_prerequisite_files( repo_metadata["rest_documentation"] = library.rest_documentation if library.rpc_documentation: repo_metadata["rpc_documentation"] = library.rpc_documentation + if library.extra_versioned_modules: + repo_metadata["extra_versioned_modules"] = library.extra_versioned_modules # generate .repo-meta.json json_file = ".repo-metadata.json" @@ -412,11 +304,16 @@ def generate_prerequisite_files( json.dump(repo_metadata, fp, indent=2) # generate .OwlBot.yaml - yaml_file = ".OwlBot.yaml" - if not os.path.exists(f"{library_path}/{yaml_file}"): - __render( + owlbot_yaml_file = ".OwlBot.yaml" + path_to_owlbot_yaml_file = ( + f"{library_path}/{owlbot_yaml_file}" + if config.is_monorepo + else f"{library_path}/.github/{owlbot_yaml_file}" + ) + if not os.path.exists(path_to_owlbot_yaml_file): + render( template_name="owlbot.yaml.monorepo.j2", - output_name=f"{library_path}/{yaml_file}", + output_name=path_to_owlbot_yaml_file, artifact_name=distribution_name_short, proto_path=remove_version_from(proto_path), module_name=repo_metadata["repo_short"], @@ -426,7 +323,7 @@ def generate_prerequisite_files( # generate owlbot.py py_file = "owlbot.py" if not os.path.exists(f"{library_path}/{py_file}"): - __render( + render( template_name="owlbot.py.j2", output_name=f"{library_path}/{py_file}", should_include_templates=True, @@ -434,49 +331,34 @@ def generate_prerequisite_files( ) -def repo_level_post_process( - repository_path: str, - versions_file: str, -) -> None: +def get_file_paths(config: GenerationConfig) -> Dict[str, str]: """ - Perform repository level post-processing - :param repository_path: the path of the repository - :param versions_file: the versions_txt contains version of modules - :return: None + Get versioned proto_path to library_name mapping from configuration file. + + :param config: a GenerationConfig object. + :return: versioned proto_path to library_name mapping """ - print("Regenerating root pom.xml") - modules = __search_for_java_modules(repository_path) - __render( - template_name="root-pom.xml.j2", - output_name=f"{repository_path}/pom.xml", - modules=modules, - ) - print("Regenerating gapic-libraries-bom") - bom_configs = __search_for_bom_artifact(repository_path) - monorepo_version = get_version_from( - versions_file=versions_file, - artifact_id="google-cloud-java", - ) - __render( - template_name="gapic-libraries-bom.xml.j2", - output_name=f"{repository_path}/gapic-libraries-bom/pom.xml", - monorepo_version=monorepo_version, - bom_configs=bom_configs, - ) + paths = {} + for library in config.libraries: + for gapic_config in library.gapic_configs: + paths[gapic_config.proto_path] = get_library_name(library) + return paths -def get_version_from( - versions_file: str, artifact_id: str, is_released: bool = False -) -> str: +def find_versioned_proto_path(file_path: str) -> str: """ - Get version of a given artifact from versions.txt - :param versions_file: the path of version.txt - :param artifact_id: the artifact id - :param is_released: whether returns the released or current version - :return: the version of the artifact + Returns a versioned proto_path from a given file_path; or file_path itself + if it doesn't contain a versioned proto_path. + + :param file_path: a proto file path + :return: the versioned proto_path """ - index = 1 if is_released else 2 - with open(versions_file, "r") as f: - for line in f.readlines(): - if artifact_id in line: - return line.split(":")[index].strip() + version_regex = re.compile(r"^v[1-9].*") + directories = file_path.split("/") + for directory in directories: + result = version_regex.search(directory) + if result: + version = result[0] + idx = file_path.find(version) + return file_path[:idx] + version + return file_path diff --git a/library_generation/utils/commit_message_formatter.py b/library_generation/utils/commit_message_formatter.py new file mode 100644 index 0000000000..afa51a4db6 --- /dev/null +++ b/library_generation/utils/commit_message_formatter.py @@ -0,0 +1,64 @@ +# Copyright 2024 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +import re +from typing import List +from typing import Dict +from git import Commit + + +def format_commit_message(commits: Dict[Commit, str], is_monorepo: bool) -> List[str]: + """ + Format commit messages. Add library_name to conventional commit messages if + is_monorepo is True; otherwise no op. + + :param commits: a mapping from commit to library_name. + :param is_monorepo: whether it's monorepo or not. + :return: formatted commit messages. + """ + all_commits = [] + # please see go/java-client-releasing#conventional-commit-messages + # for conventional commit. + type_regex = re.compile(r"(feat|fix|docs|deps|test|samples|chore)!?:.*") + for commit, library_name in commits.items(): + # a commit message may contain multiple lines, we need to + # add library_name for each line. + messages = [] + for message_line in commit.message.split("\n"): + # add library name to a conventional commit message; + # otherwise no op. + if type_regex.search(message_line): + commit_type, _, summary = message_line.partition(":") + formatted_message = ( + f"{commit_type}: [{library_name}]{str(summary).rstrip()}" + if is_monorepo + else f"{commit_type}:{str(summary).rstrip()}" + ) + messages.append(formatted_message) + else: + messages.append(message_line) + all_commits.extend(wrap_nested_commit(messages)) + return all_commits + + +def wrap_nested_commit(messages: List[str]) -> List[str]: + """ + Wrap message between `BEGIN_NESTED_COMMIT` and `BEGIN_NESTED_COMMIT`. + + :param messages: a (multi-line) commit message, one line per item. + :return: wrapped messages. + """ + result = ["BEGIN_NESTED_COMMIT"] + result.extend(messages) + result.append("END_NESTED_COMMIT") + return result diff --git a/library_generation/utils/file_render.py b/library_generation/utils/file_render.py new file mode 100644 index 0000000000..5c68445753 --- /dev/null +++ b/library_generation/utils/file_render.py @@ -0,0 +1,24 @@ +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +import os +from jinja2 import Environment, FileSystemLoader + +script_dir = os.path.dirname(os.path.realpath(__file__)) +jinja_env = Environment(loader=FileSystemLoader(f"{script_dir}/../templates")) + + +def render(template_name: str, output_name: str, **kwargs): + template = jinja_env.get_template(template_name) + t = template.stream(kwargs) + directory = os.path.dirname(output_name) + if not os.path.isdir(directory): + os.makedirs(directory) + t.dump(str(output_name)) diff --git a/library_generation/utils/monorepo_postprocessor.py b/library_generation/utils/monorepo_postprocessor.py new file mode 100644 index 0000000000..cd522b83b5 --- /dev/null +++ b/library_generation/utils/monorepo_postprocessor.py @@ -0,0 +1,29 @@ +# Copyright 2024 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +from library_generation.utils.pom_generator import generate_gapic_bom +from library_generation.utils.pom_generator import generate_root_pom + + +def monorepo_postprocessing( + repository_path: str, + versions_file: str, +) -> None: + """ + Perform repository level post-processing + :param repository_path: the path of the repository + :param versions_file: the versions_txt contains version of modules + :return: None + """ + generate_root_pom(repository_path=repository_path) + generate_gapic_bom(repository_path=repository_path, versions_file=versions_file) diff --git a/library_generation/utils/pom_generator.py b/library_generation/utils/pom_generator.py new file mode 100644 index 0000000000..8312d4c5a4 --- /dev/null +++ b/library_generation/utils/pom_generator.py @@ -0,0 +1,157 @@ +# Copyright 2024 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +from pathlib import Path + +from lxml import etree +from typing import List + +from library_generation.model.bom_config import BomConfig +from library_generation.utils.file_render import render + +project_tag = "{http://maven.apache.org/POM/4.0.0}" +group_id_tag = "groupId" +artifact_tag = "artifactId" +version_tag = "version" + + +def generate_root_pom(repository_path: str) -> None: + print("Regenerating root pom.xml") + modules = __search_for_java_modules(repository_path) + render( + template_name="root-pom.xml.j2", + output_name=f"{repository_path}/pom.xml", + modules=modules, + ) + + +def generate_gapic_bom(repository_path: str, versions_file: str) -> None: + print("Regenerating gapic-libraries-bom") + bom_configs = __search_for_bom_artifact(repository_path) + monorepo_version = get_version_from( + versions_file=versions_file, + artifact_id="google-cloud-java", + ) + render( + template_name="gapic-libraries-bom.xml.j2", + output_name=f"{repository_path}/gapic-libraries-bom/pom.xml", + monorepo_version=monorepo_version, + bom_configs=bom_configs, + ) + + +def get_version_from( + versions_file: str, artifact_id: str, is_released: bool = False +) -> str: + """ + Get version of a given artifact from versions.txt + :param versions_file: the path of version.txt + :param artifact_id: the artifact id + :param is_released: whether returns the released or current version + :return: the version of the artifact + """ + index = 1 if is_released else 2 + with open(versions_file, "r") as f: + for line in f.readlines(): + if artifact_id in line: + return line.split(":")[index].strip() + + +def __search_for_java_modules( + repository_path: str, +) -> List[str]: + repo = Path(repository_path).resolve() + modules = [] + for sub_dir in repo.iterdir(): + if sub_dir.is_dir() and sub_dir.name.startswith("java-"): + modules.append(sub_dir.name) + return sorted(modules) + + +def __search_for_bom_artifact( + repository_path: str, +) -> List[BomConfig]: + repo = Path(repository_path).resolve() + module_exclusions = ["gapic-libraries-bom"] + group_id_inclusions = [ + "com.google.cloud", + "com.google.analytics", + "com.google.area120", + ] + bom_configs = [] + for module in repo.iterdir(): + if module.is_file() or module.name in module_exclusions: + continue + for sub_module in module.iterdir(): + if sub_module.is_dir() and sub_module.name.endswith("-bom"): + root = etree.parse(f"{sub_module}/pom.xml").getroot() + group_id = root.find(f"{project_tag}{group_id_tag}").text + if group_id not in group_id_inclusions: + continue + artifact_id = root.find(f"{project_tag}{artifact_tag}").text + version = root.find(f"{project_tag}{version_tag}").text + index = artifact_id.rfind("-") + version_annotation = artifact_id[:index] + bom_configs.append( + BomConfig( + group_id=group_id, + artifact_id=artifact_id, + version=version, + version_annotation=version_annotation, + ) + ) + # handle edge case: java-grafeas + bom_configs += __handle_special_bom( + repository_path=repository_path, + module="java-grafeas", + group_id="io.grafeas", + artifact_id="grafeas", + ) + # handle edge case: java-dns + bom_configs += __handle_special_bom( + repository_path=repository_path, + module="java-dns", + group_id="com.google.cloud", + artifact_id="google-cloud-dns", + ) + # handle edge case: java-notification + bom_configs += __handle_special_bom( + repository_path=repository_path, + module="java-notification", + group_id="com.google.cloud", + artifact_id="google-cloud-notification", + ) + + return sorted(bom_configs) + + +def __handle_special_bom( + repository_path: str, + module: str, + group_id: str, + artifact_id: str, +) -> List[BomConfig]: + pom = f"{repository_path}/{module}/pom.xml" + if not Path(pom).exists(): + return [] + root = etree.parse(pom).getroot() + version = root.find(f"{project_tag}{version_tag}").text + return [ + BomConfig( + group_id=group_id, + artifact_id=artifact_id, + version=version, + version_annotation=artifact_id, + is_import=False, + ) + ] diff --git a/release-please-config.json b/release-please-config.json index 658de223cb..ddf1373290 100644 --- a/release-please-config.json +++ b/release-please-config.json @@ -5,7 +5,7 @@ "group-pull-request-title-pattern": "chore(${branch}): release ${version}", "packages": { ".": { - "extra-files": ["WORKSPACE", ".cloudbuild/cloudbuild.yaml", ".cloudbuild/cloudbuild-test-a.yaml", ".cloudbuild/cloudbuild-test-b.yaml"] + "extra-files": ["WORKSPACE", ".cloudbuild/graalvm/cloudbuild.yaml", ".cloudbuild/graalvm/cloudbuild-test-a.yaml", ".cloudbuild/graalvm/cloudbuild-test-b.yaml", ".cloudbuild/library_generation/cloudbuild-library-generation-release.yaml"] } } } \ No newline at end of file diff --git a/renovate.json b/renovate.json index 73fc6061c3..7e2f901c87 100644 --- a/renovate.json +++ b/renovate.json @@ -64,7 +64,7 @@ "^.cloudbuild/*" ], "matchStrings": [ - "_JAVA_SHARED_CONFIG_VERSION: \"(?.+?)\"" + " _JAVA_SHARED_CONFIG_VERSION: '(?.+?)'" ], "depNameTemplate": "com.google.cloud:google-cloud-shared-config", "datasourceTemplate": "maven" @@ -103,7 +103,8 @@ "^com.google.cloud:google-cloud-shared-config" ], "semanticCommitType": "build", - "semanticCommitScope": "deps" + "semanticCommitScope": "deps", + "enabled": true }, { "matchPackagePatterns": [ diff --git a/rules_java_gapic/resources/gradle/gradle/wrapper/gradle-wrapper.properties b/rules_java_gapic/resources/gradle/gradle/wrapper/gradle-wrapper.properties index 068cdb2dc2..3994438e22 100644 --- a/rules_java_gapic/resources/gradle/gradle/wrapper/gradle-wrapper.properties +++ b/rules_java_gapic/resources/gradle/gradle/wrapper/gradle-wrapper.properties @@ -1,5 +1,5 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-7.6.3-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-7.6.4-bin.zip zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists diff --git a/sdk-platform-java-config/pom.xml b/sdk-platform-java-config/pom.xml index 709c17b9f3..989e67dcfe 100644 --- a/sdk-platform-java-config/pom.xml +++ b/sdk-platform-java-config/pom.xml @@ -4,7 +4,7 @@ com.google.cloud sdk-platform-java-config pom - 3.25.1-SNAPSHOT + 3.27.1-SNAPSHOT SDK Platform For Java Configurations Shared build configuration for Google Cloud Java libraries. @@ -13,10 +13,10 @@ com.google.cloud google-cloud-shared-config - 1.7.1 + 1.7.4 - 3.25.1-SNAPSHOT + 3.27.1-SNAPSHOT \ No newline at end of file diff --git a/showcase/gapic-showcase/pom.xml b/showcase/gapic-showcase/pom.xml index 582db4d93c..81313b780d 100644 --- a/showcase/gapic-showcase/pom.xml +++ b/showcase/gapic-showcase/pom.xml @@ -139,7 +139,7 @@ com.google.truth truth - 1.2.0 + 1.4.2 test diff --git a/showcase/gapic-showcase/src/main/java/com/google/showcase/v1beta1/stub/EchoStubSettings.java b/showcase/gapic-showcase/src/main/java/com/google/showcase/v1beta1/stub/EchoStubSettings.java index f7ea1b5540..07a8e93d6b 100644 --- a/showcase/gapic-showcase/src/main/java/com/google/showcase/v1beta1/stub/EchoStubSettings.java +++ b/showcase/gapic-showcase/src/main/java/com/google/showcase/v1beta1/stub/EchoStubSettings.java @@ -882,8 +882,6 @@ public UnaryCallSettings.Builder waitSettings() { } /** Returns the builder for the settings used for calls to wait. */ - @BetaApi( - "The surface for use by generated code is not stable yet and may change in the future.") public OperationCallSettings.Builder waitOperationSettings() { return waitOperationSettings; diff --git a/showcase/gapic-showcase/src/main/java/com/google/showcase/v1beta1/stub/HttpJsonComplianceCallableFactory.java b/showcase/gapic-showcase/src/main/java/com/google/showcase/v1beta1/stub/HttpJsonComplianceCallableFactory.java index 1679175660..4f527ca0c3 100644 --- a/showcase/gapic-showcase/src/main/java/com/google/showcase/v1beta1/stub/HttpJsonComplianceCallableFactory.java +++ b/showcase/gapic-showcase/src/main/java/com/google/showcase/v1beta1/stub/HttpJsonComplianceCallableFactory.java @@ -73,8 +73,6 @@ public UnaryCallable createBatchingCa httpJsonCallSettings, callSettings, clientContext); } - @BetaApi( - "The surface for long-running operations is not stable yet and may change in the future.") @Override public OperationCallable createOperationCallable( diff --git a/showcase/gapic-showcase/src/main/java/com/google/showcase/v1beta1/stub/HttpJsonEchoCallableFactory.java b/showcase/gapic-showcase/src/main/java/com/google/showcase/v1beta1/stub/HttpJsonEchoCallableFactory.java index 544410bc98..26eb5522ef 100644 --- a/showcase/gapic-showcase/src/main/java/com/google/showcase/v1beta1/stub/HttpJsonEchoCallableFactory.java +++ b/showcase/gapic-showcase/src/main/java/com/google/showcase/v1beta1/stub/HttpJsonEchoCallableFactory.java @@ -73,8 +73,6 @@ public UnaryCallable createBatchingCa httpJsonCallSettings, callSettings, clientContext); } - @BetaApi( - "The surface for long-running operations is not stable yet and may change in the future.") @Override public OperationCallable createOperationCallable( diff --git a/showcase/gapic-showcase/src/main/java/com/google/showcase/v1beta1/stub/HttpJsonIdentityCallableFactory.java b/showcase/gapic-showcase/src/main/java/com/google/showcase/v1beta1/stub/HttpJsonIdentityCallableFactory.java index f6ace1ac12..3a0b12dc9d 100644 --- a/showcase/gapic-showcase/src/main/java/com/google/showcase/v1beta1/stub/HttpJsonIdentityCallableFactory.java +++ b/showcase/gapic-showcase/src/main/java/com/google/showcase/v1beta1/stub/HttpJsonIdentityCallableFactory.java @@ -73,8 +73,6 @@ public UnaryCallable createBatchingCa httpJsonCallSettings, callSettings, clientContext); } - @BetaApi( - "The surface for long-running operations is not stable yet and may change in the future.") @Override public OperationCallable createOperationCallable( diff --git a/showcase/gapic-showcase/src/main/java/com/google/showcase/v1beta1/stub/HttpJsonMessagingCallableFactory.java b/showcase/gapic-showcase/src/main/java/com/google/showcase/v1beta1/stub/HttpJsonMessagingCallableFactory.java index 842da74456..4daa029395 100644 --- a/showcase/gapic-showcase/src/main/java/com/google/showcase/v1beta1/stub/HttpJsonMessagingCallableFactory.java +++ b/showcase/gapic-showcase/src/main/java/com/google/showcase/v1beta1/stub/HttpJsonMessagingCallableFactory.java @@ -73,8 +73,6 @@ public UnaryCallable createBatchingCa httpJsonCallSettings, callSettings, clientContext); } - @BetaApi( - "The surface for long-running operations is not stable yet and may change in the future.") @Override public OperationCallable createOperationCallable( diff --git a/showcase/gapic-showcase/src/main/java/com/google/showcase/v1beta1/stub/HttpJsonSequenceServiceCallableFactory.java b/showcase/gapic-showcase/src/main/java/com/google/showcase/v1beta1/stub/HttpJsonSequenceServiceCallableFactory.java index 44f207f84b..3eb91b55f7 100644 --- a/showcase/gapic-showcase/src/main/java/com/google/showcase/v1beta1/stub/HttpJsonSequenceServiceCallableFactory.java +++ b/showcase/gapic-showcase/src/main/java/com/google/showcase/v1beta1/stub/HttpJsonSequenceServiceCallableFactory.java @@ -73,8 +73,6 @@ public UnaryCallable createBatchingCa httpJsonCallSettings, callSettings, clientContext); } - @BetaApi( - "The surface for long-running operations is not stable yet and may change in the future.") @Override public OperationCallable createOperationCallable( diff --git a/showcase/gapic-showcase/src/main/java/com/google/showcase/v1beta1/stub/HttpJsonTestingCallableFactory.java b/showcase/gapic-showcase/src/main/java/com/google/showcase/v1beta1/stub/HttpJsonTestingCallableFactory.java index a6654a9840..bdd3ad0b54 100644 --- a/showcase/gapic-showcase/src/main/java/com/google/showcase/v1beta1/stub/HttpJsonTestingCallableFactory.java +++ b/showcase/gapic-showcase/src/main/java/com/google/showcase/v1beta1/stub/HttpJsonTestingCallableFactory.java @@ -73,8 +73,6 @@ public UnaryCallable createBatchingCa httpJsonCallSettings, callSettings, clientContext); } - @BetaApi( - "The surface for long-running operations is not stable yet and may change in the future.") @Override public OperationCallable createOperationCallable( diff --git a/showcase/gapic-showcase/src/main/java/com/google/showcase/v1beta1/stub/MessagingStubSettings.java b/showcase/gapic-showcase/src/main/java/com/google/showcase/v1beta1/stub/MessagingStubSettings.java index a45a6edc8d..529e1365af 100644 --- a/showcase/gapic-showcase/src/main/java/com/google/showcase/v1beta1/stub/MessagingStubSettings.java +++ b/showcase/gapic-showcase/src/main/java/com/google/showcase/v1beta1/stub/MessagingStubSettings.java @@ -943,8 +943,6 @@ public UnaryCallSettings.Builder searchBlurbsSet } /** Returns the builder for the settings used for calls to searchBlurbs. */ - @BetaApi( - "The surface for use by generated code is not stable yet and may change in the future.") public OperationCallSettings.Builder< SearchBlurbsRequest, SearchBlurbsResponse, SearchBlurbsMetadata> searchBlurbsOperationSettings() { diff --git a/showcase/pom.xml b/showcase/pom.xml index 13fbf1e1ea..242a9b72b3 100644 --- a/showcase/pom.xml +++ b/showcase/pom.xml @@ -15,7 +15,7 @@ com.google.cloud google-cloud-shared-config - 1.7.1 + 1.7.4 @@ -34,7 +34,7 @@ com.google.cloud google-cloud-shared-dependencies - 3.25.1-SNAPSHOT + 3.27.1-SNAPSHOT pom import diff --git a/showcase/proto-gapic-showcase-v1beta1/src/main/java/com/google/showcase/v1beta1/BlurbName.java b/showcase/proto-gapic-showcase-v1beta1/src/main/java/com/google/showcase/v1beta1/BlurbName.java index 843613d8c4..d676d00566 100644 --- a/showcase/proto-gapic-showcase-v1beta1/src/main/java/com/google/showcase/v1beta1/BlurbName.java +++ b/showcase/proto-gapic-showcase-v1beta1/src/main/java/com/google/showcase/v1beta1/BlurbName.java @@ -16,7 +16,6 @@ package com.google.showcase.v1beta1; -import com.google.api.core.BetaApi; import com.google.api.pathtemplate.PathTemplate; import com.google.api.pathtemplate.ValidationException; import com.google.api.resourcenames.ResourceName; @@ -118,22 +117,18 @@ public static Builder newBuilder() { return new Builder(); } - @BetaApi("The per-pattern Builders are not stable yet and may be changed in the future.") public static Builder newUserLegacyUserBlurbBuilder() { return new Builder(); } - @BetaApi("The per-pattern Builders are not stable yet and may be changed in the future.") public static UserBlurbBuilder newUserBlurbBuilder() { return new UserBlurbBuilder(); } - @BetaApi("The per-pattern Builders are not stable yet and may be changed in the future.") public static RoomBlurbBuilder newRoomBlurbBuilder() { return new RoomBlurbBuilder(); } - @BetaApi("The per-pattern Builders are not stable yet and may be changed in the future.") public static RoomLegacyRoomBlurbBuilder newRoomLegacyRoomBlurbBuilder() { return new RoomLegacyRoomBlurbBuilder(); } @@ -146,22 +141,18 @@ public static BlurbName of(String user, String legacyUser, String blurb) { return newBuilder().setUser(user).setLegacyUser(legacyUser).setBlurb(blurb).build(); } - @BetaApi("The static create methods are not stable yet and may be changed in the future.") public static BlurbName ofUserLegacyUserBlurbName(String user, String legacyUser, String blurb) { return newBuilder().setUser(user).setLegacyUser(legacyUser).setBlurb(blurb).build(); } - @BetaApi("The static create methods are not stable yet and may be changed in the future.") public static BlurbName ofUserBlurbName(String user, String blurb) { return newUserBlurbBuilder().setUser(user).setBlurb(blurb).build(); } - @BetaApi("The static create methods are not stable yet and may be changed in the future.") public static BlurbName ofRoomBlurbName(String room, String blurb) { return newRoomBlurbBuilder().setRoom(room).setBlurb(blurb).build(); } - @BetaApi("The static create methods are not stable yet and may be changed in the future.") public static BlurbName ofRoomLegacyRoomBlurbName(String room, String legacyRoom, String blurb) { return newRoomLegacyRoomBlurbBuilder() .setRoom(room) @@ -174,22 +165,18 @@ public static String format(String user, String legacyUser, String blurb) { return newBuilder().setUser(user).setLegacyUser(legacyUser).setBlurb(blurb).build().toString(); } - @BetaApi("The static format methods are not stable yet and may be changed in the future.") public static String formatUserLegacyUserBlurbName(String user, String legacyUser, String blurb) { return newBuilder().setUser(user).setLegacyUser(legacyUser).setBlurb(blurb).build().toString(); } - @BetaApi("The static format methods are not stable yet and may be changed in the future.") public static String formatUserBlurbName(String user, String blurb) { return newUserBlurbBuilder().setUser(user).setBlurb(blurb).build().toString(); } - @BetaApi("The static format methods are not stable yet and may be changed in the future.") public static String formatRoomBlurbName(String room, String blurb) { return newRoomBlurbBuilder().setRoom(room).setBlurb(blurb).build().toString(); } - @BetaApi("The static format methods are not stable yet and may be changed in the future.") public static String formatRoomLegacyRoomBlurbName(String room, String legacyRoom, String blurb) { return newRoomLegacyRoomBlurbBuilder() .setRoom(room) @@ -369,7 +356,6 @@ public BlurbName build() { } /** Builder for users/{user}/profile/blurbs/{blurb}. */ - @BetaApi("The per-pattern Builders are not stable yet and may be changed in the future.") public static class UserBlurbBuilder { private String user; private String blurb; @@ -400,7 +386,6 @@ public BlurbName build() { } /** Builder for rooms/{room}/blurbs/{blurb}. */ - @BetaApi("The per-pattern Builders are not stable yet and may be changed in the future.") public static class RoomBlurbBuilder { private String room; private String blurb; @@ -431,7 +416,6 @@ public BlurbName build() { } /** Builder for rooms/{room}/blurbs/legacy/{legacy_room}.{blurb}. */ - @BetaApi("The per-pattern Builders are not stable yet and may be changed in the future.") public static class RoomLegacyRoomBlurbBuilder { private String room; private String legacyRoom; diff --git a/test/integration/goldens/apigeeconnect/src/com/google/cloud/apigeeconnect/v1/stub/HttpJsonConnectionServiceCallableFactory.java b/test/integration/goldens/apigeeconnect/src/com/google/cloud/apigeeconnect/v1/stub/HttpJsonConnectionServiceCallableFactory.java index ebca0f676e..becaad2844 100644 --- a/test/integration/goldens/apigeeconnect/src/com/google/cloud/apigeeconnect/v1/stub/HttpJsonConnectionServiceCallableFactory.java +++ b/test/integration/goldens/apigeeconnect/src/com/google/cloud/apigeeconnect/v1/stub/HttpJsonConnectionServiceCallableFactory.java @@ -16,7 +16,6 @@ package com.google.cloud.apigeeconnect.v1.stub; -import com.google.api.core.BetaApi; import com.google.api.gax.httpjson.HttpJsonCallSettings; import com.google.api.gax.httpjson.HttpJsonCallableFactory; import com.google.api.gax.httpjson.HttpJsonOperationSnapshotCallable; @@ -41,7 +40,6 @@ *

This class is for advanced usage. */ @Generated("by gapic-generator-java") -@BetaApi public class HttpJsonConnectionServiceCallableFactory implements HttpJsonStubCallableFactory { @@ -73,8 +71,6 @@ public UnaryCallable createBatchingCa httpJsonCallSettings, callSettings, clientContext); } - @BetaApi( - "The surface for long-running operations is not stable yet and may change in the future.") @Override public OperationCallable createOperationCallable( diff --git a/test/integration/goldens/asset/src/com/google/cloud/asset/v1/FeedName.java b/test/integration/goldens/asset/src/com/google/cloud/asset/v1/FeedName.java index 7278bc364b..4dfc13d2e6 100644 --- a/test/integration/goldens/asset/src/com/google/cloud/asset/v1/FeedName.java +++ b/test/integration/goldens/asset/src/com/google/cloud/asset/v1/FeedName.java @@ -16,7 +16,6 @@ package com.google.cloud.asset.v1; -import com.google.api.core.BetaApi; import com.google.api.pathtemplate.PathTemplate; import com.google.api.pathtemplate.ValidationException; import com.google.api.resourcenames.ResourceName; @@ -97,17 +96,14 @@ public static Builder newBuilder() { return new Builder(); } - @BetaApi("The per-pattern Builders are not stable yet and may be changed in the future.") public static Builder newProjectFeedBuilder() { return new Builder(); } - @BetaApi("The per-pattern Builders are not stable yet and may be changed in the future.") public static FolderFeedBuilder newFolderFeedBuilder() { return new FolderFeedBuilder(); } - @BetaApi("The per-pattern Builders are not stable yet and may be changed in the future.") public static OrganizationFeedBuilder newOrganizationFeedBuilder() { return new OrganizationFeedBuilder(); } @@ -120,17 +116,14 @@ public static FeedName of(String project, String feed) { return newBuilder().setProject(project).setFeed(feed).build(); } - @BetaApi("The static create methods are not stable yet and may be changed in the future.") public static FeedName ofProjectFeedName(String project, String feed) { return newBuilder().setProject(project).setFeed(feed).build(); } - @BetaApi("The static create methods are not stable yet and may be changed in the future.") public static FeedName ofFolderFeedName(String folder, String feed) { return newFolderFeedBuilder().setFolder(folder).setFeed(feed).build(); } - @BetaApi("The static create methods are not stable yet and may be changed in the future.") public static FeedName ofOrganizationFeedName(String organization, String feed) { return newOrganizationFeedBuilder().setOrganization(organization).setFeed(feed).build(); } @@ -139,17 +132,14 @@ public static String format(String project, String feed) { return newBuilder().setProject(project).setFeed(feed).build().toString(); } - @BetaApi("The static format methods are not stable yet and may be changed in the future.") public static String formatProjectFeedName(String project, String feed) { return newBuilder().setProject(project).setFeed(feed).build().toString(); } - @BetaApi("The static format methods are not stable yet and may be changed in the future.") public static String formatFolderFeedName(String folder, String feed) { return newFolderFeedBuilder().setFolder(folder).setFeed(feed).build().toString(); } - @BetaApi("The static format methods are not stable yet and may be changed in the future.") public static String formatOrganizationFeedName(String organization, String feed) { return newOrganizationFeedBuilder() .setOrganization(organization) @@ -305,7 +295,6 @@ public FeedName build() { } /** Builder for folders/{folder}/feeds/{feed}. */ - @BetaApi("The per-pattern Builders are not stable yet and may be changed in the future.") public static class FolderFeedBuilder { private String folder; private String feed; @@ -336,7 +325,6 @@ public FeedName build() { } /** Builder for organizations/{organization}/feeds/{feed}. */ - @BetaApi("The per-pattern Builders are not stable yet and may be changed in the future.") public static class OrganizationFeedBuilder { private String organization; private String feed; diff --git a/test/integration/goldens/asset/src/com/google/cloud/asset/v1/SavedQueryName.java b/test/integration/goldens/asset/src/com/google/cloud/asset/v1/SavedQueryName.java index af70ae9f77..1e525a4843 100644 --- a/test/integration/goldens/asset/src/com/google/cloud/asset/v1/SavedQueryName.java +++ b/test/integration/goldens/asset/src/com/google/cloud/asset/v1/SavedQueryName.java @@ -16,7 +16,6 @@ package com.google.cloud.asset.v1; -import com.google.api.core.BetaApi; import com.google.api.pathtemplate.PathTemplate; import com.google.api.pathtemplate.ValidationException; import com.google.api.resourcenames.ResourceName; @@ -98,17 +97,14 @@ public static Builder newBuilder() { return new Builder(); } - @BetaApi("The per-pattern Builders are not stable yet and may be changed in the future.") public static Builder newProjectSavedQueryBuilder() { return new Builder(); } - @BetaApi("The per-pattern Builders are not stable yet and may be changed in the future.") public static FolderSavedQueryBuilder newFolderSavedQueryBuilder() { return new FolderSavedQueryBuilder(); } - @BetaApi("The per-pattern Builders are not stable yet and may be changed in the future.") public static OrganizationSavedQueryBuilder newOrganizationSavedQueryBuilder() { return new OrganizationSavedQueryBuilder(); } @@ -121,17 +117,14 @@ public static SavedQueryName of(String project, String savedQuery) { return newBuilder().setProject(project).setSavedQuery(savedQuery).build(); } - @BetaApi("The static create methods are not stable yet and may be changed in the future.") public static SavedQueryName ofProjectSavedQueryName(String project, String savedQuery) { return newBuilder().setProject(project).setSavedQuery(savedQuery).build(); } - @BetaApi("The static create methods are not stable yet and may be changed in the future.") public static SavedQueryName ofFolderSavedQueryName(String folder, String savedQuery) { return newFolderSavedQueryBuilder().setFolder(folder).setSavedQuery(savedQuery).build(); } - @BetaApi("The static create methods are not stable yet and may be changed in the future.") public static SavedQueryName ofOrganizationSavedQueryName( String organization, String savedQuery) { return newOrganizationSavedQueryBuilder() @@ -144,12 +137,10 @@ public static String format(String project, String savedQuery) { return newBuilder().setProject(project).setSavedQuery(savedQuery).build().toString(); } - @BetaApi("The static format methods are not stable yet and may be changed in the future.") public static String formatProjectSavedQueryName(String project, String savedQuery) { return newBuilder().setProject(project).setSavedQuery(savedQuery).build().toString(); } - @BetaApi("The static format methods are not stable yet and may be changed in the future.") public static String formatFolderSavedQueryName(String folder, String savedQuery) { return newFolderSavedQueryBuilder() .setFolder(folder) @@ -158,7 +149,6 @@ public static String formatFolderSavedQueryName(String folder, String savedQuery .toString(); } - @BetaApi("The static format methods are not stable yet and may be changed in the future.") public static String formatOrganizationSavedQueryName(String organization, String savedQuery) { return newOrganizationSavedQueryBuilder() .setOrganization(organization) @@ -315,7 +305,6 @@ public SavedQueryName build() { } /** Builder for folders/{folder}/savedQueries/{saved_query}. */ - @BetaApi("The per-pattern Builders are not stable yet and may be changed in the future.") public static class FolderSavedQueryBuilder { private String folder; private String savedQuery; @@ -346,7 +335,6 @@ public SavedQueryName build() { } /** Builder for organizations/{organization}/savedQueries/{saved_query}. */ - @BetaApi("The per-pattern Builders are not stable yet and may be changed in the future.") public static class OrganizationSavedQueryBuilder { private String organization; private String savedQuery; diff --git a/test/integration/goldens/asset/src/com/google/cloud/asset/v1/stub/AssetServiceStubSettings.java b/test/integration/goldens/asset/src/com/google/cloud/asset/v1/stub/AssetServiceStubSettings.java index 9d413c58cd..576f6ec1a2 100644 --- a/test/integration/goldens/asset/src/com/google/cloud/asset/v1/stub/AssetServiceStubSettings.java +++ b/test/integration/goldens/asset/src/com/google/cloud/asset/v1/stub/AssetServiceStubSettings.java @@ -1164,8 +1164,6 @@ public UnaryCallSettings.Builder exportAssetsSet } /** Returns the builder for the settings used for calls to exportAssets. */ - @BetaApi( - "The surface for use by generated code is not stable yet and may change in the future.") public OperationCallSettings.Builder< ExportAssetsRequest, ExportAssetsResponse, ExportAssetsRequest> exportAssetsOperationSettings() { @@ -1238,8 +1236,6 @@ public UnaryCallSettings.Builder deleteFeedSettings() } /** Returns the builder for the settings used for calls to analyzeIamPolicyLongrunning. */ - @BetaApi( - "The surface for use by generated code is not stable yet and may change in the future.") public OperationCallSettings.Builder< AnalyzeIamPolicyLongrunningRequest, AnalyzeIamPolicyLongrunningResponse, diff --git a/test/integration/goldens/asset/src/com/google/cloud/asset/v1/stub/HttpJsonAssetServiceCallableFactory.java b/test/integration/goldens/asset/src/com/google/cloud/asset/v1/stub/HttpJsonAssetServiceCallableFactory.java index 312ceb6c4d..052b7ca345 100644 --- a/test/integration/goldens/asset/src/com/google/cloud/asset/v1/stub/HttpJsonAssetServiceCallableFactory.java +++ b/test/integration/goldens/asset/src/com/google/cloud/asset/v1/stub/HttpJsonAssetServiceCallableFactory.java @@ -16,7 +16,6 @@ package com.google.cloud.asset.v1.stub; -import com.google.api.core.BetaApi; import com.google.api.gax.httpjson.HttpJsonCallSettings; import com.google.api.gax.httpjson.HttpJsonCallableFactory; import com.google.api.gax.httpjson.HttpJsonOperationSnapshotCallable; @@ -41,7 +40,6 @@ *

This class is for advanced usage. */ @Generated("by gapic-generator-java") -@BetaApi public class HttpJsonAssetServiceCallableFactory implements HttpJsonStubCallableFactory { @@ -73,8 +71,6 @@ public UnaryCallable createBatchingCa httpJsonCallSettings, callSettings, clientContext); } - @BetaApi( - "The surface for long-running operations is not stable yet and may change in the future.") @Override public OperationCallable createOperationCallable( diff --git a/test/integration/goldens/compute/src/com/google/cloud/compute/v1small/AddressesClient.java b/test/integration/goldens/compute/src/com/google/cloud/compute/v1small/AddressesClient.java index 6ea9e35d3e..1bf71bd60c 100644 --- a/test/integration/goldens/compute/src/com/google/cloud/compute/v1small/AddressesClient.java +++ b/test/integration/goldens/compute/src/com/google/cloud/compute/v1small/AddressesClient.java @@ -18,7 +18,6 @@ import com.google.api.core.ApiFuture; import com.google.api.core.ApiFutures; -import com.google.api.core.BetaApi; import com.google.api.gax.core.BackgroundResource; import com.google.api.gax.longrunning.OperationFuture; import com.google.api.gax.paging.AbstractFixedSizeCollection; @@ -442,8 +441,6 @@ public final OperationFuture deleteAsync( * @param request The request object containing all of the parameters for the API call. * @throws com.google.api.gax.rpc.ApiException if the remote call fails */ - @BetaApi( - "The surface for long-running operations is not stable yet and may change in the future.") public final OperationFuture deleteAsync(DeleteAddressRequest request) { return deleteOperationCallable().futureCall(request); } @@ -573,8 +570,6 @@ public final OperationFuture insertAsync( * @param request The request object containing all of the parameters for the API call. * @throws com.google.api.gax.rpc.ApiException if the remote call fails */ - @BetaApi( - "The surface for long-running operations is not stable yet and may change in the future.") public final OperationFuture insertAsync(InsertAddressRequest request) { return insertOperationCallable().futureCall(request); } diff --git a/test/integration/goldens/compute/src/com/google/cloud/compute/v1small/stub/AddressesStubSettings.java b/test/integration/goldens/compute/src/com/google/cloud/compute/v1small/stub/AddressesStubSettings.java index 9b77825c69..51eff66198 100644 --- a/test/integration/goldens/compute/src/com/google/cloud/compute/v1small/stub/AddressesStubSettings.java +++ b/test/integration/goldens/compute/src/com/google/cloud/compute/v1small/stub/AddressesStubSettings.java @@ -21,7 +21,6 @@ import com.google.api.core.ApiFunction; import com.google.api.core.ApiFuture; -import com.google.api.core.BetaApi; import com.google.api.gax.core.GaxProperties; import com.google.api.gax.core.GoogleCredentialsProvider; import com.google.api.gax.core.InstantiatingExecutorProvider; @@ -579,8 +578,6 @@ public UnaryCallSettings.Builder deleteSettings } /** Returns the builder for the settings used for calls to delete. */ - @BetaApi( - "The surface for use by generated code is not stable yet and may change in the future.") public OperationCallSettings.Builder deleteOperationSettings() { return deleteOperationSettings; @@ -592,8 +589,6 @@ public UnaryCallSettings.Builder insertSettings } /** Returns the builder for the settings used for calls to insert. */ - @BetaApi( - "The surface for use by generated code is not stable yet and may change in the future.") public OperationCallSettings.Builder insertOperationSettings() { return insertOperationSettings; diff --git a/test/integration/goldens/compute/src/com/google/cloud/compute/v1small/stub/HttpJsonAddressesCallableFactory.java b/test/integration/goldens/compute/src/com/google/cloud/compute/v1small/stub/HttpJsonAddressesCallableFactory.java index 8f0188d286..2210f2a190 100644 --- a/test/integration/goldens/compute/src/com/google/cloud/compute/v1small/stub/HttpJsonAddressesCallableFactory.java +++ b/test/integration/goldens/compute/src/com/google/cloud/compute/v1small/stub/HttpJsonAddressesCallableFactory.java @@ -16,7 +16,6 @@ package com.google.cloud.compute.v1small.stub; -import com.google.api.core.BetaApi; import com.google.api.gax.httpjson.HttpJsonCallSettings; import com.google.api.gax.httpjson.HttpJsonCallableFactory; import com.google.api.gax.httpjson.HttpJsonOperationSnapshotCallable; @@ -40,7 +39,6 @@ *

This class is for advanced usage. */ @Generated("by gapic-generator-java") -@BetaApi public class HttpJsonAddressesCallableFactory implements HttpJsonStubCallableFactory { @@ -72,8 +70,6 @@ public UnaryCallable createBatchingCa httpJsonCallSettings, callSettings, clientContext); } - @BetaApi( - "The surface for long-running operations is not stable yet and may change in the future.") @Override public OperationCallable createOperationCallable( diff --git a/test/integration/goldens/compute/src/com/google/cloud/compute/v1small/stub/HttpJsonRegionOperationsCallableFactory.java b/test/integration/goldens/compute/src/com/google/cloud/compute/v1small/stub/HttpJsonRegionOperationsCallableFactory.java index d4dd29cd71..d004b97fb0 100644 --- a/test/integration/goldens/compute/src/com/google/cloud/compute/v1small/stub/HttpJsonRegionOperationsCallableFactory.java +++ b/test/integration/goldens/compute/src/com/google/cloud/compute/v1small/stub/HttpJsonRegionOperationsCallableFactory.java @@ -16,7 +16,6 @@ package com.google.cloud.compute.v1small.stub; -import com.google.api.core.BetaApi; import com.google.api.gax.httpjson.HttpJsonCallSettings; import com.google.api.gax.httpjson.HttpJsonCallableFactory; import com.google.api.gax.httpjson.HttpJsonOperationSnapshotCallable; @@ -41,7 +40,6 @@ *

This class is for advanced usage. */ @Generated("by gapic-generator-java") -@BetaApi public class HttpJsonRegionOperationsCallableFactory implements HttpJsonStubCallableFactory { @@ -73,8 +71,6 @@ public UnaryCallable createBatchingCa httpJsonCallSettings, callSettings, clientContext); } - @BetaApi( - "The surface for long-running operations is not stable yet and may change in the future.") @Override public OperationCallable createOperationCallable( diff --git a/test/integration/goldens/compute/src/com/google/cloud/compute/v1small/stub/RegionOperationsStub.java b/test/integration/goldens/compute/src/com/google/cloud/compute/v1small/stub/RegionOperationsStub.java index 7517e20696..60f5de4a71 100644 --- a/test/integration/goldens/compute/src/com/google/cloud/compute/v1small/stub/RegionOperationsStub.java +++ b/test/integration/goldens/compute/src/com/google/cloud/compute/v1small/stub/RegionOperationsStub.java @@ -16,7 +16,6 @@ package com.google.cloud.compute.v1small.stub; -import com.google.api.core.BetaApi; import com.google.api.gax.core.BackgroundResource; import com.google.api.gax.rpc.LongRunningClient; import com.google.api.gax.rpc.UnaryCallable; @@ -34,7 +33,6 @@ @Generated("by gapic-generator-java") public abstract class RegionOperationsStub implements BackgroundResource { - @BetaApi public LongRunningClient longRunningClient() { throw new UnsupportedOperationException("Not implemented: longRunningClient()"); } diff --git a/test/integration/goldens/credentials/src/com/google/cloud/iam/credentials/v1/stub/HttpJsonIamCredentialsCallableFactory.java b/test/integration/goldens/credentials/src/com/google/cloud/iam/credentials/v1/stub/HttpJsonIamCredentialsCallableFactory.java index d17d440123..44cacc7b73 100644 --- a/test/integration/goldens/credentials/src/com/google/cloud/iam/credentials/v1/stub/HttpJsonIamCredentialsCallableFactory.java +++ b/test/integration/goldens/credentials/src/com/google/cloud/iam/credentials/v1/stub/HttpJsonIamCredentialsCallableFactory.java @@ -16,7 +16,6 @@ package com.google.cloud.iam.credentials.v1.stub; -import com.google.api.core.BetaApi; import com.google.api.gax.httpjson.HttpJsonCallSettings; import com.google.api.gax.httpjson.HttpJsonCallableFactory; import com.google.api.gax.httpjson.HttpJsonOperationSnapshotCallable; @@ -41,7 +40,6 @@ *

This class is for advanced usage. */ @Generated("by gapic-generator-java") -@BetaApi public class HttpJsonIamCredentialsCallableFactory implements HttpJsonStubCallableFactory { @@ -73,8 +71,6 @@ public UnaryCallable createBatchingCa httpJsonCallSettings, callSettings, clientContext); } - @BetaApi( - "The surface for long-running operations is not stable yet and may change in the future.") @Override public OperationCallable createOperationCallable( diff --git a/test/integration/goldens/library/src/com/google/cloud/example/library/v1/stub/HttpJsonLibraryServiceCallableFactory.java b/test/integration/goldens/library/src/com/google/cloud/example/library/v1/stub/HttpJsonLibraryServiceCallableFactory.java index 60cd7ae542..0818b5d80c 100644 --- a/test/integration/goldens/library/src/com/google/cloud/example/library/v1/stub/HttpJsonLibraryServiceCallableFactory.java +++ b/test/integration/goldens/library/src/com/google/cloud/example/library/v1/stub/HttpJsonLibraryServiceCallableFactory.java @@ -16,7 +16,6 @@ package com.google.cloud.example.library.v1.stub; -import com.google.api.core.BetaApi; import com.google.api.gax.httpjson.HttpJsonCallSettings; import com.google.api.gax.httpjson.HttpJsonCallableFactory; import com.google.api.gax.httpjson.HttpJsonOperationSnapshotCallable; @@ -41,7 +40,6 @@ *

This class is for advanced usage. */ @Generated("by gapic-generator-java") -@BetaApi public class HttpJsonLibraryServiceCallableFactory implements HttpJsonStubCallableFactory { @@ -73,8 +71,6 @@ public UnaryCallable createBatchingCa httpJsonCallSettings, callSettings, clientContext); } - @BetaApi( - "The surface for long-running operations is not stable yet and may change in the future.") @Override public OperationCallable createOperationCallable( diff --git a/test/integration/goldens/logging/src/com/google/cloud/logging/v2/stub/ConfigServiceV2StubSettings.java b/test/integration/goldens/logging/src/com/google/cloud/logging/v2/stub/ConfigServiceV2StubSettings.java index 8d53820dd7..2d27a6965d 100644 --- a/test/integration/goldens/logging/src/com/google/cloud/logging/v2/stub/ConfigServiceV2StubSettings.java +++ b/test/integration/goldens/logging/src/com/google/cloud/logging/v2/stub/ConfigServiceV2StubSettings.java @@ -23,7 +23,6 @@ import com.google.api.core.ApiFunction; import com.google.api.core.ApiFuture; -import com.google.api.core.BetaApi; import com.google.api.gax.core.GaxProperties; import com.google.api.gax.core.GoogleCredentialsProvider; import com.google.api.gax.core.InstantiatingExecutorProvider; @@ -1200,8 +1199,6 @@ public UnaryCallSettings.Builder copyLogEntrie } /** Returns the builder for the settings used for calls to copyLogEntries. */ - @BetaApi( - "The surface for use by generated code is not stable yet and may change in the future.") public OperationCallSettings.Builder< CopyLogEntriesRequest, CopyLogEntriesResponse, CopyLogEntriesMetadata> copyLogEntriesOperationSettings() { diff --git a/test/integration/goldens/logging/src/com/google/logging/v2/CmekSettingsName.java b/test/integration/goldens/logging/src/com/google/logging/v2/CmekSettingsName.java index 63c0183a11..4695948530 100644 --- a/test/integration/goldens/logging/src/com/google/logging/v2/CmekSettingsName.java +++ b/test/integration/goldens/logging/src/com/google/logging/v2/CmekSettingsName.java @@ -16,7 +16,6 @@ package com.google.logging.v2; -import com.google.api.core.BetaApi; import com.google.api.pathtemplate.PathTemplate; import com.google.api.pathtemplate.ValidationException; import com.google.api.resourcenames.ResourceName; @@ -107,22 +106,18 @@ public static Builder newBuilder() { return new Builder(); } - @BetaApi("The per-pattern Builders are not stable yet and may be changed in the future.") public static Builder newProjectBuilder() { return new Builder(); } - @BetaApi("The per-pattern Builders are not stable yet and may be changed in the future.") public static OrganizationBuilder newOrganizationBuilder() { return new OrganizationBuilder(); } - @BetaApi("The per-pattern Builders are not stable yet and may be changed in the future.") public static FolderBuilder newFolderBuilder() { return new FolderBuilder(); } - @BetaApi("The per-pattern Builders are not stable yet and may be changed in the future.") public static BillingAccountBuilder newBillingAccountBuilder() { return new BillingAccountBuilder(); } @@ -135,22 +130,18 @@ public static CmekSettingsName of(String project) { return newBuilder().setProject(project).build(); } - @BetaApi("The static create methods are not stable yet and may be changed in the future.") public static CmekSettingsName ofProjectName(String project) { return newBuilder().setProject(project).build(); } - @BetaApi("The static create methods are not stable yet and may be changed in the future.") public static CmekSettingsName ofOrganizationName(String organization) { return newOrganizationBuilder().setOrganization(organization).build(); } - @BetaApi("The static create methods are not stable yet and may be changed in the future.") public static CmekSettingsName ofFolderName(String folder) { return newFolderBuilder().setFolder(folder).build(); } - @BetaApi("The static create methods are not stable yet and may be changed in the future.") public static CmekSettingsName ofBillingAccountName(String billingAccount) { return newBillingAccountBuilder().setBillingAccount(billingAccount).build(); } @@ -159,22 +150,18 @@ public static String format(String project) { return newBuilder().setProject(project).build().toString(); } - @BetaApi("The static format methods are not stable yet and may be changed in the future.") public static String formatProjectName(String project) { return newBuilder().setProject(project).build().toString(); } - @BetaApi("The static format methods are not stable yet and may be changed in the future.") public static String formatOrganizationName(String organization) { return newOrganizationBuilder().setOrganization(organization).build().toString(); } - @BetaApi("The static format methods are not stable yet and may be changed in the future.") public static String formatFolderName(String folder) { return newFolderBuilder().setFolder(folder).build().toString(); } - @BetaApi("The static format methods are not stable yet and may be changed in the future.") public static String formatBillingAccountName(String billingAccount) { return newBillingAccountBuilder().setBillingAccount(billingAccount).build().toString(); } @@ -319,7 +306,6 @@ public CmekSettingsName build() { } /** Builder for organizations/{organization}/cmekSettings. */ - @BetaApi("The per-pattern Builders are not stable yet and may be changed in the future.") public static class OrganizationBuilder { private String organization; @@ -340,7 +326,6 @@ public CmekSettingsName build() { } /** Builder for folders/{folder}/cmekSettings. */ - @BetaApi("The per-pattern Builders are not stable yet and may be changed in the future.") public static class FolderBuilder { private String folder; @@ -361,7 +346,6 @@ public CmekSettingsName build() { } /** Builder for billingAccounts/{billing_account}/cmekSettings. */ - @BetaApi("The per-pattern Builders are not stable yet and may be changed in the future.") public static class BillingAccountBuilder { private String billingAccount; diff --git a/test/integration/goldens/logging/src/com/google/logging/v2/LogBucketName.java b/test/integration/goldens/logging/src/com/google/logging/v2/LogBucketName.java index 0f77e30267..9b94f46faf 100644 --- a/test/integration/goldens/logging/src/com/google/logging/v2/LogBucketName.java +++ b/test/integration/goldens/logging/src/com/google/logging/v2/LogBucketName.java @@ -16,7 +16,6 @@ package com.google.logging.v2; -import com.google.api.core.BetaApi; import com.google.api.pathtemplate.PathTemplate; import com.google.api.pathtemplate.ValidationException; import com.google.api.resourcenames.ResourceName; @@ -131,22 +130,18 @@ public static Builder newBuilder() { return new Builder(); } - @BetaApi("The per-pattern Builders are not stable yet and may be changed in the future.") public static Builder newProjectLocationBucketBuilder() { return new Builder(); } - @BetaApi("The per-pattern Builders are not stable yet and may be changed in the future.") public static OrganizationLocationBucketBuilder newOrganizationLocationBucketBuilder() { return new OrganizationLocationBucketBuilder(); } - @BetaApi("The per-pattern Builders are not stable yet and may be changed in the future.") public static FolderLocationBucketBuilder newFolderLocationBucketBuilder() { return new FolderLocationBucketBuilder(); } - @BetaApi("The per-pattern Builders are not stable yet and may be changed in the future.") public static BillingAccountLocationBucketBuilder newBillingAccountLocationBucketBuilder() { return new BillingAccountLocationBucketBuilder(); } @@ -159,13 +154,11 @@ public static LogBucketName of(String project, String location, String bucket) { return newBuilder().setProject(project).setLocation(location).setBucket(bucket).build(); } - @BetaApi("The static create methods are not stable yet and may be changed in the future.") public static LogBucketName ofProjectLocationBucketName( String project, String location, String bucket) { return newBuilder().setProject(project).setLocation(location).setBucket(bucket).build(); } - @BetaApi("The static create methods are not stable yet and may be changed in the future.") public static LogBucketName ofOrganizationLocationBucketName( String organization, String location, String bucket) { return newOrganizationLocationBucketBuilder() @@ -175,7 +168,6 @@ public static LogBucketName ofOrganizationLocationBucketName( .build(); } - @BetaApi("The static create methods are not stable yet and may be changed in the future.") public static LogBucketName ofFolderLocationBucketName( String folder, String location, String bucket) { return newFolderLocationBucketBuilder() @@ -185,7 +177,6 @@ public static LogBucketName ofFolderLocationBucketName( .build(); } - @BetaApi("The static create methods are not stable yet and may be changed in the future.") public static LogBucketName ofBillingAccountLocationBucketName( String billingAccount, String location, String bucket) { return newBillingAccountLocationBucketBuilder() @@ -204,7 +195,6 @@ public static String format(String project, String location, String bucket) { .toString(); } - @BetaApi("The static format methods are not stable yet and may be changed in the future.") public static String formatProjectLocationBucketName( String project, String location, String bucket) { return newBuilder() @@ -215,7 +205,6 @@ public static String formatProjectLocationBucketName( .toString(); } - @BetaApi("The static format methods are not stable yet and may be changed in the future.") public static String formatOrganizationLocationBucketName( String organization, String location, String bucket) { return newOrganizationLocationBucketBuilder() @@ -226,7 +215,6 @@ public static String formatOrganizationLocationBucketName( .toString(); } - @BetaApi("The static format methods are not stable yet and may be changed in the future.") public static String formatFolderLocationBucketName( String folder, String location, String bucket) { return newFolderLocationBucketBuilder() @@ -237,7 +225,6 @@ public static String formatFolderLocationBucketName( .toString(); } - @BetaApi("The static format methods are not stable yet and may be changed in the future.") public static String formatBillingAccountLocationBucketName( String billingAccount, String location, String bucket) { return newBillingAccountLocationBucketBuilder() @@ -426,7 +413,6 @@ public LogBucketName build() { } /** Builder for organizations/{organization}/locations/{location}/buckets/{bucket}. */ - @BetaApi("The per-pattern Builders are not stable yet and may be changed in the future.") public static class OrganizationLocationBucketBuilder { private String organization; private String location; @@ -467,7 +453,6 @@ public LogBucketName build() { } /** Builder for folders/{folder}/locations/{location}/buckets/{bucket}. */ - @BetaApi("The per-pattern Builders are not stable yet and may be changed in the future.") public static class FolderLocationBucketBuilder { private String folder; private String location; @@ -508,7 +493,6 @@ public LogBucketName build() { } /** Builder for billingAccounts/{billing_account}/locations/{location}/buckets/{bucket}. */ - @BetaApi("The per-pattern Builders are not stable yet and may be changed in the future.") public static class BillingAccountLocationBucketBuilder { private String billingAccount; private String location; diff --git a/test/integration/goldens/logging/src/com/google/logging/v2/LogExclusionName.java b/test/integration/goldens/logging/src/com/google/logging/v2/LogExclusionName.java index 2fa6913c62..c074cd4773 100644 --- a/test/integration/goldens/logging/src/com/google/logging/v2/LogExclusionName.java +++ b/test/integration/goldens/logging/src/com/google/logging/v2/LogExclusionName.java @@ -16,7 +16,6 @@ package com.google.logging.v2; -import com.google.api.core.BetaApi; import com.google.api.pathtemplate.PathTemplate; import com.google.api.pathtemplate.ValidationException; import com.google.api.resourcenames.ResourceName; @@ -118,22 +117,18 @@ public static Builder newBuilder() { return new Builder(); } - @BetaApi("The per-pattern Builders are not stable yet and may be changed in the future.") public static Builder newProjectExclusionBuilder() { return new Builder(); } - @BetaApi("The per-pattern Builders are not stable yet and may be changed in the future.") public static OrganizationExclusionBuilder newOrganizationExclusionBuilder() { return new OrganizationExclusionBuilder(); } - @BetaApi("The per-pattern Builders are not stable yet and may be changed in the future.") public static FolderExclusionBuilder newFolderExclusionBuilder() { return new FolderExclusionBuilder(); } - @BetaApi("The per-pattern Builders are not stable yet and may be changed in the future.") public static BillingAccountExclusionBuilder newBillingAccountExclusionBuilder() { return new BillingAccountExclusionBuilder(); } @@ -146,12 +141,10 @@ public static LogExclusionName of(String project, String exclusion) { return newBuilder().setProject(project).setExclusion(exclusion).build(); } - @BetaApi("The static create methods are not stable yet and may be changed in the future.") public static LogExclusionName ofProjectExclusionName(String project, String exclusion) { return newBuilder().setProject(project).setExclusion(exclusion).build(); } - @BetaApi("The static create methods are not stable yet and may be changed in the future.") public static LogExclusionName ofOrganizationExclusionName( String organization, String exclusion) { return newOrganizationExclusionBuilder() @@ -160,12 +153,10 @@ public static LogExclusionName ofOrganizationExclusionName( .build(); } - @BetaApi("The static create methods are not stable yet and may be changed in the future.") public static LogExclusionName ofFolderExclusionName(String folder, String exclusion) { return newFolderExclusionBuilder().setFolder(folder).setExclusion(exclusion).build(); } - @BetaApi("The static create methods are not stable yet and may be changed in the future.") public static LogExclusionName ofBillingAccountExclusionName( String billingAccount, String exclusion) { return newBillingAccountExclusionBuilder() @@ -178,12 +169,10 @@ public static String format(String project, String exclusion) { return newBuilder().setProject(project).setExclusion(exclusion).build().toString(); } - @BetaApi("The static format methods are not stable yet and may be changed in the future.") public static String formatProjectExclusionName(String project, String exclusion) { return newBuilder().setProject(project).setExclusion(exclusion).build().toString(); } - @BetaApi("The static format methods are not stable yet and may be changed in the future.") public static String formatOrganizationExclusionName(String organization, String exclusion) { return newOrganizationExclusionBuilder() .setOrganization(organization) @@ -192,12 +181,10 @@ public static String formatOrganizationExclusionName(String organization, String .toString(); } - @BetaApi("The static format methods are not stable yet and may be changed in the future.") public static String formatFolderExclusionName(String folder, String exclusion) { return newFolderExclusionBuilder().setFolder(folder).setExclusion(exclusion).build().toString(); } - @BetaApi("The static format methods are not stable yet and may be changed in the future.") public static String formatBillingAccountExclusionName(String billingAccount, String exclusion) { return newBillingAccountExclusionBuilder() .setBillingAccount(billingAccount) @@ -364,7 +351,6 @@ public LogExclusionName build() { } /** Builder for organizations/{organization}/exclusions/{exclusion}. */ - @BetaApi("The per-pattern Builders are not stable yet and may be changed in the future.") public static class OrganizationExclusionBuilder { private String organization; private String exclusion; @@ -395,7 +381,6 @@ public LogExclusionName build() { } /** Builder for folders/{folder}/exclusions/{exclusion}. */ - @BetaApi("The per-pattern Builders are not stable yet and may be changed in the future.") public static class FolderExclusionBuilder { private String folder; private String exclusion; @@ -426,7 +411,6 @@ public LogExclusionName build() { } /** Builder for billingAccounts/{billing_account}/exclusions/{exclusion}. */ - @BetaApi("The per-pattern Builders are not stable yet and may be changed in the future.") public static class BillingAccountExclusionBuilder { private String billingAccount; private String exclusion; diff --git a/test/integration/goldens/logging/src/com/google/logging/v2/LogName.java b/test/integration/goldens/logging/src/com/google/logging/v2/LogName.java index 21c790f861..69ad97a73e 100644 --- a/test/integration/goldens/logging/src/com/google/logging/v2/LogName.java +++ b/test/integration/goldens/logging/src/com/google/logging/v2/LogName.java @@ -16,7 +16,6 @@ package com.google.logging.v2; -import com.google.api.core.BetaApi; import com.google.api.pathtemplate.PathTemplate; import com.google.api.pathtemplate.ValidationException; import com.google.api.resourcenames.ResourceName; @@ -117,22 +116,18 @@ public static Builder newBuilder() { return new Builder(); } - @BetaApi("The per-pattern Builders are not stable yet and may be changed in the future.") public static Builder newProjectLogBuilder() { return new Builder(); } - @BetaApi("The per-pattern Builders are not stable yet and may be changed in the future.") public static OrganizationLogBuilder newOrganizationLogBuilder() { return new OrganizationLogBuilder(); } - @BetaApi("The per-pattern Builders are not stable yet and may be changed in the future.") public static FolderLogBuilder newFolderLogBuilder() { return new FolderLogBuilder(); } - @BetaApi("The per-pattern Builders are not stable yet and may be changed in the future.") public static BillingAccountLogBuilder newBillingAccountLogBuilder() { return new BillingAccountLogBuilder(); } @@ -145,22 +140,18 @@ public static LogName of(String project, String log) { return newBuilder().setProject(project).setLog(log).build(); } - @BetaApi("The static create methods are not stable yet and may be changed in the future.") public static LogName ofProjectLogName(String project, String log) { return newBuilder().setProject(project).setLog(log).build(); } - @BetaApi("The static create methods are not stable yet and may be changed in the future.") public static LogName ofOrganizationLogName(String organization, String log) { return newOrganizationLogBuilder().setOrganization(organization).setLog(log).build(); } - @BetaApi("The static create methods are not stable yet and may be changed in the future.") public static LogName ofFolderLogName(String folder, String log) { return newFolderLogBuilder().setFolder(folder).setLog(log).build(); } - @BetaApi("The static create methods are not stable yet and may be changed in the future.") public static LogName ofBillingAccountLogName(String billingAccount, String log) { return newBillingAccountLogBuilder().setBillingAccount(billingAccount).setLog(log).build(); } @@ -169,22 +160,18 @@ public static String format(String project, String log) { return newBuilder().setProject(project).setLog(log).build().toString(); } - @BetaApi("The static format methods are not stable yet and may be changed in the future.") public static String formatProjectLogName(String project, String log) { return newBuilder().setProject(project).setLog(log).build().toString(); } - @BetaApi("The static format methods are not stable yet and may be changed in the future.") public static String formatOrganizationLogName(String organization, String log) { return newOrganizationLogBuilder().setOrganization(organization).setLog(log).build().toString(); } - @BetaApi("The static format methods are not stable yet and may be changed in the future.") public static String formatFolderLogName(String folder, String log) { return newFolderLogBuilder().setFolder(folder).setLog(log).build().toString(); } - @BetaApi("The static format methods are not stable yet and may be changed in the future.") public static String formatBillingAccountLogName(String billingAccount, String log) { return newBillingAccountLogBuilder() .setBillingAccount(billingAccount) @@ -350,7 +337,6 @@ public LogName build() { } /** Builder for organizations/{organization}/logs/{log}. */ - @BetaApi("The per-pattern Builders are not stable yet and may be changed in the future.") public static class OrganizationLogBuilder { private String organization; private String log; @@ -381,7 +367,6 @@ public LogName build() { } /** Builder for folders/{folder}/logs/{log}. */ - @BetaApi("The per-pattern Builders are not stable yet and may be changed in the future.") public static class FolderLogBuilder { private String folder; private String log; @@ -412,7 +397,6 @@ public LogName build() { } /** Builder for billingAccounts/{billing_account}/logs/{log}. */ - @BetaApi("The per-pattern Builders are not stable yet and may be changed in the future.") public static class BillingAccountLogBuilder { private String billingAccount; private String log; diff --git a/test/integration/goldens/logging/src/com/google/logging/v2/LogSinkName.java b/test/integration/goldens/logging/src/com/google/logging/v2/LogSinkName.java index 030992a76f..257e07444b 100644 --- a/test/integration/goldens/logging/src/com/google/logging/v2/LogSinkName.java +++ b/test/integration/goldens/logging/src/com/google/logging/v2/LogSinkName.java @@ -16,7 +16,6 @@ package com.google.logging.v2; -import com.google.api.core.BetaApi; import com.google.api.pathtemplate.PathTemplate; import com.google.api.pathtemplate.ValidationException; import com.google.api.resourcenames.ResourceName; @@ -117,22 +116,18 @@ public static Builder newBuilder() { return new Builder(); } - @BetaApi("The per-pattern Builders are not stable yet and may be changed in the future.") public static Builder newProjectSinkBuilder() { return new Builder(); } - @BetaApi("The per-pattern Builders are not stable yet and may be changed in the future.") public static OrganizationSinkBuilder newOrganizationSinkBuilder() { return new OrganizationSinkBuilder(); } - @BetaApi("The per-pattern Builders are not stable yet and may be changed in the future.") public static FolderSinkBuilder newFolderSinkBuilder() { return new FolderSinkBuilder(); } - @BetaApi("The per-pattern Builders are not stable yet and may be changed in the future.") public static BillingAccountSinkBuilder newBillingAccountSinkBuilder() { return new BillingAccountSinkBuilder(); } @@ -145,22 +140,18 @@ public static LogSinkName of(String project, String sink) { return newBuilder().setProject(project).setSink(sink).build(); } - @BetaApi("The static create methods are not stable yet and may be changed in the future.") public static LogSinkName ofProjectSinkName(String project, String sink) { return newBuilder().setProject(project).setSink(sink).build(); } - @BetaApi("The static create methods are not stable yet and may be changed in the future.") public static LogSinkName ofOrganizationSinkName(String organization, String sink) { return newOrganizationSinkBuilder().setOrganization(organization).setSink(sink).build(); } - @BetaApi("The static create methods are not stable yet and may be changed in the future.") public static LogSinkName ofFolderSinkName(String folder, String sink) { return newFolderSinkBuilder().setFolder(folder).setSink(sink).build(); } - @BetaApi("The static create methods are not stable yet and may be changed in the future.") public static LogSinkName ofBillingAccountSinkName(String billingAccount, String sink) { return newBillingAccountSinkBuilder().setBillingAccount(billingAccount).setSink(sink).build(); } @@ -169,12 +160,10 @@ public static String format(String project, String sink) { return newBuilder().setProject(project).setSink(sink).build().toString(); } - @BetaApi("The static format methods are not stable yet and may be changed in the future.") public static String formatProjectSinkName(String project, String sink) { return newBuilder().setProject(project).setSink(sink).build().toString(); } - @BetaApi("The static format methods are not stable yet and may be changed in the future.") public static String formatOrganizationSinkName(String organization, String sink) { return newOrganizationSinkBuilder() .setOrganization(organization) @@ -183,12 +172,10 @@ public static String formatOrganizationSinkName(String organization, String sink .toString(); } - @BetaApi("The static format methods are not stable yet and may be changed in the future.") public static String formatFolderSinkName(String folder, String sink) { return newFolderSinkBuilder().setFolder(folder).setSink(sink).build().toString(); } - @BetaApi("The static format methods are not stable yet and may be changed in the future.") public static String formatBillingAccountSinkName(String billingAccount, String sink) { return newBillingAccountSinkBuilder() .setBillingAccount(billingAccount) @@ -354,7 +341,6 @@ public LogSinkName build() { } /** Builder for organizations/{organization}/sinks/{sink}. */ - @BetaApi("The per-pattern Builders are not stable yet and may be changed in the future.") public static class OrganizationSinkBuilder { private String organization; private String sink; @@ -385,7 +371,6 @@ public LogSinkName build() { } /** Builder for folders/{folder}/sinks/{sink}. */ - @BetaApi("The per-pattern Builders are not stable yet and may be changed in the future.") public static class FolderSinkBuilder { private String folder; private String sink; @@ -416,7 +401,6 @@ public LogSinkName build() { } /** Builder for billingAccounts/{billing_account}/sinks/{sink}. */ - @BetaApi("The per-pattern Builders are not stable yet and may be changed in the future.") public static class BillingAccountSinkBuilder { private String billingAccount; private String sink; diff --git a/test/integration/goldens/logging/src/com/google/logging/v2/LogViewName.java b/test/integration/goldens/logging/src/com/google/logging/v2/LogViewName.java index 92b3a1ad75..75f36ab113 100644 --- a/test/integration/goldens/logging/src/com/google/logging/v2/LogViewName.java +++ b/test/integration/goldens/logging/src/com/google/logging/v2/LogViewName.java @@ -16,7 +16,6 @@ package com.google.logging.v2; -import com.google.api.core.BetaApi; import com.google.api.pathtemplate.PathTemplate; import com.google.api.pathtemplate.ValidationException; import com.google.api.resourcenames.ResourceName; @@ -141,22 +140,18 @@ public static Builder newBuilder() { return new Builder(); } - @BetaApi("The per-pattern Builders are not stable yet and may be changed in the future.") public static Builder newProjectLocationBucketViewBuilder() { return new Builder(); } - @BetaApi("The per-pattern Builders are not stable yet and may be changed in the future.") public static OrganizationLocationBucketViewBuilder newOrganizationLocationBucketViewBuilder() { return new OrganizationLocationBucketViewBuilder(); } - @BetaApi("The per-pattern Builders are not stable yet and may be changed in the future.") public static FolderLocationBucketViewBuilder newFolderLocationBucketViewBuilder() { return new FolderLocationBucketViewBuilder(); } - @BetaApi("The per-pattern Builders are not stable yet and may be changed in the future.") public static BillingAccountLocationBucketViewBuilder newBillingAccountLocationBucketViewBuilder() { return new BillingAccountLocationBucketViewBuilder(); @@ -175,7 +170,6 @@ public static LogViewName of(String project, String location, String bucket, Str .build(); } - @BetaApi("The static create methods are not stable yet and may be changed in the future.") public static LogViewName ofProjectLocationBucketViewName( String project, String location, String bucket, String view) { return newBuilder() @@ -186,7 +180,6 @@ public static LogViewName ofProjectLocationBucketViewName( .build(); } - @BetaApi("The static create methods are not stable yet and may be changed in the future.") public static LogViewName ofOrganizationLocationBucketViewName( String organization, String location, String bucket, String view) { return newOrganizationLocationBucketViewBuilder() @@ -197,7 +190,6 @@ public static LogViewName ofOrganizationLocationBucketViewName( .build(); } - @BetaApi("The static create methods are not stable yet and may be changed in the future.") public static LogViewName ofFolderLocationBucketViewName( String folder, String location, String bucket, String view) { return newFolderLocationBucketViewBuilder() @@ -208,7 +200,6 @@ public static LogViewName ofFolderLocationBucketViewName( .build(); } - @BetaApi("The static create methods are not stable yet and may be changed in the future.") public static LogViewName ofBillingAccountLocationBucketViewName( String billingAccount, String location, String bucket, String view) { return newBillingAccountLocationBucketViewBuilder() @@ -229,7 +220,6 @@ public static String format(String project, String location, String bucket, Stri .toString(); } - @BetaApi("The static format methods are not stable yet and may be changed in the future.") public static String formatProjectLocationBucketViewName( String project, String location, String bucket, String view) { return newBuilder() @@ -241,7 +231,6 @@ public static String formatProjectLocationBucketViewName( .toString(); } - @BetaApi("The static format methods are not stable yet and may be changed in the future.") public static String formatOrganizationLocationBucketViewName( String organization, String location, String bucket, String view) { return newOrganizationLocationBucketViewBuilder() @@ -253,7 +242,6 @@ public static String formatOrganizationLocationBucketViewName( .toString(); } - @BetaApi("The static format methods are not stable yet and may be changed in the future.") public static String formatFolderLocationBucketViewName( String folder, String location, String bucket, String view) { return newFolderLocationBucketViewBuilder() @@ -265,7 +253,6 @@ public static String formatFolderLocationBucketViewName( .toString(); } - @BetaApi("The static format methods are not stable yet and may be changed in the future.") public static String formatBillingAccountLocationBucketViewName( String billingAccount, String location, String bucket, String view) { return newBillingAccountLocationBucketViewBuilder() @@ -486,7 +473,6 @@ public LogViewName build() { /** * Builder for organizations/{organization}/locations/{location}/buckets/{bucket}/views/{view}. */ - @BetaApi("The per-pattern Builders are not stable yet and may be changed in the future.") public static class OrganizationLocationBucketViewBuilder { private String organization; private String location; @@ -537,7 +523,6 @@ public LogViewName build() { } /** Builder for folders/{folder}/locations/{location}/buckets/{bucket}/views/{view}. */ - @BetaApi("The per-pattern Builders are not stable yet and may be changed in the future.") public static class FolderLocationBucketViewBuilder { private String folder; private String location; @@ -591,7 +576,6 @@ public LogViewName build() { * Builder for * billingAccounts/{billing_account}/locations/{location}/buckets/{bucket}/views/{view}. */ - @BetaApi("The per-pattern Builders are not stable yet and may be changed in the future.") public static class BillingAccountLocationBucketViewBuilder { private String billingAccount; private String location; diff --git a/test/integration/goldens/logging/src/com/google/logging/v2/SettingsName.java b/test/integration/goldens/logging/src/com/google/logging/v2/SettingsName.java index 86322c9321..ab9e462544 100644 --- a/test/integration/goldens/logging/src/com/google/logging/v2/SettingsName.java +++ b/test/integration/goldens/logging/src/com/google/logging/v2/SettingsName.java @@ -16,7 +16,6 @@ package com.google.logging.v2; -import com.google.api.core.BetaApi; import com.google.api.pathtemplate.PathTemplate; import com.google.api.pathtemplate.ValidationException; import com.google.api.resourcenames.ResourceName; @@ -107,22 +106,18 @@ public static Builder newBuilder() { return new Builder(); } - @BetaApi("The per-pattern Builders are not stable yet and may be changed in the future.") public static Builder newProjectBuilder() { return new Builder(); } - @BetaApi("The per-pattern Builders are not stable yet and may be changed in the future.") public static OrganizationBuilder newOrganizationBuilder() { return new OrganizationBuilder(); } - @BetaApi("The per-pattern Builders are not stable yet and may be changed in the future.") public static FolderBuilder newFolderBuilder() { return new FolderBuilder(); } - @BetaApi("The per-pattern Builders are not stable yet and may be changed in the future.") public static BillingAccountBuilder newBillingAccountBuilder() { return new BillingAccountBuilder(); } @@ -135,22 +130,18 @@ public static SettingsName of(String project) { return newBuilder().setProject(project).build(); } - @BetaApi("The static create methods are not stable yet and may be changed in the future.") public static SettingsName ofProjectName(String project) { return newBuilder().setProject(project).build(); } - @BetaApi("The static create methods are not stable yet and may be changed in the future.") public static SettingsName ofOrganizationName(String organization) { return newOrganizationBuilder().setOrganization(organization).build(); } - @BetaApi("The static create methods are not stable yet and may be changed in the future.") public static SettingsName ofFolderName(String folder) { return newFolderBuilder().setFolder(folder).build(); } - @BetaApi("The static create methods are not stable yet and may be changed in the future.") public static SettingsName ofBillingAccountName(String billingAccount) { return newBillingAccountBuilder().setBillingAccount(billingAccount).build(); } @@ -159,22 +150,18 @@ public static String format(String project) { return newBuilder().setProject(project).build().toString(); } - @BetaApi("The static format methods are not stable yet and may be changed in the future.") public static String formatProjectName(String project) { return newBuilder().setProject(project).build().toString(); } - @BetaApi("The static format methods are not stable yet and may be changed in the future.") public static String formatOrganizationName(String organization) { return newOrganizationBuilder().setOrganization(organization).build().toString(); } - @BetaApi("The static format methods are not stable yet and may be changed in the future.") public static String formatFolderName(String folder) { return newFolderBuilder().setFolder(folder).build().toString(); } - @BetaApi("The static format methods are not stable yet and may be changed in the future.") public static String formatBillingAccountName(String billingAccount) { return newBillingAccountBuilder().setBillingAccount(billingAccount).build().toString(); } @@ -319,7 +306,6 @@ public SettingsName build() { } /** Builder for organizations/{organization}/settings. */ - @BetaApi("The per-pattern Builders are not stable yet and may be changed in the future.") public static class OrganizationBuilder { private String organization; @@ -340,7 +326,6 @@ public SettingsName build() { } /** Builder for folders/{folder}/settings. */ - @BetaApi("The per-pattern Builders are not stable yet and may be changed in the future.") public static class FolderBuilder { private String folder; @@ -361,7 +346,6 @@ public SettingsName build() { } /** Builder for billingAccounts/{billing_account}/settings. */ - @BetaApi("The per-pattern Builders are not stable yet and may be changed in the future.") public static class BillingAccountBuilder { private String billingAccount; diff --git a/test/integration/goldens/pubsub/src/com/google/pubsub/v1/TopicName.java b/test/integration/goldens/pubsub/src/com/google/pubsub/v1/TopicName.java index abae4f0317..8fe96fcb8d 100644 --- a/test/integration/goldens/pubsub/src/com/google/pubsub/v1/TopicName.java +++ b/test/integration/goldens/pubsub/src/com/google/pubsub/v1/TopicName.java @@ -16,7 +16,6 @@ package com.google.pubsub.v1; -import com.google.api.core.BetaApi; import com.google.api.pathtemplate.PathTemplate; import com.google.api.pathtemplate.ValidationException; import com.google.api.resourcenames.ResourceName; @@ -71,7 +70,6 @@ public static Builder newBuilder() { return new Builder(); } - @BetaApi("The per-pattern Builders are not stable yet and may be changed in the future.") public static Builder newProjectTopicBuilder() { return new Builder(); } @@ -84,12 +82,10 @@ public static TopicName of(String project, String topic) { return newBuilder().setProject(project).setTopic(topic).build(); } - @BetaApi("The static create methods are not stable yet and may be changed in the future.") public static TopicName ofProjectTopicName(String project, String topic) { return newBuilder().setProject(project).setTopic(topic).build(); } - @BetaApi("The static create methods are not stable yet and may be changed in the future.") public static TopicName ofDeletedTopicName() { return new TopicName("_deleted-topic_"); } @@ -98,12 +94,10 @@ public static String format(String project, String topic) { return newBuilder().setProject(project).setTopic(topic).build().toString(); } - @BetaApi("The static format methods are not stable yet and may be changed in the future.") public static String formatProjectTopicName(String project, String topic) { return newBuilder().setProject(project).setTopic(topic).build().toString(); } - @BetaApi("The static format methods are not stable yet and may be changed in the future.") public static String formatDeletedTopicName() { return "_deleted-topic_"; } diff --git a/test/integration/goldens/redis/src/com/google/cloud/redis/v1beta1/stub/CloudRedisStubSettings.java b/test/integration/goldens/redis/src/com/google/cloud/redis/v1beta1/stub/CloudRedisStubSettings.java index 937ab5700a..3b256b283c 100644 --- a/test/integration/goldens/redis/src/com/google/cloud/redis/v1beta1/stub/CloudRedisStubSettings.java +++ b/test/integration/goldens/redis/src/com/google/cloud/redis/v1beta1/stub/CloudRedisStubSettings.java @@ -907,8 +907,6 @@ public UnaryCallSettings.Builder createInstanc } /** Returns the builder for the settings used for calls to createInstance. */ - @BetaApi( - "The surface for use by generated code is not stable yet and may change in the future.") public OperationCallSettings.Builder createInstanceOperationSettings() { return createInstanceOperationSettings; @@ -920,8 +918,6 @@ public UnaryCallSettings.Builder updateInstanc } /** Returns the builder for the settings used for calls to updateInstance. */ - @BetaApi( - "The surface for use by generated code is not stable yet and may change in the future.") public OperationCallSettings.Builder updateInstanceOperationSettings() { return updateInstanceOperationSettings; @@ -933,8 +929,6 @@ public UnaryCallSettings.Builder upgradeInsta } /** Returns the builder for the settings used for calls to upgradeInstance. */ - @BetaApi( - "The surface for use by generated code is not stable yet and may change in the future.") public OperationCallSettings.Builder upgradeInstanceOperationSettings() { return upgradeInstanceOperationSettings; @@ -946,8 +940,6 @@ public UnaryCallSettings.Builder importInstanc } /** Returns the builder for the settings used for calls to importInstance. */ - @BetaApi( - "The surface for use by generated code is not stable yet and may change in the future.") public OperationCallSettings.Builder importInstanceOperationSettings() { return importInstanceOperationSettings; @@ -959,8 +951,6 @@ public UnaryCallSettings.Builder exportInstanc } /** Returns the builder for the settings used for calls to exportInstance. */ - @BetaApi( - "The surface for use by generated code is not stable yet and may change in the future.") public OperationCallSettings.Builder exportInstanceOperationSettings() { return exportInstanceOperationSettings; @@ -973,8 +963,6 @@ public UnaryCallSettings.Builder exportInstanc } /** Returns the builder for the settings used for calls to failoverInstance. */ - @BetaApi( - "The surface for use by generated code is not stable yet and may change in the future.") public OperationCallSettings.Builder failoverInstanceOperationSettings() { return failoverInstanceOperationSettings; @@ -986,8 +974,6 @@ public UnaryCallSettings.Builder deleteInstanc } /** Returns the builder for the settings used for calls to deleteInstance. */ - @BetaApi( - "The surface for use by generated code is not stable yet and may change in the future.") public OperationCallSettings.Builder deleteInstanceOperationSettings() { return deleteInstanceOperationSettings; @@ -1000,8 +986,6 @@ public UnaryCallSettings.Builder deleteInstanc } /** Returns the builder for the settings used for calls to rescheduleMaintenance. */ - @BetaApi( - "The surface for use by generated code is not stable yet and may change in the future.") public OperationCallSettings.Builder rescheduleMaintenanceOperationSettings() { return rescheduleMaintenanceOperationSettings; diff --git a/test/integration/goldens/redis/src/com/google/cloud/redis/v1beta1/stub/HttpJsonCloudRedisCallableFactory.java b/test/integration/goldens/redis/src/com/google/cloud/redis/v1beta1/stub/HttpJsonCloudRedisCallableFactory.java index 62351e0986..0a60408c3e 100644 --- a/test/integration/goldens/redis/src/com/google/cloud/redis/v1beta1/stub/HttpJsonCloudRedisCallableFactory.java +++ b/test/integration/goldens/redis/src/com/google/cloud/redis/v1beta1/stub/HttpJsonCloudRedisCallableFactory.java @@ -73,8 +73,6 @@ public UnaryCallable createBatchingCa httpJsonCallSettings, callSettings, clientContext); } - @BetaApi( - "The surface for long-running operations is not stable yet and may change in the future.") @Override public OperationCallable createOperationCallable( diff --git a/versions.txt b/versions.txt index dd4ea0a207..9faf00aea2 100644 --- a/versions.txt +++ b/versions.txt @@ -1,19 +1,19 @@ # Format: # module:released-version:current-version -gapic-generator-java:2.35.0:2.35.1-SNAPSHOT -api-common:2.26.0:2.26.1-SNAPSHOT -gax:2.43.0:2.43.1-SNAPSHOT -gax-grpc:2.43.0:2.43.1-SNAPSHOT -gax-httpjson:0.128.0:0.128.1-SNAPSHOT -proto-google-common-protos:2.34.0:2.34.1-SNAPSHOT -grpc-google-common-protos:2.34.0:2.34.1-SNAPSHOT -proto-google-iam-v1:1.29.0:1.29.1-SNAPSHOT -grpc-google-iam-v1:1.29.0:1.29.1-SNAPSHOT -proto-google-iam-v2beta:1.29.0:1.29.1-SNAPSHOT -grpc-google-iam-v2beta:1.29.0:1.29.1-SNAPSHOT -google-iam-policy:1.29.0:1.29.1-SNAPSHOT -proto-google-iam-v2:1.29.0:1.29.1-SNAPSHOT -grpc-google-iam-v2:1.29.0:1.29.1-SNAPSHOT -google-cloud-core:2.33.0:2.33.1-SNAPSHOT -google-cloud-shared-dependencies:3.25.0:3.25.1-SNAPSHOT +gapic-generator-java:2.37.0:2.37.1-SNAPSHOT +api-common:2.28.0:2.28.1-SNAPSHOT +gax:2.45.0:2.45.1-SNAPSHOT +gax-grpc:2.45.0:2.45.1-SNAPSHOT +gax-httpjson:0.130.0:0.130.1-SNAPSHOT +proto-google-common-protos:2.36.0:2.36.1-SNAPSHOT +grpc-google-common-protos:2.36.0:2.36.1-SNAPSHOT +proto-google-iam-v1:1.31.0:1.31.1-SNAPSHOT +grpc-google-iam-v1:1.31.0:1.31.1-SNAPSHOT +proto-google-iam-v2beta:1.31.0:1.31.1-SNAPSHOT +grpc-google-iam-v2beta:1.31.0:1.31.1-SNAPSHOT +google-iam-policy:1.31.0:1.31.1-SNAPSHOT +proto-google-iam-v2:1.31.0:1.31.1-SNAPSHOT +grpc-google-iam-v2:1.31.0:1.31.1-SNAPSHOT +google-cloud-core:2.35.0:2.35.1-SNAPSHOT +google-cloud-shared-dependencies:3.27.0:3.27.1-SNAPSHOT