Skip to content

Commit 4eed4d6

Browse files
diegomarquezprenovate-botcloud-java-bot
authored
chore(format): update google-java-format to 1.25.2 via java-shared-config update (#3726)
[Context Doc](https://docs.google.com/document/d/1Fqb4lXZ0FEpkJoSUvUp7Ow-z0fdcLyLE30lDDsGaRY0/edit?resourcekey=0-IueNnA7qMxmyWH6bGE9bsw&tab=t.0#heading=h.pi1uh78box27) This replaces #3724 in order to manually prepare the repo for this update. The preparation includes: - Update google-cloud-shared-config to `1.15.1`. - Configure pom.xml files to reference the `fmt` plugin using the `com.spotify.fmt` groupId instead of `com.coveo`. The group ID in [since 2022](https://github.com/spotify/fmt-maven-plugin/blame/main/README.md#L7). Some pom.xml explicitly referenced the `2.9.1` version, but I removed it so it's [controlled by google-cloud-shared-config](https://github.com/googleapis/java-shared-config/blob/bc8f22d02511c0467271698acf340874ed987160/java-shared-config/pom.xml#L172-L174). - Update our `ci.yaml` to either run the `mvn` tasks using java 17 or running the task with the `-Dfmt.skip` flag. - Update `java_compatibility_check.yaml` from java 11 to java 17. - Update our docker image to use java 17 instead of 11. - Format the codebase using `mvn fmt:format` (see 36d9ee4 for format changes). ### Review instructions You will see that the checks are failing because I did not include file formatting in the latest commit of this PR for the sake of browser performance. However, I ran the checks in 36d9ee4 with formatted files and they were all green except for the integration test, which is failing because I haven't updated the golden branch (see [this branch comparison](googleapis/google-cloud-java@chore/test-hermetic-build...chore/test-hermetic-build-update-sharedconfig-and-lint) for upcoming changes), which I plan to do before merging this PR. #### Before merging: - [x] Update golden branch - [x] Restore hermetic_library_generation workflow - [x] Restore formatted java files --------- Co-authored-by: Mend Renovate <[email protected]> Co-authored-by: cloud-java-bot <[email protected]>
1 parent f1f979d commit 4eed4d6

File tree

677 files changed

+14022
-1483
lines changed

Some content is hidden

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

677 files changed

+14022
-1483
lines changed

.cloudbuild/graalvm/cloudbuild-test-a-downstream-kms.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
_SHARED_DEPENDENCIES_VERSION: '3.30.1-SNAPSHOT' # {x-version-update:google-cloud-shared-dependencies:current}
18-
_JAVA_SHARED_CONFIG_VERSION: '1.15.0'
18+
_JAVA_SHARED_CONFIG_VERSION: '1.15.1'
1919
options:
2020
machineType: 'E2_HIGHCPU_8'
2121
logging: CLOUD_LOGGING_ONLY

.cloudbuild/graalvm/cloudbuild-test-a-downstream-kmsinventory.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
_SHARED_DEPENDENCIES_VERSION: '3.30.1-SNAPSHOT' # {x-version-update:google-cloud-shared-dependencies:current}
18-
_JAVA_SHARED_CONFIG_VERSION: '1.15.0'
18+
_JAVA_SHARED_CONFIG_VERSION: '1.15.1'
1919
options:
2020
machineType: 'E2_HIGHCPU_8'
2121
logging: CLOUD_LOGGING_ONLY

.cloudbuild/graalvm/cloudbuild-test-a.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
_SHARED_DEPENDENCIES_VERSION: '3.45.2-SNAPSHOT' # {x-version-update:google-cloud-shared-dependencies:current}
18-
_JAVA_SHARED_CONFIG_VERSION: '1.15.0'
18+
_JAVA_SHARED_CONFIG_VERSION: '1.15.1'
1919
options:
2020
machineType: 'E2_HIGHCPU_8'
2121
logging: CLOUD_LOGGING_ONLY

.cloudbuild/graalvm/cloudbuild-test-b-downstream-kms.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
_SHARED_DEPENDENCIES_VERSION: '3.30.1-SNAPSHOT' # {x-version-update:google-cloud-shared-dependencies:current}
18-
_JAVA_SHARED_CONFIG_VERSION: '1.15.0'
18+
_JAVA_SHARED_CONFIG_VERSION: '1.15.1'
1919
options:
2020
machineType: 'E2_HIGHCPU_8'
2121
logging: CLOUD_LOGGING_ONLY

.cloudbuild/graalvm/cloudbuild-test-b-downstream-kmsinventory.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
_SHARED_DEPENDENCIES_VERSION: '3.30.1-SNAPSHOT' # {x-version-update:google-cloud-shared-dependencies:current}
18-
_JAVA_SHARED_CONFIG_VERSION: '1.15.0'
18+
_JAVA_SHARED_CONFIG_VERSION: '1.15.1'
1919
options:
2020
machineType: 'E2_HIGHCPU_8'
2121
logging: CLOUD_LOGGING_ONLY

.cloudbuild/graalvm/cloudbuild-test-b.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
_SHARED_DEPENDENCIES_VERSION: '3.45.2-SNAPSHOT' # {x-version-update:google-cloud-shared-dependencies:current}
18-
_JAVA_SHARED_CONFIG_VERSION: '1.15.0'
18+
_JAVA_SHARED_CONFIG_VERSION: '1.15.1'
1919
options:
2020
machineType: 'E2_HIGHCPU_8'
2121
logging: CLOUD_LOGGING_ONLY

.cloudbuild/graalvm/cloudbuild.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
_SHARED_DEPENDENCIES_VERSION: '3.45.2-SNAPSHOT' # {x-version-update:google-cloud-shared-dependencies:current}
18-
_JAVA_SHARED_CONFIG_VERSION: '1.15.0'
18+
_JAVA_SHARED_CONFIG_VERSION: '1.15.1'
1919
steps:
2020
# GraalVM A build
2121
- name: gcr.io/cloud-builders/docker

.cloudbuild/library_generation/cloudbuild-library-generation-integration-test.yaml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ steps:
1919
- name: gcr.io/cloud-builders/docker
2020
args: [
2121
"build",
22+
"--no-cache",
2223
"-t", "${_TEST_IMAGE}",
2324
"-f", ".cloudbuild/library_generation/library_generation_airlock.Dockerfile",
2425
"."
@@ -48,7 +49,6 @@ steps:
4849
cd /workspace
4950
git clone https://github.com/googleapis/google-cloud-java
5051
cd google-cloud-java
51-
git switch 113a378d5aad5018876ec0a8cbfd4d6a4f746809
5252
git checkout chore/test-hermetic-build
5353
mkdir ../golden
5454
cd ../golden
@@ -68,10 +68,10 @@ steps:
6868
- |
6969
mvn dependency:copy \
7070
-B -ntp \
71-
-Dartifact=com.google.api:gapic-generator-java:2.38.1 \
71+
-Dartifact=com.google.api:gapic-generator-java:2.55.1 \
7272
-DoutputDirectory=/workspace
7373
cd /workspace
74-
mv gapic-generator-java-2.38.1.jar gapic-generator-java.jar
74+
mv gapic-generator-java-2.55.1.jar gapic-generator-java.jar
7575
id: prepare-generator-jar
7676
waitFor: [ "-" ]
7777

.cloudbuild/library_generation/library_generation.Dockerfile

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,8 @@
1515
# install gapic-generator-java in a separate layer so we don't overload the image
1616
# with the transferred source code and jars
1717

18-
FROM docker.io/library/maven:3.9.9-eclipse-temurin-11-alpine@sha256:456f60c1643cf70e3c1d630884387fbfa207ad5975d17b0323cc36030dc13c40 AS ggj-build
18+
19+
FROM docker.io/library/maven:3.9.9-eclipse-temurin-17-alpine@sha256:969014ee8852c9910ff5ef09de17541c2587819364b79d7dc044634dfb8a3388 AS ggj-build
1920

2021
WORKDIR /sdk-platform-java
2122
COPY . .
@@ -35,7 +36,7 @@ RUN cp "/root/.m2/repository/com/google/api/gapic-generator-java/${DOCKER_GAPIC_
3536

3637
FROM docker.io/library/alpine:3.21.2@sha256:56fa17d2a7e7f168a043a2712e63aed1f8543aeafdcee47c58dcffe38ed51099 as glibc-compat
3738

38-
RUN apk add git sudo
39+
RUN apk update && apk add git sudo
3940
# This SHA is the latest known-to-work version of this binary compatibility tool
4041
ARG GLIB_MUS_SHA=e94aca542e3ab08b42aa0b0d6e72478b935bb8e8
4142
WORKDIR /home
@@ -62,7 +63,7 @@ ENV HOME=/home
6263
ENV OS_ARCHITECTURE="linux-x86_64"
6364

6465
# install OS tools
65-
RUN apk update && apk add unzip curl rsync openjdk11 jq bash nodejs npm git
66+
RUN apk update && apk add unzip curl rsync openjdk17 jq bash nodejs npm git
6667

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

.cloudbuild/library_generation/library_generation_airlock.Dockerfile

Lines changed: 21 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,13 @@ COPY . .
2424
ENV DOCKER_GAPIC_GENERATOR_VERSION="2.55.2-SNAPSHOT"
2525
# {x-version-update-end}
2626

27-
RUN mvn install -B -ntp -DskipTests -Dclirr.skip -Dcheckstyle.skip
27+
# Download the java formatter
28+
RUN mvn -pl gapic-generator-java-pom-parent help:evaluate -Dexpression='google-java-format.version' -q -DforceStdout > /java-formatter-version
29+
RUN cat /java-formatter-version
30+
RUN V=$(cat /java-formatter-version) && curl -o "/google-java-format.jar" "https://maven-central.storage-download.googleapis.com/maven2/com/google/googlejavaformat/google-java-format/${V}/google-java-format-${V}-all-deps.jar"
31+
32+
# Skipping the fmt check until 3.9.9-eclipse-temurin-17-alpine:969014ee8852 is available in Airlock.
33+
RUN mvn install -B -ntp -DskipTests -Dclirr.skip -Dcheckstyle.skip -Dfmt.skip
2834
RUN cp "/root/.m2/repository/com/google/api/gapic-generator-java/${DOCKER_GAPIC_GENERATOR_VERSION}/gapic-generator-java-${DOCKER_GAPIC_GENERATOR_VERSION}.jar" \
2935
"./gapic-generator-java.jar"
3036

@@ -52,15 +58,14 @@ RUN sh compile-x86_64-alpine-linux.sh
5258
# 3.12.7-alpine3.20
5359
FROM us-docker.pkg.dev/artifact-foundry-prod/docker-3p-trusted/python@sha256:b83d5ec7274bee17d2f4bd0bfbb082f156241e4513f0a37c70500e1763b1d90d as final
5460

55-
ARG OWLBOT_CLI_COMMITTISH=8b7d94b4a8ad0345aeefd6a7ec9c5afcbeb8e2d7
61+
ARG OWLBOT_CLI_COMMITTISH=3a68a9c0de318784b3aefadcc502a6521b3f1bc5
5662
ARG PROTOC_VERSION=25.5
57-
ARG GRPC_VERSION=1.69.0
58-
ARG JAVA_FORMAT_VERSION=1.7
63+
ARG GRPC_VERSION=1.70.0
5964
ENV HOME=/home
6065
ENV OS_ARCHITECTURE="linux-x86_64"
6166

6267
# install OS tools
63-
RUN apk update && apk add unzip curl rsync openjdk11 jq bash nodejs npm git
68+
RUN apk update && apk add unzip curl rsync openjdk17 jq bash nodejs npm git
6469

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

@@ -78,6 +83,7 @@ COPY --from=glibc-compat /lib/libc.* /lib/
7883
COPY --from=glibc-compat /usr/lib/libgcc* /usr/lib/
7984
COPY --from=glibc-compat /usr/lib/libstdc* /usr/lib/
8085
COPY --from=glibc-compat /usr/lib/libobstack* /usr/lib/
86+
COPY --from=glibc-compat /lib/libm.so.6 /usr/lib/
8187

8288

8389
# copy source code
@@ -99,14 +105,6 @@ RUN source /src/library_generation/utils/utilities.sh \
99105
# similar to protoc, we indicate grpc is available in the container via env vars
100106
ENV DOCKER_GRPC_LOCATION="/grpc/protoc-gen-grpc-java.exe"
101107

102-
# Here we transfer gapic-generator-java from the previous stage.
103-
# Note that the destination is a well-known location that will be assumed at runtime
104-
# We hard-code the location string to avoid making it configurable (via ARG) as
105-
# well as to avoid it making it overridable at runtime (via ENV).
106-
COPY --from=ggj-build "/sdk-platform-java/gapic-generator-java.jar" "${HOME}/.library_generation/gapic-generator-java.jar"
107-
RUN chmod 755 "${HOME}/.library_generation/gapic-generator-java.jar"
108-
ENV GAPIC_GENERATOR_LOCATION="${HOME}/.library_generation/gapic-generator-java.jar"
109-
110108
RUN python -m pip install --upgrade pip
111109

112110
# install main scripts as a python package
@@ -126,12 +124,19 @@ RUN owl-bot copy-code --version
126124
RUN chmod o+rx $(which owl-bot)
127125
RUN apk del -r npm && apk cache clean
128126

129-
# download the Java formatter
130-
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 \
131-
"${HOME}"/.library_generation/google-java-format.jar
127+
# copy the Java formatter
128+
COPY --from=ggj-build "/google-java-format.jar" "${HOME}"/.library_generation/google-java-format.jar
132129
RUN chmod 755 "${HOME}"/.library_generation/google-java-format.jar
133130
ENV JAVA_FORMATTER_LOCATION="${HOME}/.library_generation/google-java-format.jar"
134131

132+
# Here we transfer gapic-generator-java from the previous stage.
133+
# Note that the destination is a well-known location that will be assumed at runtime
134+
# We hard-code the location string to avoid making it configurable (via ARG) as
135+
# well as to avoid it making it overridable at runtime (via ENV).
136+
COPY --from=ggj-build "/sdk-platform-java/gapic-generator-java.jar" "${HOME}/.library_generation/gapic-generator-java.jar"
137+
RUN chmod 755 "${HOME}/.library_generation/gapic-generator-java.jar"
138+
ENV GAPIC_GENERATOR_LOCATION="${HOME}/.library_generation/gapic-generator-java.jar"
139+
135140
# allow users to access the script folders
136141
RUN chmod -R o+rx /src
137142

0 commit comments

Comments
 (0)