Skip to content

Commit ebacb69

Browse files
authored
Merge branch 'main' into group_error_prone
2 parents 31837f7 + cdcc0a2 commit ebacb69

File tree

323 files changed

+4362
-1375
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

323 files changed

+4362
-1375
lines changed

.cloudbuild/graalvm/cloudbuild-test-a.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414

1515
timeout: 7200s # 2 hours
1616
substitutions:
17-
_SHARED_DEPENDENCIES_VERSION: '3.37.0' # {x-version-update:google-cloud-shared-dependencies:current}
17+
_SHARED_DEPENDENCIES_VERSION: '3.39.1-SNAPSHOT' # {x-version-update:google-cloud-shared-dependencies:current}
1818
_JAVA_SHARED_CONFIG_VERSION: '1.11.3'
1919
options:
2020
machineType: 'E2_HIGHCPU_8'

.cloudbuild/graalvm/cloudbuild-test-b.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414

1515
timeout: 7200s # 2 hours
1616
substitutions:
17-
_SHARED_DEPENDENCIES_VERSION: '3.37.0' # {x-version-update:google-cloud-shared-dependencies:current}
17+
_SHARED_DEPENDENCIES_VERSION: '3.39.1-SNAPSHOT' # {x-version-update:google-cloud-shared-dependencies:current}
1818
_JAVA_SHARED_CONFIG_VERSION: '1.11.3'
1919
options:
2020
machineType: 'E2_HIGHCPU_8'

.cloudbuild/graalvm/cloudbuild.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414

1515
timeout: 7200s # 2 hours
1616
substitutions:
17-
_SHARED_DEPENDENCIES_VERSION: '3.37.0' # {x-version-update:google-cloud-shared-dependencies:current}
17+
_SHARED_DEPENDENCIES_VERSION: '3.39.1-SNAPSHOT' # {x-version-update:google-cloud-shared-dependencies:current}
1818
_JAVA_SHARED_CONFIG_VERSION: '1.11.3'
1919
steps:
2020
# GraalVM A build

.cloudbuild/library_generation/cloudbuild-library-generation-push.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
timeout: 7200s # 2 hours
1616
substitutions:
1717
_IMAGE_NAME: "gcr.io/cloud-devrel-public-resources/java-library-generation"
18-
_GAPIC_GENERATOR_JAVA_VERSION: '2.47.0' # {x-version-update:gapic-generator-java:current}
18+
_GAPIC_GENERATOR_JAVA_VERSION: '2.49.1-SNAPSHOT' # {x-version-update:gapic-generator-java:current}
1919
_SHA_IMAGE_ID: "${_IMAGE_NAME}:${COMMIT_SHA}"
2020
_LATEST_IMAGE_ID: "${_IMAGE_NAME}:latest"
2121
_VERSIONED_IMAGE_ID: "${_IMAGE_NAME}:${_GAPIC_GENERATOR_JAVA_VERSION}"

.cloudbuild/library_generation/library_generation.Dockerfile

Lines changed: 22 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -14,27 +14,28 @@
1414

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

1919
WORKDIR /sdk-platform-java
2020
COPY . .
2121
# {x-version-update-start:gapic-generator-java:current}
22-
ENV DOCKER_GAPIC_GENERATOR_VERSION="2.47.0"
22+
ENV DOCKER_GAPIC_GENERATOR_VERSION="2.49.1-SNAPSHOT"
2323
# {x-version-update-end}
2424

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

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

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

3434

3535
ARG OWLBOT_CLI_COMMITTISH=38fe6f89a2339ee75c77739b31b371f601b01bb3
3636
ARG PROTOC_VERSION=25.5
3737
ARG GRPC_VERSION=1.67.1
38+
ARG JAVA_FORMAT_VERSION=1.7
3839
ENV HOME=/home
3940
ENV OS_ARCHITECTURE="linux-x86_64"
4041

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

4647
# copy source code
47-
COPY library_generation /src
48+
COPY hermetic_build/common /src/common
49+
COPY hermetic_build/library_generation /src/library_generation
4850

4951
# install protoc
5052
WORKDIR /protoc
51-
RUN source /src/utils/utilities.sh \
53+
RUN source /src/library_generation/utils/utilities.sh \
5254
&& download_protoc "${PROTOC_VERSION}" "${OS_ARCHITECTURE}"
5355
# we indicate protoc is available in the container via env vars
5456
ENV DOCKER_PROTOC_LOCATION=/protoc
5557
ENV DOCKER_PROTOC_VERSION="${PROTOC_VERSION}"
5658

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

73-
# use python 3.11 (the base image has several python versions; here we define the default one)
75+
# use python 3.12 (the base image has several python versions; here we define the default one)
7476
RUN rm $(which python3)
75-
RUN ln -s $(which python3.11) /usr/local/bin/python
76-
RUN ln -s $(which python3.11) /usr/local/bin/python3
77+
RUN ln -s $(which python3.12) /usr/local/bin/python
78+
RUN ln -s $(which python3.12) /usr/local/bin/python3
7779
RUN python -m pip install --upgrade pip
7880

7981
# install main scripts as a python package
80-
WORKDIR /src
81-
RUN python -m pip install -r requirements.txt
82-
RUN python -m pip install .
82+
WORKDIR /
83+
RUN python -m pip install --require-hashes -r src/common/requirements.txt
84+
RUN python -m pip install src/common
85+
RUN python -m pip install --require-hashes -r src/library_generation/requirements.txt
86+
RUN python -m pip install src/library_generation
8387

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

108+
# download the Java formatter
109+
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 \
110+
"${HOME}"/.library_generation/google-java-format.jar
111+
RUN chmod 755 "${HOME}"/.library_generation/google-java-format.jar
112+
104113
# allow users to access the script folders
105114
RUN chmod -R o+rx /src
106115

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

116125
WORKDIR /workspace
117-
ENTRYPOINT [ "python", "/src/cli/entry_point.py", "generate" ]
126+
ENTRYPOINT [ "python", "/src/library_generation/cli/entry_point.py", "generate" ]

.github/scripts/action.yaml

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,11 +37,33 @@ inputs:
3737
runs:
3838
using: "composite"
3939
steps:
40+
- uses: actions/setup-python@v5
41+
with:
42+
python-version: 3.12
43+
- name: Copy python script
44+
shell: bash
45+
run: |
46+
set -x
47+
# repository root
48+
cd ${{ github.action_path }}/../../
49+
rsync -rv \
50+
--exclude=tests \
51+
hermetic_build "${GITHUB_WORKSPACE}"
4052
- name: Copy shell script
4153
shell: bash
4254
run: |
4355
cd ${{ github.action_path }}
44-
cp hermetic_library_generation.sh $GITHUB_WORKSPACE
56+
cp hermetic_library_generation.sh "${GITHUB_WORKSPACE}"
57+
- name: Install python packages
58+
shell: bash
59+
run: |
60+
cd "${GITHUB_WORKSPACE}"
61+
pip install --require-hashes -r hermetic_build/common/requirements.txt
62+
pip install hermetic_build/common
63+
pip install --require-hashes -r hermetic_build/library_generation/requirements.txt
64+
pip install hermetic_build/library_generation
65+
pip install --require-hashes -r hermetic_build/release_note_generation/requirements.txt
66+
pip install hermetic_build/release_note_generation
4567
- name: Generate changed libraries
4668
shell: bash
4769
run: |

.github/scripts/hermetic_library_generation.sh

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,7 @@ popd
9595
# run hermetic code generation docker image.
9696
docker run \
9797
--rm \
98+
--quiet \
9899
-u "$(id -u):$(id -g)" \
99100
-v "$(pwd):${workspace_name}" \
100101
-v "${m2_folder}":/home/.m2 \
@@ -105,12 +106,16 @@ docker run \
105106
--current-generation-config-path="${workspace_name}/${generation_config}" \
106107
--api-definitions-path="${workspace_name}/googleapis"
107108

109+
python hermetic_build/release_note_generation/cli/generate_release_note.py generate \
110+
--baseline-generation-config-path="${baseline_generation_config}" \
111+
--current-generation-config-path="${generation_config}"
112+
108113
# remove api definitions after generation
109114
rm -rf "${api_def_dir}"
110115

111116
# commit the change to the pull request.
112117
rm -rdf output googleapis "${baseline_generation_config}"
113-
git add --all -- ':!pr_description.txt' ':!hermetic_library_generation.sh'
118+
git add --all -- ':!pr_description.txt' ':!hermetic_library_generation.sh' ':!hermetic_build'
114119
changed_files=$(git diff --cached --name-only)
115120
if [[ "${changed_files}" != "" ]]; then
116121
echo "Commit changes..."

.github/workflows/verify_library_generation.yaml

Lines changed: 32 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ jobs:
2727
git checkout -b "${head_ref}" fork/${head_ref}
2828
changed_directories="$(git diff --name-only "fork/${head_ref}" "origin/${base_ref}")"
2929
fi
30-
if [[ ${changed_directories} =~ "library_generation/" ]]; then
30+
if [[ ${changed_directories} =~ "hermetic_build/" ]]; then
3131
echo "should_run=true" >> $GITHUB_OUTPUT
3232
else
3333
echo "should_run=false" >> $GITHUB_OUTPUT
@@ -46,32 +46,21 @@ jobs:
4646
- uses: actions/checkout@v4
4747
- uses: actions/setup-python@v5
4848
with:
49-
python-version: 3.11
50-
- name: install pyenv
49+
python-version: 3.12
50+
- name: install python modules and dependencies
5151
shell: bash
5252
run: |
5353
set -ex
54-
curl https://pyenv.run | bash
55-
# setup environment
56-
export PYENV_ROOT="$HOME/.pyenv"
57-
export PATH="$PYENV_ROOT/bin:$PATH"
58-
echo "PYENV_ROOT=${PYENV_ROOT}" >> $GITHUB_ENV
59-
echo "PATH=${PATH}" >> $GITHUB_ENV
60-
61-
set +ex
62-
- name: install python dependencies
63-
shell: bash
64-
run: |
65-
set -ex
66-
pushd library_generation
67-
pip install -r requirements.txt
68-
pip install .
69-
popd
54+
pip install --upgrade pip
55+
pip install --require-hashes -r hermetic_build/common/requirements.txt
56+
pip install hermetic_build/common
57+
pip install --require-hashes -r hermetic_build/library_generation/requirements.txt
58+
pip install hermetic_build/library_generation
7059
- name: Run integration tests
7160
shell: bash
7261
run: |
7362
set -x
74-
python -m unittest library_generation/test/integration_tests.py
63+
python -m unittest hermetic_build/library_generation/tests/integration_tests.py
7564
library-generation-unit-tests:
7665
runs-on: ubuntu-22.04
7766
needs: should-run-library-generation-tests
@@ -80,23 +69,26 @@ jobs:
8069
- uses: actions/checkout@v4
8170
- uses: actions/setup-python@v5
8271
with:
83-
python-version: 3.11
84-
- name: install python dependencies
72+
python-version: 3.12
73+
- name: install python modules and dependencies
8574
shell: bash
8675
run: |
8776
set -ex
88-
pushd library_generation
89-
pip install -r requirements.txt
90-
pip install .
91-
popd
77+
pip install --upgrade pip
78+
pip install --require-hashes -r hermetic_build/common/requirements.txt
79+
pip install hermetic_build/common
80+
pip install --require-hashes -r hermetic_build/library_generation/requirements.txt
81+
pip install hermetic_build/library_generation
82+
pip install --require-hashes -r hermetic_build/release_note_generation/requirements.txt
83+
pip install hermetic_build/release_note_generation
9284
- name: Run shell unit tests
9385
run: |
9486
set -x
95-
library_generation/test/generate_library_unit_tests.sh
87+
hermetic_build/library_generation/tests/generate_library_unit_tests.sh
9688
- name: Run python unit tests
9789
run: |
9890
set -x
99-
python -m unittest discover -s library_generation/test/ -p "*unit_tests.py"
91+
python -m unittest discover -s hermetic_build -p "*unit_tests.py"
10092
library-generation-lint-shell:
10193
runs-on: ubuntu-22.04
10294
needs: should-run-library-generation-tests
@@ -106,7 +98,7 @@ jobs:
10698
- name: Run ShellCheck
10799
uses: ludeeus/[email protected]
108100
with:
109-
scandir: 'library_generation'
101+
scandir: 'hermetic_build'
110102
format: tty
111103
severity: error
112104
library-generation-lint-python:
@@ -115,16 +107,23 @@ jobs:
115107
if: needs.should-run-library-generation-tests.outputs.should_run == 'true'
116108
steps:
117109
- uses: actions/checkout@v4
110+
- uses: actions/setup-python@v5
111+
with:
112+
python-version: 3.12
118113
- name: install python dependencies
119114
shell: bash
120115
run: |
121116
set -ex
122-
pushd library_generation
123-
pip install -r requirements.txt
124-
popd
117+
pip install --upgrade pip
118+
pip install --require-hashes -r hermetic_build/common/requirements.txt
119+
pip install hermetic_build/common
120+
pip install --require-hashes -r hermetic_build/library_generation/requirements.txt
121+
pip install hermetic_build/library_generation
122+
pip install --require-hashes -r hermetic_build/release_note_generation/requirements.txt
123+
pip install hermetic_build/release_note_generation
125124
- name: Lint
126125
shell: bash
127126
run: |
128127
# exclude generated golden files
129128
# exclude owlbot until further refaction
130-
black --check library_generation --exclude "(library_generation/test/resources/goldens)"
129+
black --check hermetic_build --exclude "(library_generation/tests/resources/goldens)"

.release-please-manifest.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
{
2-
".": "2.47.0"
2+
".": "2.49.0"
33
}

CHANGELOG.md

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,43 @@
11
# Changelog
22

3+
## [2.49.0](https://github.com/googleapis/sdk-platform-java/compare/v2.48.0...v2.49.0) (2024-10-25)
4+
5+
6+
### Features
7+
8+
* 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))
9+
10+
11+
### Bug Fixes
12+
13+
* 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))
14+
15+
16+
### Dependencies
17+
18+
* 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))
19+
20+
## [2.48.0](https://github.com/googleapis/sdk-platform-java/compare/v2.47.0...v2.48.0) (2024-10-22)
21+
22+
23+
### Features
24+
25+
* **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))
26+
* selectively generate libraries ([#3290](https://github.com/googleapis/sdk-platform-java/issues/3290)) ([dfe1a50](https://github.com/googleapis/sdk-platform-java/commit/dfe1a50ec857cc2998bcbfbc2d8af6801f0ae260))
27+
28+
29+
### Bug Fixes
30+
31+
* 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))
32+
33+
34+
### Dependencies
35+
36+
* 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))
37+
* 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))
38+
* update google api dependencies ([#3282](https://github.com/googleapis/sdk-platform-java/issues/3282)) ([a9eac85](https://github.com/googleapis/sdk-platform-java/commit/a9eac851c57989ab45c4e1b28171ea043506bcd9))
39+
* 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))
40+
341
## [2.47.0](https://github.com/googleapis/sdk-platform-java/compare/v2.46.1...v2.47.0) (2024-10-04)
442

543

0 commit comments

Comments
 (0)