Skip to content

Commit 0b67acb

Browse files
committed
Merge branch 'main' into feat/analyze-pom
2 parents 44bc115 + 7ee0089 commit 0b67acb

18 files changed

+185
-317
lines changed

.cloudbuild/library_generation/library_generation.Dockerfile

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -50,11 +50,9 @@ RUN chmod a+x compile-x86_64-alpine-linux.sh
5050
RUN sh compile-x86_64-alpine-linux.sh
5151

5252
# python:3.12.7-alpine3.20
53-
FROM docker.io/library/python@sha256:38e179a0f0436c97ecc76bcd378d7293ab3ee79e4b8c440fdc7113670cb6e204 as final
53+
FROM docker.io/library/python@sha256:5049c050bdc68575a10bcb1885baa0689b6c15152d8a56a7e399fb49f783bf98 as final
5454

55-
56-
57-
ARG OWLBOT_CLI_COMMITTISH=38fe6f89a2339ee75c77739b31b371f601b01bb3
55+
ARG OWLBOT_CLI_COMMITTISH=ab222d9a20bb27586433caedc70f049b7853db7e
5856
ARG PROTOC_VERSION=25.5
5957
ARG GRPC_VERSION=1.68.1
6058
ARG JAVA_FORMAT_VERSION=1.7
@@ -90,24 +88,23 @@ WORKDIR /protoc
9088
RUN source /src/library_generation/utils/utilities.sh \
9189
&& download_protoc "${PROTOC_VERSION}" "${OS_ARCHITECTURE}"
9290
# we indicate protoc is available in the container via env vars
93-
ENV DOCKER_PROTOC_LOCATION=/protoc
91+
ENV DOCKER_PROTOC_LOCATION=/protoc/bin
9492
ENV DOCKER_PROTOC_VERSION="${PROTOC_VERSION}"
9593

9694
# install grpc
9795
WORKDIR /grpc
9896
RUN source /src/library_generation/utils/utilities.sh \
9997
&& download_grpc_plugin "${GRPC_VERSION}" "${OS_ARCHITECTURE}"
10098
# similar to protoc, we indicate grpc is available in the container via env vars
101-
ENV DOCKER_GRPC_LOCATION="/grpc/protoc-gen-grpc-java-${GRPC_VERSION}-${OS_ARCHITECTURE}.exe"
102-
ENV DOCKER_GRPC_VERSION="${GRPC_VERSION}"
103-
99+
ENV DOCKER_GRPC_LOCATION="/grpc/protoc-gen-grpc-java.exe"
104100

105101
# Here we transfer gapic-generator-java from the previous stage.
106102
# Note that the destination is a well-known location that will be assumed at runtime
107103
# We hard-code the location string to avoid making it configurable (via ARG) as
108104
# well as to avoid it making it overridable at runtime (via ENV).
109105
COPY --from=ggj-build "/sdk-platform-java/gapic-generator-java.jar" "${HOME}/.library_generation/gapic-generator-java.jar"
110106
RUN chmod 755 "${HOME}/.library_generation/gapic-generator-java.jar"
107+
ENV GAPIC_GENERATOR_LOCATION="${HOME}/.library_generation/gapic-generator-java.jar"
111108

112109
RUN python -m pip install --upgrade pip
113110

@@ -126,11 +123,13 @@ RUN git checkout "${OWLBOT_CLI_COMMITTISH}"
126123
RUN npm i && npm run compile && npm link
127124
RUN owl-bot copy-code --version
128125
RUN chmod o+rx $(which owl-bot)
126+
RUN apk del -r npm && apk cache clean
129127

130128
# download the Java formatter
131129
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 \
132130
"${HOME}"/.library_generation/google-java-format.jar
133131
RUN chmod 755 "${HOME}"/.library_generation/google-java-format.jar
132+
ENV JAVA_FORMATTER_LOCATION="${HOME}/.library_generation/google-java-format.jar"
134133

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

.github/workflows/hermetic_library_generation.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ jobs:
5151
run: |
5252
GENERATOR_VERSION=$(mvn help:evaluate -Dexpression=project.version -q -DforceStdout -pl gapic-generator-java)
5353
echo "GENERATOR_VERSION=${GENERATOR_VERSION}" >> "$GITHUB_ENV"
54-
docker build \
54+
DOCKER_BUILDKIT=1 docker build \
5555
-f .cloudbuild/library_generation/library_generation.Dockerfile \
5656
-t gcr.io/cloud-devrel-public-resources/java-library-generation:"${GENERATOR_VERSION}" \
5757
.

.github/workflows/verify_library_generation.yaml

Lines changed: 1 addition & 1 deletion
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} =~ "hermetic_build/" ]]; then
30+
if [[ ${changed_directories} =~ "hermetic_build/" ]] || [[ ${changed_directories} =~ ".cloudbuild/library_generation/" ]]; then
3131
echo "should_run=true" >> $GITHUB_OUTPUT
3232
else
3333
echo "should_run=false" >> $GITHUB_OUTPUT

gax-java/dependencies.properties

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,10 @@ version.io_grpc=1.68.1
3535
# It should be constructed the following way:
3636
# 1) Take full artifact id (including the group and classifier (if any) portions) and remove version portion.
3737
# 2) Replace all characters which are neither alphabetic nor digits with the underscore ('_') character
38+
# {x-version-update-start:proto-google-common-protos:current}
3839
maven.com_google_api_grpc_proto_google_common_protos=com.google.api.grpc:proto-google-common-protos:2.46.0
3940
maven.com_google_api_grpc_grpc_google_common_protos=com.google.api.grpc:grpc-google-common-protos:2.46.0
41+
# {x-version-update-end}
4042
maven.com_google_auth_google_auth_library_oauth2_http=com.google.auth:google-auth-library-oauth2-http:1.30.0
4143
maven.com_google_auth_google_auth_library_credentials=com.google.auth:google-auth-library-credentials:1.30.0
4244
maven.io_opentelemetry_opentelemetry_api=io.opentelemetry:opentelemetry-api:1.42.1
@@ -67,10 +69,14 @@ maven.com_google_errorprone_error_prone_annotations=com.google.errorprone:error_
6769
maven.com_google_j2objc_j2objc_annotations=com.google.j2objc:j2objc-annotations:2.8
6870
maven.com_google_auto_value_auto_value=com.google.auto.value:auto-value:1.11.0
6971
maven.com_google_auto_value_auto_value_annotations=com.google.auto.value:auto-value-annotations:1.11.0
72+
# {x-version-update-start:api-common:current}
7073
maven.com_google_api_api_common=com.google.api:api-common:2.38.0
74+
# {x-version-update-end}
7175
maven.org_threeten_threetenbp=org.threeten:threetenbp:1.7.0
76+
# {x-version-update-start:proto-google-iam-v1:current}
7277
maven.com_google_api_grpc_grpc_google_iam_v1=com.google.api.grpc:grpc-google-iam-v1:1.41.0
7378
maven.com_google_api_grpc_proto_google_iam_v1=com.google.api.grpc:proto-google-iam-v1:1.41.0
79+
# {x-version-update-end}
7480
maven.com_google_http_client_google_http_client=com.google.http-client:google-http-client:1.45.0
7581
maven.com_google_http_client_google_http_client_gson=com.google.http-client:google-http-client-gson:1.45.0
7682
maven.org_codehaus_mojo_animal_sniffer_annotations=org.codehaus.mojo:animal-sniffer-annotations:1.24

hermetic_build/DEVELOPMENT.md

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,21 @@ as per [POSIX env var definition](https://pubs.opengroup.org/onlinepubs/96999197
8282
mv /path/to/jar "${HOME}/.library_generation/gapic-generator-java.jar"
8383
```
8484

85+
#### Put the protobuf compiler in its well-known location
86+
1. Download protobuf compiler from [GitHub releases](https://github.com/protocolbuffers/protobuf/releases).
87+
2. Move the folder into its well-know location.
88+
89+
```shell
90+
unzip /path/to/zipfile -d "${HOME}/.library_generation/"
91+
```
92+
#### Put the GRPC plugin in its well-known location
93+
1. Download GRPC plugin from [Maven Central](https://central.sonatype.com/artifact/io.grpc/protoc-gen-grpc-java/versions).
94+
2. Move the folder into its well-know location.
95+
96+
```shell
97+
mv /path/to/protoc-gen-grpc-java.exe "${HOME}/.library_generation/protoc-gen-grpc-java.exe"
98+
```
99+
85100
#### Put the java formatter jar in its well-known location
86101

87102
1. Download google-java-format-{version}-all-deps.jar from [Maven Central](https://central.sonatype.com/artifact/com.google.googlejavaformat/google-java-format)
@@ -197,11 +212,6 @@ python hermetic_build/library_generation/cli/entry_point.py generate \
197212
--repository-path=/workspace \
198213
--api-definitions-path=/workspace/apis
199214
```
200-
Note that if you specify the generator version using environment variable,
201-
`-e GENERATOR_VERSION="${LOCAL_GENERATOR_VERSION}"` in the above example,
202-
you should not set `gapic_generator_version` and `protoc_version` in the
203-
generation configuration because values in the generation configuration will
204-
take precedence.
205215

206216
# Debug the library generation container
207217
If you are working on changing the way the containers are created, you may want

hermetic_build/README.md

Lines changed: 5 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,6 @@ Running the docker image built from `hermetic_build/library_generation`
77
directory, you can generate a repository containing GAPIC client libraries (a
88
monorepo, for example, google-cloud-java) from a configuration file.
99

10-
Instead of running the docker image, if you prefer running the underlying python
11-
scripts directly, please refer to the [development guide](DEVELOPMENT.md#run-the-script)
12-
for additional instructions.
13-
1410
## Environment
1511

1612
- OS: Linux
@@ -124,13 +120,11 @@ The repository level parameters define the version of API definition (proto)
124120
and tools.
125121
They are shared by library level parameters.
126122

127-
| Name | Required | Notes |
128-
|:------------------------|:--------:|:---------------------------------------------|
129-
| gapic_generator_version | No | set through env variable if not specified |
130-
| protoc_version | No | inferred from the generator if not specified |
131-
| grpc_version | No | inferred from the generator if not specified |
132-
| googleapis_commitish | Yes | |
133-
| libraries_bom_version | No | empty string if not specified |
123+
| Name | Required | Notes |
124+
|:------------------------|:--------:|:------------------------------------------|
125+
| gapic_generator_version | No | set through env variable if not specified |
126+
| googleapis_commitish | Yes | |
127+
| libraries_bom_version | No | empty string if not specified |
134128

135129
### Library level parameters
136130

@@ -178,7 +172,6 @@ The GAPIC level parameters define how to generate a GAPIC library.
178172

179173
```yaml
180174
gapic_generator_version: 2.34.0
181-
protoc_version: 25.2
182175
googleapis_commitish: 1a45bf7393b52407188c82e63101db7dc9c72026
183176
libraries_bom_version: 26.37.0
184177
libraries:

hermetic_build/common/model/generation_config.py

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,6 @@ def __init__(
3939
libraries: list[LibraryConfig],
4040
gapic_generator_version: Optional[str] = None,
4141
libraries_bom_version: Optional[str] = None,
42-
grpc_version: Optional[str] = None,
43-
protoc_version: Optional[str] = None,
4442
):
4543
self.googleapis_commitish = googleapis_commitish
4644
self.libraries_bom_version = (
@@ -50,8 +48,6 @@ def __init__(
5048
gapic_generator_version
5149
)
5250
self.libraries = libraries
53-
self.grpc_version = grpc_version
54-
self.protoc_version = protoc_version
5551
# explicit set to None so that we can compute the
5652
# value in getter.
5753
self.__contains_common_protos = None
@@ -172,8 +168,6 @@ def from_yaml(path_to_yaml: str) -> GenerationConfig:
172168
config, "googleapis_commitish", REPO_LEVEL_PARAMETER
173169
),
174170
gapic_generator_version=__optional(config, GAPIC_GENERATOR_VERSION, None),
175-
grpc_version=__optional(config, "grpc_version", None),
176-
protoc_version=__optional(config, "protoc_version", None),
177171
libraries_bom_version=__optional(config, LIBRARIES_BOM_VERSION, None),
178172
libraries=parsed_libraries,
179173
)

hermetic_build/common/tests/model/config_change_unit_tests.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -309,8 +309,6 @@ def __get_a_gen_config(
309309
return GenerationConfig(
310310
gapic_generator_version="",
311311
googleapis_commitish=googleapis_commitish,
312-
grpc_version="",
313-
protoc_version="",
314312
libraries=libraries,
315313
)
316314

hermetic_build/common/tests/model/generation_config_unit_tests.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,6 @@ def test_generation_config_set_generator_version_from_env(self):
7474
def test_from_yaml_succeeds(self):
7575
config = from_yaml(f"{test_config_dir}/generation_config.yaml")
7676
self.assertEqual("2.34.0", config.gapic_generator_version)
77-
self.assertEqual(25.2, config.protoc_version)
7877
self.assertEqual(
7978
"1a45bf7393b52407188c82e63101db7dc9c72026", config.googleapis_commitish
8079
)

hermetic_build/common/tests/resources/test-config/generation_config.yaml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
gapic_generator_version: 2.34.0
2-
protoc_version: 25.2
32
googleapis_commitish: 1a45bf7393b52407188c82e63101db7dc9c72026
43
libraries_bom_version: 26.37.0
54
libraries:

0 commit comments

Comments
 (0)