Skip to content

Commit

Permalink
Merge branch 'main' into group_error_prone
Browse files Browse the repository at this point in the history
  • Loading branch information
zhumin8 authored Oct 29, 2024
2 parents 31837f7 + cdcc0a2 commit ebacb69
Show file tree
Hide file tree
Showing 323 changed files with 4,362 additions and 1,375 deletions.
2 changes: 1 addition & 1 deletion .cloudbuild/graalvm/cloudbuild-test-a.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@

timeout: 7200s # 2 hours
substitutions:
_SHARED_DEPENDENCIES_VERSION: '3.37.0' # {x-version-update:google-cloud-shared-dependencies:current}
_SHARED_DEPENDENCIES_VERSION: '3.39.1-SNAPSHOT' # {x-version-update:google-cloud-shared-dependencies:current}
_JAVA_SHARED_CONFIG_VERSION: '1.11.3'
options:
machineType: 'E2_HIGHCPU_8'
Expand Down
2 changes: 1 addition & 1 deletion .cloudbuild/graalvm/cloudbuild-test-b.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@

timeout: 7200s # 2 hours
substitutions:
_SHARED_DEPENDENCIES_VERSION: '3.37.0' # {x-version-update:google-cloud-shared-dependencies:current}
_SHARED_DEPENDENCIES_VERSION: '3.39.1-SNAPSHOT' # {x-version-update:google-cloud-shared-dependencies:current}
_JAVA_SHARED_CONFIG_VERSION: '1.11.3'
options:
machineType: 'E2_HIGHCPU_8'
Expand Down
2 changes: 1 addition & 1 deletion .cloudbuild/graalvm/cloudbuild.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@

timeout: 7200s # 2 hours
substitutions:
_SHARED_DEPENDENCIES_VERSION: '3.37.0' # {x-version-update:google-cloud-shared-dependencies:current}
_SHARED_DEPENDENCIES_VERSION: '3.39.1-SNAPSHOT' # {x-version-update:google-cloud-shared-dependencies:current}
_JAVA_SHARED_CONFIG_VERSION: '1.11.3'
steps:
# GraalVM A build
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
timeout: 7200s # 2 hours
substitutions:
_IMAGE_NAME: "gcr.io/cloud-devrel-public-resources/java-library-generation"
_GAPIC_GENERATOR_JAVA_VERSION: '2.47.0' # {x-version-update:gapic-generator-java:current}
_GAPIC_GENERATOR_JAVA_VERSION: '2.49.1-SNAPSHOT' # {x-version-update:gapic-generator-java:current}
_SHA_IMAGE_ID: "${_IMAGE_NAME}:${COMMIT_SHA}"
_LATEST_IMAGE_ID: "${_IMAGE_NAME}:latest"
_VERSIONED_IMAGE_ID: "${_IMAGE_NAME}:${_GAPIC_GENERATOR_JAVA_VERSION}"
Expand Down
35 changes: 22 additions & 13 deletions .cloudbuild/library_generation/library_generation.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -14,27 +14,28 @@

# install gapic-generator-java in a separate layer so we don't overload the image
# with the transferred source code and jars
FROM gcr.io/cloud-devrel-public-resources/java21 AS ggj-build
FROM gcr.io/cloud-devrel-public-resources/java21@sha256:2ceff5eeea72260258df56d42e44ed413e52ee421c1b77393c5f2c9c4d7c41da AS ggj-build

WORKDIR /sdk-platform-java
COPY . .
# {x-version-update-start:gapic-generator-java:current}
ENV DOCKER_GAPIC_GENERATOR_VERSION="2.47.0"
ENV DOCKER_GAPIC_GENERATOR_VERSION="2.49.1-SNAPSHOT"
# {x-version-update-end}

RUN mvn install -B -ntp -DskipTests -Dclirr.skip -Dcheckstyle.skip
RUN cp "/root/.m2/repository/com/google/api/gapic-generator-java/${DOCKER_GAPIC_GENERATOR_VERSION}/gapic-generator-java-${DOCKER_GAPIC_GENERATOR_VERSION}.jar" \
"./gapic-generator-java.jar"

# build from the root of this repo:
FROM gcr.io/cloud-devrel-public-resources/python
FROM gcr.io/cloud-devrel-public-resources/python@sha256:9c5ea427632f195ad164054831968389d86fdde4a15abca651f3fcb2a71268cb

SHELL [ "/bin/bash", "-c" ]


ARG OWLBOT_CLI_COMMITTISH=38fe6f89a2339ee75c77739b31b371f601b01bb3
ARG PROTOC_VERSION=25.5
ARG GRPC_VERSION=1.67.1
ARG JAVA_FORMAT_VERSION=1.7
ENV HOME=/home
ENV OS_ARCHITECTURE="linux-x86_64"

Expand All @@ -44,19 +45,20 @@ RUN apt-get update && apt-get install -y \
&& apt-get clean

# copy source code
COPY library_generation /src
COPY hermetic_build/common /src/common
COPY hermetic_build/library_generation /src/library_generation

# install protoc
WORKDIR /protoc
RUN source /src/utils/utilities.sh \
RUN source /src/library_generation/utils/utilities.sh \
&& download_protoc "${PROTOC_VERSION}" "${OS_ARCHITECTURE}"
# we indicate protoc is available in the container via env vars
ENV DOCKER_PROTOC_LOCATION=/protoc
ENV DOCKER_PROTOC_VERSION="${PROTOC_VERSION}"

# install grpc
WORKDIR /grpc
RUN source /src/utils/utilities.sh \
RUN source /src/library_generation/utils/utilities.sh \
&& download_grpc_plugin "${GRPC_VERSION}" "${OS_ARCHITECTURE}"
# similar to protoc, we indicate grpc is available in the container via env vars
ENV DOCKER_GRPC_LOCATION="/grpc/protoc-gen-grpc-java-${GRPC_VERSION}-${OS_ARCHITECTURE}.exe"
Expand All @@ -70,16 +72,18 @@ ENV DOCKER_GRPC_VERSION="${GRPC_VERSION}"
COPY --from=ggj-build "/sdk-platform-java/gapic-generator-java.jar" "${HOME}/.library_generation/gapic-generator-java.jar"
RUN chmod 755 "${HOME}/.library_generation/gapic-generator-java.jar"

# use python 3.11 (the base image has several python versions; here we define the default one)
# use python 3.12 (the base image has several python versions; here we define the default one)
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 ln -s $(which python3.12) /usr/local/bin/python
RUN ln -s $(which python3.12) /usr/local/bin/python3
RUN python -m pip install --upgrade pip

# install main scripts as a python package
WORKDIR /src
RUN python -m pip install -r requirements.txt
RUN python -m pip install .
WORKDIR /
RUN python -m pip install --require-hashes -r src/common/requirements.txt
RUN python -m pip install src/common
RUN python -m pip install --require-hashes -r src/library_generation/requirements.txt
RUN python -m pip install src/library_generation

# Install nvm with node and npm
ENV NODE_VERSION 20.12.0
Expand All @@ -101,6 +105,11 @@ RUN owl-bot copy-code --version
RUN chmod -R o+rx ${NODE_PATH}
RUN ln -sf ${NODE_PATH}/* /usr/local/bin

# download the Java formatter
ADD https://maven-central.storage-download.googleapis.com/maven2/com/google/googlejavaformat/google-java-format/${JAVA_FORMAT_VERSION}/google-java-format-${JAVA_FORMAT_VERSION}-all-deps.jar \
"${HOME}"/.library_generation/google-java-format.jar
RUN chmod 755 "${HOME}"/.library_generation/google-java-format.jar

# allow users to access the script folders
RUN chmod -R o+rx /src

Expand All @@ -114,4 +123,4 @@ RUN chmod -R a+rw /home
RUN chmod -R a+rx /home/.nvm

WORKDIR /workspace
ENTRYPOINT [ "python", "/src/cli/entry_point.py", "generate" ]
ENTRYPOINT [ "python", "/src/library_generation/cli/entry_point.py", "generate" ]
24 changes: 23 additions & 1 deletion .github/scripts/action.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -37,11 +37,33 @@ inputs:
runs:
using: "composite"
steps:
- uses: actions/setup-python@v5
with:
python-version: 3.12
- name: Copy python script
shell: bash
run: |
set -x
# repository root
cd ${{ github.action_path }}/../../
rsync -rv \
--exclude=tests \
hermetic_build "${GITHUB_WORKSPACE}"
- name: Copy shell script
shell: bash
run: |
cd ${{ github.action_path }}
cp hermetic_library_generation.sh $GITHUB_WORKSPACE
cp hermetic_library_generation.sh "${GITHUB_WORKSPACE}"
- name: Install python packages
shell: bash
run: |
cd "${GITHUB_WORKSPACE}"
pip install --require-hashes -r hermetic_build/common/requirements.txt
pip install hermetic_build/common
pip install --require-hashes -r hermetic_build/library_generation/requirements.txt
pip install hermetic_build/library_generation
pip install --require-hashes -r hermetic_build/release_note_generation/requirements.txt
pip install hermetic_build/release_note_generation
- name: Generate changed libraries
shell: bash
run: |
Expand Down
7 changes: 6 additions & 1 deletion .github/scripts/hermetic_library_generation.sh
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,7 @@ popd
# run hermetic code generation docker image.
docker run \
--rm \
--quiet \
-u "$(id -u):$(id -g)" \
-v "$(pwd):${workspace_name}" \
-v "${m2_folder}":/home/.m2 \
Expand All @@ -105,12 +106,16 @@ docker run \
--current-generation-config-path="${workspace_name}/${generation_config}" \
--api-definitions-path="${workspace_name}/googleapis"

python hermetic_build/release_note_generation/cli/generate_release_note.py generate \
--baseline-generation-config-path="${baseline_generation_config}" \
--current-generation-config-path="${generation_config}"

# remove api definitions after generation
rm -rf "${api_def_dir}"

# commit the change to the pull request.
rm -rdf output googleapis "${baseline_generation_config}"
git add --all -- ':!pr_description.txt' ':!hermetic_library_generation.sh'
git add --all -- ':!pr_description.txt' ':!hermetic_library_generation.sh' ':!hermetic_build'
changed_files=$(git diff --cached --name-only)
if [[ "${changed_files}" != "" ]]; then
echo "Commit changes..."
Expand Down
65 changes: 32 additions & 33 deletions .github/workflows/verify_library_generation.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ jobs:
git checkout -b "${head_ref}" fork/${head_ref}
changed_directories="$(git diff --name-only "fork/${head_ref}" "origin/${base_ref}")"
fi
if [[ ${changed_directories} =~ "library_generation/" ]]; then
if [[ ${changed_directories} =~ "hermetic_build/" ]]; then
echo "should_run=true" >> $GITHUB_OUTPUT
else
echo "should_run=false" >> $GITHUB_OUTPUT
Expand All @@ -46,32 +46,21 @@ jobs:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: 3.11
- name: install pyenv
python-version: 3.12
- name: install python modules and dependencies
shell: bash
run: |
set -ex
curl https://pyenv.run | bash
# setup environment
export PYENV_ROOT="$HOME/.pyenv"
export PATH="$PYENV_ROOT/bin:$PATH"
echo "PYENV_ROOT=${PYENV_ROOT}" >> $GITHUB_ENV
echo "PATH=${PATH}" >> $GITHUB_ENV
set +ex
- name: install python dependencies
shell: bash
run: |
set -ex
pushd library_generation
pip install -r requirements.txt
pip install .
popd
pip install --upgrade pip
pip install --require-hashes -r hermetic_build/common/requirements.txt
pip install hermetic_build/common
pip install --require-hashes -r hermetic_build/library_generation/requirements.txt
pip install hermetic_build/library_generation
- name: Run integration tests
shell: bash
run: |
set -x
python -m unittest library_generation/test/integration_tests.py
python -m unittest hermetic_build/library_generation/tests/integration_tests.py
library-generation-unit-tests:
runs-on: ubuntu-22.04
needs: should-run-library-generation-tests
Expand All @@ -80,23 +69,26 @@ jobs:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: 3.11
- name: install python dependencies
python-version: 3.12
- name: install python modules and dependencies
shell: bash
run: |
set -ex
pushd library_generation
pip install -r requirements.txt
pip install .
popd
pip install --upgrade pip
pip install --require-hashes -r hermetic_build/common/requirements.txt
pip install hermetic_build/common
pip install --require-hashes -r hermetic_build/library_generation/requirements.txt
pip install hermetic_build/library_generation
pip install --require-hashes -r hermetic_build/release_note_generation/requirements.txt
pip install hermetic_build/release_note_generation
- name: Run shell unit tests
run: |
set -x
library_generation/test/generate_library_unit_tests.sh
hermetic_build/library_generation/tests/generate_library_unit_tests.sh
- name: Run python unit tests
run: |
set -x
python -m unittest discover -s library_generation/test/ -p "*unit_tests.py"
python -m unittest discover -s hermetic_build -p "*unit_tests.py"
library-generation-lint-shell:
runs-on: ubuntu-22.04
needs: should-run-library-generation-tests
Expand All @@ -106,7 +98,7 @@ jobs:
- name: Run ShellCheck
uses: ludeeus/[email protected]
with:
scandir: 'library_generation'
scandir: 'hermetic_build'
format: tty
severity: error
library-generation-lint-python:
Expand All @@ -115,16 +107,23 @@ jobs:
if: needs.should-run-library-generation-tests.outputs.should_run == 'true'
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: 3.12
- name: install python dependencies
shell: bash
run: |
set -ex
pushd library_generation
pip install -r requirements.txt
popd
pip install --upgrade pip
pip install --require-hashes -r hermetic_build/common/requirements.txt
pip install hermetic_build/common
pip install --require-hashes -r hermetic_build/library_generation/requirements.txt
pip install hermetic_build/library_generation
pip install --require-hashes -r hermetic_build/release_note_generation/requirements.txt
pip install hermetic_build/release_note_generation
- name: Lint
shell: bash
run: |
# exclude generated golden files
# exclude owlbot until further refaction
black --check library_generation --exclude "(library_generation/test/resources/goldens)"
black --check hermetic_build --exclude "(library_generation/tests/resources/goldens)"
2 changes: 1 addition & 1 deletion .release-please-manifest.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
{
".": "2.47.0"
".": "2.49.0"
}
38 changes: 38 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,43 @@
# Changelog

## [2.49.0](https://github.com/googleapis/sdk-platform-java/compare/v2.48.0...v2.49.0) (2024-10-25)


### Features

* Move release note generation to a sub module ([#3299](https://github.com/googleapis/sdk-platform-java/issues/3299)) ([7d6d66a](https://github.com/googleapis/sdk-platform-java/commit/7d6d66a161db5edc538aec065405954acf4434c5))


### Bug Fixes

* add additional potential exceptions when retrieving protobuf manifest file to get version ([#3315](https://github.com/googleapis/sdk-platform-java/issues/3315)) ([ef9e518](https://github.com/googleapis/sdk-platform-java/commit/ef9e5189740ea5be46ad0d51c2ff554cd99ac162))


### Dependencies

* update dependency com.google.errorprone:error_prone_annotations to v2.35.1 ([#3316](https://github.com/googleapis/sdk-platform-java/issues/3316)) ([d7c290f](https://github.com/googleapis/sdk-platform-java/commit/d7c290f3e49c8ec7c480229e2c8ae38fcdcd99f6))

## [2.48.0](https://github.com/googleapis/sdk-platform-java/compare/v2.47.0...v2.48.0) (2024-10-22)


### Features

* **gax:** add protobuf version tracking to headers ([#3199](https://github.com/googleapis/sdk-platform-java/issues/3199)) ([40c19b1](https://github.com/googleapis/sdk-platform-java/commit/40c19b1aad71da176aeafbba32a0a4b51b5a4366))
* selectively generate libraries ([#3290](https://github.com/googleapis/sdk-platform-java/issues/3290)) ([dfe1a50](https://github.com/googleapis/sdk-platform-java/commit/dfe1a50ec857cc2998bcbfbc2d8af6801f0ae260))


### Bug Fixes

* generator setting incorrect name/class for sample due to region tag (2nd attempt) ([#3293](https://github.com/googleapis/sdk-platform-java/issues/3293)) ([771bd0e](https://github.com/googleapis/sdk-platform-java/commit/771bd0e9cb306e430dc15e79a189648830101865))


### Dependencies

* update dependency com.google.errorprone:error_prone_annotations to v2.34.0 ([#3303](https://github.com/googleapis/sdk-platform-java/issues/3303)) ([5b01274](https://github.com/googleapis/sdk-platform-java/commit/5b0127480ac1358b183d971e432939779f1238ad))
* update dependency com.google.errorprone:error_prone_annotations to v2.34.0 ([#3304](https://github.com/googleapis/sdk-platform-java/issues/3304)) ([5bd6c9c](https://github.com/googleapis/sdk-platform-java/commit/5bd6c9ceaab11f96c6e50ca8ce9c66c1c1369d5c))
* update google api dependencies ([#3282](https://github.com/googleapis/sdk-platform-java/issues/3282)) ([a9eac85](https://github.com/googleapis/sdk-platform-java/commit/a9eac851c57989ab45c4e1b28171ea043506bcd9))
* update google auth library dependencies to v1.29.0 ([#3302](https://github.com/googleapis/sdk-platform-java/issues/3302)) ([e64eda2](https://github.com/googleapis/sdk-platform-java/commit/e64eda231bc3a1a32d56eb5269ae8d3c53ed26de))

## [2.47.0](https://github.com/googleapis/sdk-platform-java/compare/v2.46.1...v2.47.0) (2024-10-04)


Expand Down
2 changes: 1 addition & 1 deletion WORKSPACE
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ load("@rules_jvm_external//:defs.bzl", "maven_install")
load("@io_grpc_grpc_java//:repositories.bzl", "IO_GRPC_GRPC_JAVA_ARTIFACTS")
load("@io_grpc_grpc_java//:repositories.bzl", "IO_GRPC_GRPC_JAVA_OVERRIDE_TARGETS")

_gapic_generator_java_version = "2.47.0" # {x-version-update:gapic-generator-java:current}
_gapic_generator_java_version = "2.49.1-SNAPSHOT" # {x-version-update:gapic-generator-java:current}

maven_install(
artifacts = [
Expand Down
4 changes: 2 additions & 2 deletions api-common-java/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,14 @@
<groupId>com.google.api</groupId>
<artifactId>api-common</artifactId>
<packaging>jar</packaging>
<version>2.38.0</version><!-- {x-version-update:api-common:current} -->
<version>2.40.1-SNAPSHOT</version><!-- {x-version-update:api-common:current} -->
<name>API Common</name>
<description>Common utilities for Google APIs in Java</description>

<parent>
<groupId>com.google.api</groupId>
<artifactId>gapic-generator-java-pom-parent</artifactId>
<version>2.47.0</version><!-- {x-version-update:gapic-generator-java:current} -->
<version>2.49.1-SNAPSHOT</version><!-- {x-version-update:gapic-generator-java:current} -->
<relativePath>../gapic-generator-java-pom-parent</relativePath>
</parent>

Expand Down
Loading

0 comments on commit ebacb69

Please sign in to comment.