Skip to content

Commit 68979d8

Browse files
committed
Merge branch 'main' of github.com:googleapis/google-cloud-java into fix_auth_adc_credentials_nullability
2 parents 0c59b08 + 41f0a2e commit 68979d8

4,367 files changed

Lines changed: 145193 additions & 645815 deletions

File tree

Some content is hidden

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

.github/workflows/ci.yaml

Lines changed: 39 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,8 @@ on:
2323
pull_request:
2424
name: ci
2525
jobs:
26-
# detect whether or note we should run "bulk" (non-handwritten) unit tests
27-
bulk-filter:
26+
# detect whether or not we should run generated (non-handwritten) unit tests
27+
generated-libraries-filter:
2828
runs-on: ubuntu-latest
2929
permissions:
3030
pull-requests: read
@@ -57,68 +57,63 @@ jobs:
5757
ci:
5858
- '.github/workflows/ci.yaml'
5959
- '.kokoro/**'
60-
# these unit tests are "bulk" (non-handwritten) libraries
60+
# compile all modules across supported Java versions as a fast smoke test
6161
units:
6262
runs-on: ubuntu-latest
63-
needs: bulk-filter
63+
needs: generated-libraries-filter
64+
if: ${{ needs.generated-libraries-filter.outputs.runnable == 'true' }}
6465
strategy:
6566
fail-fast: false
6667
matrix:
6768
java: [11, 17, 21, 25, 26]
6869
steps:
6970
- uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4.4.0
70-
if: ${{ needs.bulk-filter.outputs.runnable == 'true' }}
7171
with:
7272
persist-credentials: false
7373
- uses: actions/setup-java@cf277c60eb25467037889841efdb72551f06f6c3 # v4.9.1
74-
if: ${{ needs.bulk-filter.outputs.runnable == 'true' }}
7574
with:
7675
distribution: temurin
7776
java-version: ${{matrix.java}}
7877
cache: maven
7978
- run: java -version
80-
if: ${{ needs.bulk-filter.outputs.runnable == 'true' }}
8179
- run: .kokoro/build.sh
82-
if: ${{ needs.bulk-filter.outputs.runnable == 'true' && (needs.bulk-filter.outputs.src == 'true' || needs.bulk-filter.outputs.ci == 'true') }}
80+
if: ${{ needs.generated-libraries-filter.outputs.src == 'true' || needs.generated-libraries-filter.outputs.ci == 'true' }}
8381
env:
8482
JOB_TYPE: test
8583
JOB_NAME: units-${{matrix.java}}
8684
units-8-runtime:
8785
runs-on: ubuntu-latest
88-
needs: bulk-filter
86+
needs: generated-libraries-filter
87+
if: ${{ needs.generated-libraries-filter.outputs.runnable == 'true' }}
8988
name: "units (8)"
9089
steps:
9190
- uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4.4.0
92-
if: ${{ needs.bulk-filter.outputs.runnable == 'true' }}
9391
with:
9492
persist-credentials: false
9593
- uses: actions/setup-java@cf277c60eb25467037889841efdb72551f06f6c3 # v4.9.1
96-
if: ${{ needs.bulk-filter.outputs.runnable == 'true' }}
9794
with:
9895
java-version: 8
9996
distribution: temurin
10097
- name: "Set jvm system property environment variable for surefire plugin (unit tests)"
10198
# Maven surefire plugin (unit tests) allows us to specify JVM to run the tests.
10299
# https://maven.apache.org/surefire/maven-surefire-plugin/test-mojo.html#jvm
103-
if: ${{ needs.bulk-filter.outputs.runnable == 'true' }}
104100
run: echo "SUREFIRE_JVM_OPT=-Djvm=${JAVA_HOME}/bin/java" >> $GITHUB_ENV
105101
shell: bash
106102
- uses: actions/setup-java@cf277c60eb25467037889841efdb72551f06f6c3 # v4.9.1
107-
if: ${{ needs.bulk-filter.outputs.runnable == 'true' }}
108103
with:
109104
java-version: 11
110105
distribution: temurin
111106
cache: maven
112107
- run: .kokoro/build.sh
113-
if: ${{ needs.bulk-filter.outputs.runnable == 'true' && (needs.bulk-filter.outputs.src == 'true' || needs.bulk-filter.outputs.ci == 'true') }}
108+
if: ${{ needs.generated-libraries-filter.outputs.src == 'true' || needs.generated-libraries-filter.outputs.ci == 'true' }}
114109
shell: bash
115110
env:
116111
JOB_TYPE: test
117112
JOB_NAME: units-8-runtime-${{matrix.java}}
118113
# detect which libraries have changed
119114
changes:
120-
needs: bulk-filter
121-
if: ${{ needs.bulk-filter.outputs.runnable == 'true' }}
115+
needs: generated-libraries-filter
116+
if: ${{ needs.generated-libraries-filter.outputs.runnable == 'true' }}
122117
runs-on: ubuntu-latest
123118
permissions:
124119
pull-requests: read
@@ -349,7 +344,7 @@ jobs:
349344
env:
350345
BUILD_SUBDIR: ${{matrix.package}}
351346
required:
352-
needs: [ bulk-filter, changes, split-units, split-clirr, split-dependencies ]
347+
needs: [ generated-libraries-filter, changes, split-units, split-clirr, split-dependencies ]
353348
name: conditional-required-check
354349
if: ${{ always() }} # Always run even if any "needs" jobs fail
355350
runs-on: ubuntu-22.04
@@ -360,8 +355,8 @@ jobs:
360355
- name: Success otherwise
361356
run: echo "Success!"
362357
windows:
363-
needs: bulk-filter
364-
if: ${{ needs.bulk-filter.outputs.runnable == 'true' }}
358+
needs: generated-libraries-filter
359+
if: ${{ needs.generated-libraries-filter.outputs.runnable == 'true' }}
365360
runs-on: windows-latest
366361
steps:
367362
- name: Support longpaths
@@ -380,8 +375,8 @@ jobs:
380375
JOB_TYPE: test
381376
JOB_NAME: windows-units
382377
lint:
383-
needs: bulk-filter
384-
if: ${{ needs.bulk-filter.outputs.runnable == 'true' }}
378+
needs: generated-libraries-filter
379+
if: ${{ needs.generated-libraries-filter.outputs.runnable == 'true' }}
385380
runs-on: ubuntu-latest
386381
steps:
387382
- uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4.4.0
@@ -400,8 +395,26 @@ jobs:
400395
HEAD_SHA: ${{ github.event.pull_request.head.sha || github.sha }}
401396
BASE_SHA: ${{ github.event.pull_request.base.sha || github.event.before }}
402397
enforcer:
403-
needs: bulk-filter
404-
if: ${{ needs.bulk-filter.outputs.runnable == 'true' }}
398+
needs: generated-libraries-filter
399+
if: ${{ needs.generated-libraries-filter.outputs.runnable == 'true' }}
400+
runs-on: ubuntu-latest
401+
steps:
402+
- uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4.4.0
403+
with:
404+
persist-credentials: false
405+
- uses: actions/setup-java@cf277c60eb25467037889841efdb72551f06f6c3 # v4.9.1
406+
with:
407+
distribution: temurin
408+
java-version: 11
409+
cache: maven
410+
- run: java -version
411+
- run: mvn -B -ntp enforcer:enforce@enforce -T 1C
412+
ban-duplicate-classes:
413+
needs: generated-libraries-filter
414+
if: |
415+
needs.generated-libraries-filter.outputs.runnable == 'true' &&
416+
github.head_ref == 'release-please--branches--main' &&
417+
!endsWith(github.event.pull_request.title, 'SNAPSHOT')
405418
runs-on: ubuntu-latest
406419
steps:
407420
- uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4.4.0
@@ -418,10 +431,10 @@ jobs:
418431
env:
419432
JOB_TYPE: install
420433
- run: java -version
421-
- run: mvn -B -ntp enforcer:enforce@enforce -T 1C
434+
- run: mvn -B -ntp enforcer:enforce@enforce-banned-duplicate-classes -T 1C
422435
gapic-libraries-bom:
423-
needs: bulk-filter
424-
if: ${{ needs.bulk-filter.outputs.runnable == 'true' }}
436+
needs: generated-libraries-filter
437+
if: ${{ needs.generated-libraries-filter.outputs.runnable == 'true' }}
425438
runs-on: ubuntu-latest
426439
steps:
427440
- uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4.4.0

.github/workflows/java-shared-config-downstream-dependencies.yaml

Lines changed: 0 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -82,37 +82,3 @@ jobs:
8282
mvn install -pl ${TARGET_PATH} -am -DskipTests=true -Dmaven.javadoc.skip=true -Dgcloud.download.skip=true -B -V -q
8383
- run: .kokoro/client-library-check.sh ${{matrix.repo}} dependencies
8484

85-
flatten-plugin-check:
86-
needs: filter
87-
if: ${{ needs.filter.outputs.library == 'true' }}
88-
runs-on: ubuntu-latest
89-
steps:
90-
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
91-
with:
92-
persist-credentials: false
93-
- uses: actions/setup-java@c1e323688fd81a25caa38c78aa6df2d33d3e20d9 # v4.8.0
94-
with:
95-
distribution: zulu
96-
java-version: 11
97-
cache: maven
98-
- run: java -version
99-
- name: Install xmllint
100-
timeout-minutes: 5
101-
run: |
102-
# Retry apt-get update and install up to 3 times with a 15-second per-request timeout.
103-
# Retries protect against transient network glitches, mirror timeouts, and apt lock contention on runner startup.
104-
for i in {1..3}; do
105-
sudo apt-get -o Acquire::http::Timeout="15" -o Acquire::Retries=3 update && \
106-
sudo apt-get -o Acquire::http::Timeout="15" -o Acquire::Retries=3 -y install libxml2-utils && \
107-
break || sleep 5
108-
done
109-
- name: Install java-shared-dependencies and common dependencies
110-
run: |
111-
.kokoro/build.sh
112-
env:
113-
JOB_TYPE: install
114-
- name: Pre-build dependencies
115-
run: mvn install -pl java-storage/google-cloud-storage -am -DskipTests=true -Dmaven.javadoc.skip=true -Dgcloud.download.skip=true -B -V -q
116-
- run: .kokoro/client-library-check.sh java-storage flatten-plugin
117-
env:
118-
EXPECTED_DEPENDENCIES_LIST: java-storage-expected-flattened-dependencies.txt

.kokoro/build.sh

Lines changed: 18 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -37,27 +37,39 @@ RETURN_CODE=0
3737

3838
case ${JOB_TYPE} in
3939
test)
40+
MAVEN_GOAL="test"
4041
if [[ -n "${BUILD_SUBDIR}" ]]
4142
then
43+
# Targeted module build (invoked by split-units for handwritten/combo libraries).
44+
# Compiles and runs all unit tests for the specific changed library submodule.
4245
echo "Compiling and building all modules for ${BUILD_SUBDIR}"
4346
install_modules "${BUILD_SUBDIR}"
4447
echo "Running in subdir: ${BUILD_SUBDIR}"
4548
pushd "${BUILD_SUBDIR}"
46-
EXTRA_PROFILE_OPTS=()
49+
EXCLUDE_PROJECTS_OPTS=()
4750
else
48-
EXTRA_PROFILE_OPTS=("-PbulkTests")
51+
# Full monorepo smoke pass across Java runtime matrix versions (units job).
52+
# Pure GAPIC-generated modules skip unit tests by default via <skipUnitTests>true</skipUnitTests>
53+
# in google-cloud-jar-parent; generator correctness and GAX runtime behaviors are covered by
54+
# java-showcase (showcase.yaml). Running a parallel compile pass confirms compatibility
55+
# across all supported JDKs in ~2 minutes instead of 40+ minutes.
56+
MAVEN_GOAL="compile"
57+
# gapic-generator-java is a code generation tool tested in its own dedicated workflow
58+
# (sdk-platform-java-ci.yaml). Excluding it from bulk unit test runs saves 2-3 minutes per
59+
# Java runtime matrix job and avoids reactor dependency resolution race conditions.
60+
EXCLUDE_PROJECTS_OPTS=("--projects" "!sdk-platform-java/gapic-generator-java,!sdk-platform-java/gapic-generator-java-pom-parent")
4961
install_modules "sdk-platform-java"
5062
fi
51-
echo "SUREFIRE_JVM_OPT: ${SUREFIRE_JVM_OPT}"
63+
echo "MAVEN_GOAL: ${MAVEN_GOAL}"
5264
retry_with_backoff 3 10 \
53-
mvn install \
65+
mvn ${MAVEN_GOAL} \
5466
-B -ntp \
5567
-Pquick-build \
5668
-Dorg.slf4j.simpleLogger.showDateTime=true \
5769
-Dorg.slf4j.simpleLogger.dateTimeFormat=HH:mm:ss:SSS \
5870
-Dmaven.wagon.http.retryHandler.count=5 \
59-
--also-make \
60-
${SUREFIRE_JVM_OPT} "${EXTRA_PROFILE_OPTS[@]}"
71+
"${EXCLUDE_PROJECTS_OPTS[@]}" \
72+
-T 1C
6173
RETURN_CODE=$?
6274

6375
if [[ -n "${BUILD_SUBDIR}" ]]

.kokoro/client-library-check.sh

Lines changed: 0 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -140,26 +140,6 @@ dependencies)
140140
../.kokoro/dependencies.sh
141141
RETURN_CODE=$?
142142
;;
143-
flatten-plugin)
144-
# This creates .flattened-pom.xml
145-
echo "Before running ../.kokoro/build.sh"
146-
../.kokoro/build.sh
147-
echo "After running ../.kokoro/build.sh"
148-
pushd ${LIBRARY_NAME}
149-
mvn -B -ntp dependency:list -f .flattened-pom.xml -DincludeScope=runtime -Dsort=true \
150-
| grep '\[INFO] .*:.*:.*:.*:.*' |awk '{print $2}' > .actual-flattened-dependencies-list.txt
151-
152-
# Strip -SNAPSHOT for comparison to support release PRs where dependencies are bumped to release versions
153-
echo "Diff from the expected file (${EXPECTED_DEPENDENCIES_LIST}) (ignoring -SNAPSHOT):"
154-
diff <(sed 's/-SNAPSHOT//g' "${scriptDir}/${EXPECTED_DEPENDENCIES_LIST}") <(sed 's/-SNAPSHOT//g' .actual-flattened-dependencies-list.txt)
155-
RETURN_CODE=$?
156-
if [ "${RETURN_CODE}" == 0 ]; then
157-
echo "No diff."
158-
else
159-
echo "There was a diff."
160-
fi
161-
popd
162-
;;
163143
*)
164144
# For clirr and test, run directly in the subdirectory to avoid building monorepo dependencies (like gax) from source.
165145
# This is necessary because some monorepo dependencies (like gax) use GraalVM 25+ which cannot be compiled under Java 8.

.kokoro/common.sh

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -416,6 +416,8 @@ function install_modules() {
416416
printf "Installing submodules:\n%s\n" "$all_submodules"
417417

418418
always_install_deps_list=(
419+
# Required upstream dependency for java-spanner and java-spanner-jdbc
420+
'grpc-gcp-java'
419421
'java-monitoring/google-cloud-monitoring'
420422
'java-monitoring/google-cloud-monitoring-bom'
421423
'java-kms/google-cloud-kms'
@@ -439,6 +441,8 @@ function install_modules() {
439441
'java-iam/proto-google-iam-v3'
440442
'java-iam/proto-google-iam-v3beta'
441443
'gapic-libraries-bom'
444+
# Required upstream dependency for gax-java, google-cloud-core, and all client libraries
445+
'sdk-platform-java/api-common-java'
442446
'sdk-platform-java/java-shared-dependencies'
443447
'sdk-platform-java/java-shared-dependencies/first-party-dependencies'
444448
'sdk-platform-java/java-shared-dependencies/third-party-dependencies'

.kokoro/dependencies.sh

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -56,11 +56,20 @@ then
5656
pushd "${BUILD_SUBDIR}"
5757
fi
5858

59-
# this should run maven enforcer
60-
mvn install -B -V -ntp \
61-
-Pquick-build -DskipTests=true -Dmaven.javadoc.skip=true -Denforcer.skip=false
59+
# We use the 'test-compile' lifecycle phase (with -DskipTests=true) for the following reasons:
60+
# 1. Why test-compile over compile? 'compile' only builds src/main/java. 'dependency:analyze'
61+
# inspects bytecode in both target/classes and target/test-classes. If test classes are not
62+
# compiled, test-scoped dependencies (such as test mocks and stubs) will be falsely flagged
63+
# as "Unused declared dependencies" by maven-dependency-plugin.
64+
# 2. Why test-compile over package/install? 'package' and 'install' build and bundle JAR archives
65+
# and install them into ~/.m2/repository. Packaging JARs adds significant build time (5-15 mins)
66+
# and is unnecessary for static dependency analysis and enforcer verification. 'test-compile'
67+
# produces the required bytecode in target/classes and target/test-classes in seconds.
68+
# 3. Why -DskipTests=true? Ensures test classes are compiled without executing tests during analysis.
69+
mvn test-compile -B -V -ntp \
70+
-Pquick-build -DskipTests=true -Dmaven.javadoc.skip=true -Denforcer.skip=false -T 1C
6271

63-
mvn -B dependency:analyze -Pquick-build -DfailOnWarning=true -Dmdep.analyze.skip=false
72+
mvn -B dependency:analyze -Pquick-build -DfailOnWarning=true -Dmdep.analyze.skip=false -T 1C
6473

6574
if [[ -n "${BUILD_SUBDIR}" ]]
6675
then

0 commit comments

Comments
 (0)