Skip to content

Commit aa78b13

Browse files
chore: update google-java-format to the latest (#1003)
* chore: update google-java-format to the latest b/395190324 * chore: do downstream lint test using java 17 and 21 * chore: adapt to new showcase folder in sdk-platform-java * chore: remove lint from Java 7 and 11 downstream jobs * deps: update fmt-maven-plugin to 2.13 * use the latest spotify fmt plugin * deps: use proper group ID for latest fmt plugin * add debug command to test fmt version * use spotify fmt plugin in lint job * fix string replacement * correct indentation, explain further removal of sed * chore: adapt sync repo settings to new lint jobs
1 parent a315cf1 commit aa78b13

File tree

5 files changed

+33
-9
lines changed

5 files changed

+33
-9
lines changed

.github/sync-repo-settings.yaml

+2-2
Original file line numberDiff line numberDiff line change
@@ -40,13 +40,13 @@ branchProtectionRules:
4040
- "dependencies (11, java-pubsub)"
4141
- "flatten-plugin-check"
4242
- "build (8, java-bigquery, test)"
43-
- "build (8, java-bigquery, lint)"
4443
- "build (8, java-bigquery, clirr)"
4544
- "build (8, java-bigtable, javadoc)"
4645
- "build (11, java-bigquery, test)"
47-
- "build (11, java-bigquery, lint)"
4846
- "build (11, java-bigquery, clirr)"
4947
- "build (11, java-bigtable, javadoc)"
48+
- "lint (17, java-bigquery, lint)"
49+
- "lint (21, java-bigquery, lint)"
5050
- "javadoc-with-doclet (java-bigtable)"
5151
- "cla/google"
5252
- "graalvm-presubmit-shared-config-a (java-graalvm-ci-prod)"

.github/workflows/downstream-maven-plugins.yaml

+21-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@ jobs:
2020
- java-bigtable
2121
job-type:
2222
- test # maven-surefire-plugin
23-
- lint # fmt-maven-plugin and google-java-format
2423
- clirr # clirr-maven-plugin
2524
- javadoc # maven-javadoc-plugin
2625
- javadoc-with-doclet # test javadoc generation with doclet
@@ -34,6 +33,27 @@ jobs:
3433
- run: sudo apt-get update -y
3534
- run: sudo apt-get install libxml2-utils
3635
- run: .kokoro/client-library-check.sh ${{matrix.repo}} ${{matrix.job-type}}
36+
lint:
37+
runs-on: ubuntu-latest
38+
strategy:
39+
fail-fast: false
40+
matrix:
41+
java: [17, 21]
42+
repo:
43+
- java-bigquery
44+
- java-bigtable
45+
job-type:
46+
- lint # fmt-maven-plugin and google-java-format
47+
steps:
48+
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
49+
- uses: actions/setup-java@v4
50+
with:
51+
distribution: zulu
52+
java-version: ${{matrix.java}}
53+
- run: java -version
54+
- run: sudo apt-get update -y
55+
- run: sudo apt-get install libxml2-utils
56+
- run: .kokoro/client-library-check.sh ${{matrix.repo}} ${{matrix.job-type}}
3757
javadoc-with-doclet:
3858
runs-on: ubuntu-latest
3959
strategy:

.kokoro/client-library-check.sh

+4
Original file line numberDiff line numberDiff line change
@@ -155,6 +155,10 @@ flatten-plugin)
155155
popd
156156
;;
157157
*)
158+
# Here we replace the com.coveo fmt plugin with the spotify version.
159+
# This `sed` won't be needed once downstream repositories update
160+
# `.kokoro/build.sh` to use the `com.spotify.fmt` group ID.
161+
sed -i 's/com.coveo:fmt-maven-plugin/com.spotify.fmt:fmt-maven-plugin/' .kokoro/build.sh
158162
# This reads the JOB_TYPE environmental variable
159163
.kokoro/build.sh
160164
RETURN_CODE=$?

.kokoro/presubmit/downstream-build.sh

+3-3
Original file line numberDiff line numberDiff line change
@@ -42,14 +42,14 @@ cp settings.xml "${HOME}/.m2"
4242
git clone "https://github.com/googleapis/sdk-platform-java" --depth=1
4343

4444
# Update the shared-config version in showcase
45-
pushd sdk-platform-java/showcase
45+
pushd sdk-platform-java/java-showcase
4646
modify_shared_config
4747
popd
4848

4949
pushd sdk-platform-java
5050
mvn -B -ntp install --projects '!gapic-generator-java' -Dcheckstyle.skip -Dfmt.skip -DskipTests
5151
popd
52-
pushd sdk-platform-java/showcase/gapic-showcase
52+
pushd sdk-platform-java/java-showcase/gapic-showcase
5353
SHOWCASE_VERSION=$(mvn help:evaluate -Dexpression=gapic-showcase.version -q -DforceStdout)
5454
popd
5555

@@ -62,7 +62,7 @@ tar -xf showcase-*
6262
popd
6363

6464
# Run showcase tests with `native` profile
65-
pushd sdk-platform-java/showcase
65+
pushd sdk-platform-java/java-showcase
6666
mvn test -Pnative,-showcase -Denforcer.skip=true -ntp -B
6767
popd
6868

java-shared-config/pom.xml

+3-3
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828
<skipITs>true</skipITs>
2929
<auto-value.version>1.11.0</auto-value.version>
3030
<docRoot>/java/docs/reference/</docRoot>
31-
<google-java-format.version>1.7</google-java-format.version>
31+
<google-java-format.version>1.25.2</google-java-format.version>
3232
</properties>
3333

3434
<build>
@@ -169,9 +169,9 @@
169169
<version>2.8</version>
170170
</plugin>
171171
<plugin>
172-
<groupId>com.coveo</groupId>
172+
<groupId>com.spotify.fmt</groupId>
173173
<artifactId>fmt-maven-plugin</artifactId>
174-
<version>2.9</version>
174+
<version>2.25</version>
175175
<configuration>
176176
<style>google</style>
177177
<verbose>true</verbose>

0 commit comments

Comments
 (0)