Skip to content

Commit 7e9bc92

Browse files
committed
Merge branch 'main' of github.com:googleapis/google-cloud-java into bqstorage-keep-alive
2 parents e61530f + 6c3721b commit 7e9bc92

129 files changed

Lines changed: 18263 additions & 4867 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/java-bigquerystorage-ci.yaml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,8 @@ jobs:
114114
runs-on: ubuntu-latest
115115
steps:
116116
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
117+
with:
118+
fetch-depth: 0
117119
- uses: actions/setup-java@v2
118120
with:
119121
distribution: temurin
@@ -122,3 +124,5 @@ jobs:
122124
- run: .kokoro/build.sh
123125
env:
124126
JOB_TYPE: lint
127+
HEAD_SHA: ${{ github.event.pull_request.head.sha }}
128+
BASE_SHA: ${{ github.event.pull_request.base.sha }}

.github/workflows/java-datastore-ci.yaml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -137,6 +137,8 @@ jobs:
137137
runs-on: ubuntu-latest
138138
steps:
139139
- uses: actions/checkout@v4
140+
with:
141+
fetch-depth: 0
140142
- uses: actions/setup-java@v4
141143
with:
142144
distribution: temurin
@@ -145,3 +147,5 @@ jobs:
145147
- run: .kokoro/build.sh
146148
env:
147149
JOB_TYPE: lint
150+
HEAD_SHA: ${{ github.event.pull_request.head.sha }}
151+
BASE_SHA: ${{ github.event.pull_request.base.sha }}

.github/workflows/java-logging-ci.yaml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -129,6 +129,8 @@ jobs:
129129
runs-on: ubuntu-latest
130130
steps:
131131
- uses: actions/checkout@v4
132+
with:
133+
fetch-depth: 0
132134
- uses: actions/setup-java@v4
133135
with:
134136
distribution: temurin
@@ -137,3 +139,5 @@ jobs:
137139
- run: .kokoro/build.sh
138140
env:
139141
JOB_TYPE: lint
142+
HEAD_SHA: ${{ github.event.pull_request.head.sha }}
143+
BASE_SHA: ${{ github.event.pull_request.base.sha }}

.github/workflows/java-logging-logback-ci.yaml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -129,6 +129,8 @@ jobs:
129129
runs-on: ubuntu-latest
130130
steps:
131131
- uses: actions/checkout@v4
132+
with:
133+
fetch-depth: 0
132134
- uses: actions/setup-java@v4
133135
with:
134136
distribution: temurin
@@ -137,3 +139,5 @@ jobs:
137139
- run: .kokoro/build.sh
138140
env:
139141
JOB_TYPE: lint
142+
HEAD_SHA: ${{ github.event.pull_request.head.sha }}
143+
BASE_SHA: ${{ github.event.pull_request.base.sha }}

.kokoro/build.sh

Lines changed: 70 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -71,13 +71,18 @@ case ${JOB_TYPE} in
7171
if [[ "$(release_please_snapshot_pull_request)" == "true" ]]; then
7272
echo "Skipping integration tests as this is Release Please SNAPSHOT pull request."
7373
elif [[ ${#modified_module_list[@]} -gt 0 ]]; then
74-
module_list=$(
75-
IFS=,
76-
echo "${modified_module_list[*]}"
77-
)
78-
setup_cloud "$module_list"
79-
install_modules "$module_list"
80-
run_integration_tests "$module_list"
74+
filter_modules_with_integration_tests
75+
if [[ ${#filtered_it_module_list[@]} -eq 0 ]]; then
76+
echo "No modified modules contain integration tests. Skipping."
77+
else
78+
module_list=$(
79+
IFS=,
80+
echo "${filtered_it_module_list[*]}"
81+
)
82+
setup_cloud "$module_list"
83+
install_modules "$module_list"
84+
run_integration_tests "$module_list"
85+
fi
8186
else
8287
echo "No Integration Tests to run"
8388
fi
@@ -157,7 +162,7 @@ case ${JOB_TYPE} in
157162
fi
158163
;;
159164
graalvm-single)
160-
generate_modified_modules_list false
165+
generate_modified_modules_list false
161166
if [[ "$(release_please_snapshot_pull_request)" == "true" ]]; then
162167
echo "Not running GraalVM checks -- this is Release Please SNAPSHOT pull request."
163168
elif [[ ! " ${modified_module_list[*]} " =~ " ${BUILD_SUBDIR} " ]]; then
@@ -194,12 +199,19 @@ case ${JOB_TYPE} in
194199
echo "Running in subdir: ${BUILD_SUBDIR}"
195200
pushd "${BUILD_SUBDIR}"
196201
fi
202+
203+
MODULE_FILTER=""
204+
197205
if [ -n "${BASE_SHA}" ] && [ -n "${HEAD_SHA}" ]; then
198-
changed_file_list=$(git diff --name-only "${BASE_SHA}" "${HEAD_SHA}")
206+
# Optimize the build by identifying ONLY the Maven modules that contain changed Java source files.
207+
# Format those specific modules instead of the entire codebase, reducing format check time.
208+
# The --relative flag is when building in the submodule as only files modified in the module
209+
# should be accounted for.
210+
changed_file_list=$(git diff --name-only "${BASE_SHA}" "${HEAD_SHA}" --relative)
199211
echo "${changed_file_list}"
200-
212+
201213
has_code_change="false"
202-
214+
203215
while IFS= read -r changed_file; do
204216
# Checks if the line is not empty AND if it matches a .java file
205217
if [ -n "${changed_file}" ] && [[ "${changed_file}" == *.java ]]; then
@@ -208,19 +220,60 @@ case ${JOB_TYPE} in
208220
break
209221
fi
210222
done <<< "${changed_file_list}"
211-
223+
212224
if [ "${has_code_change}" == "false" ]; then
213225
echo "No java modules affected. Skipping linter check."
214226
exit 0
215227
fi
228+
229+
# Compute list of changed Maven modules from changed Java files.
230+
# We walk each changed .java file up to its nearest pom.xml to find the correct module.
231+
# e.g., if "java-asset/google-cloud-asset/src/main/java/Foo.java" is changed,
232+
# it traverses upward until finding "java-asset/google-cloud-asset/pom.xml" and adds that module.
233+
changed_modules=()
234+
while IFS= read -r changed_file; do
235+
if [ -n "${changed_file}" ] && [[ "${changed_file}" == *.java ]]; then
236+
dir=$(dirname "${changed_file}")
237+
while [ "${dir}" != "." ] && [ ! -f "${dir}/pom.xml" ]; do
238+
dir=$(dirname "${dir}")
239+
done
240+
if [ -f "${dir}/pom.xml" ] && [ "${dir}" != "." ]; then
241+
# Filter out directories not participating in the default formatting reactor:
242+
# - samples are handwritten by developers
243+
# - proto-*/grpc-* are generated code and should use the compiler format
244+
# - *-bom/parents are POM-only and contain no Java source
245+
if [[ "${dir}" != *"samples"* ]] && \
246+
[[ "$(basename "${dir}")" != "proto-google-"* ]] && \
247+
[[ "$(basename "${dir}")" != "grpc-google-"* ]] && \
248+
[[ "$(basename "${dir}")" != *"-bom" ]] && \
249+
[[ "$(basename "${dir}")" != "google-cloud-pom-parent" ]] && \
250+
[[ "$(basename "${dir}")" != "google-cloud-jar-parent" ]]; then
251+
252+
changed_modules+=("${dir}")
253+
fi
254+
fi
255+
fi
256+
done <<< "${changed_file_list}"
257+
258+
echo "Changed Modules: ${changed_modules[*]}"
259+
260+
# Deduplicate the modules using sort -u to pass a concise list of unique modules
261+
# via the Maven `-pl` argument.
262+
if [ ${#changed_modules[@]} -gt 0 ]; then
263+
unique_modules=$(printf '%s\n' "${changed_modules[@]}" | sort -u | paste -sd ',' -)
264+
MODULE_FILTER="-pl ${unique_modules}"
265+
echo "Formatting only changed modules: ${unique_modules}"
266+
fi
216267
else
217-
echo "BASE_SHA or HEAD_SHA is empty. Skipping file difference check."
268+
echo "BASE_SHA or HEAD_SHA is empty. Cannot continue linting."
269+
exit 1
218270
fi
219-
271+
220272
mvn -B -ntp \
221-
-T 1.5C \
273+
-T 1C \
274+
${MODULE_FILTER} \
222275
com.spotify.fmt:fmt-maven-plugin:check
223-
mvn -B -ntp checkstyle:check@checkstyle
276+
mvn -B -ntp ${MODULE_FILTER} checkstyle:check@checkstyle
224277

225278
if [[ -n "${BUILD_SUBDIR}" ]]
226279
then
@@ -245,4 +298,4 @@ if [[ "${ENABLE_FLAKYBOT}" == "true" ]]; then
245298
fi
246299

247300
echo "exiting with ${RETURN_CODE}"
248-
exit ${RETURN_CODE}
301+
exit ${RETURN_CODE}

.kokoro/common.sh

Lines changed: 77 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -62,20 +62,69 @@ function retry_with_backoff {
6262
return $exit_code
6363
}
6464

65+
# Helper function to reliably extract the text between <module> tags strictly
66+
# within the default <modules> block, natively ignoring <profiles>.
67+
# Uses a pure Bash loop to avoid spawning slower external processes like awk or sed,
68+
# and naturally survives single-module components without throwing exit signals.
69+
function extract_pom_modules() {
70+
local pom_file="$1"
71+
local modules_list=""
72+
local in_profiles=false
73+
local in_modules=false
74+
75+
while IFS= read -r line || [ -n "$line" ]; do
76+
if [[ "$line" == *"<profiles>"* ]]; then
77+
in_profiles=true
78+
elif [[ "$line" == *"</profiles>"* ]]; then
79+
in_profiles=false
80+
elif [[ "$line" == *"<modules>"* ]] && [ "$in_profiles" = false ]; then
81+
in_modules=true
82+
elif [[ "$line" == *"</modules>"* ]] && [ "$in_profiles" = false ]; then
83+
in_modules=false
84+
break
85+
elif [ "$in_modules" = true ] && [[ "$line" == *"<module>"* ]]; then
86+
# Extract text between tags
87+
local module="${line#*<module>}"
88+
module="${module%</module>*}"
89+
90+
# Trim whitespace natively
91+
module="${module#"${module%%[![:space:]]*}"}"
92+
module="${module%"${module##*[![:space:]]}"}"
93+
94+
if [ -z "$modules_list" ]; then
95+
modules_list="$module"
96+
else
97+
modules_list="${modules_list} ${module}"
98+
fi
99+
fi
100+
done < "$pom_file"
101+
102+
echo "$modules_list"
103+
}
104+
65105
# Given a folder containing a maven multi-module, assign the variable 'submodules' to a
66106
# comma-delimited list of <folder>/<submodule>.
67107
function parse_submodules() {
68108
submodules_array=()
69-
mvn_submodules=$(mvn help:evaluate -Dexpression=project.modules -pl "$1")
70-
if mvn_submodules=$(grep '<.*>.*</.*>' <<< "$mvn_submodules"); then
71-
mvn_submodules=$(sed -e 's/<.*>\(.*\)<\/.*>/\1/g' <<< "$mvn_submodules")
72-
for submodule in $mvn_submodules; do
73-
# Each entry = <folder>/<submodule>
74-
submodules_array+=("$1/${submodule}");
75-
done
109+
if [ -f "$1/pom.xml" ]; then
110+
local modules
111+
112+
# Use pure Bash extraction to find the modules in the aggregator pom file.
113+
# Faster than invoking mvn help:evaluate to list all the project modules,
114+
# cleanly ignores optional <profiles>, and gracefully skips flat POMs.
115+
modules=$(extract_pom_modules "$1/pom.xml")
116+
if [ -n "$modules" ]; then
117+
for submodule in $modules; do
118+
# Each entry = <folder>/<submodule>
119+
submodules_array+=("$1/${submodule}")
120+
done
121+
else
122+
# If this module contains no submodules, select the module itself.
123+
submodules_array+=("$1")
124+
fi
76125
else
77-
# If this module contains no submodules, select the module itself.
78-
submodules_array+=("$1");
126+
echo "Module does not have a pom.xml file: $1"
127+
exit 1
79128
fi
80129

81130
# Convert from array to comma-delimited string
@@ -216,6 +265,25 @@ function generate_modified_modules_list() {
216265
fi
217266
}
218267

268+
# Filters the modified_module_list to only include modules that contain
269+
# integration test files (matching IT*.java or *IT.java in src/test/java).
270+
# Not all modules will have ITs written and there is not need to test
271+
# modules without ITs.
272+
function filter_modules_with_integration_tests() {
273+
filtered_it_module_list=()
274+
for module in "${modified_module_list[@]}"; do
275+
# 1. Search for files in the Java test directory (*/src/test/java/*)
276+
# 2. Filter for ITs that match the typical file name (IT prefix or suffix)
277+
# 3. Stop searching when a single file match has been found
278+
if find "$module" -path '*/src/test/java/*' \( -name 'IT*.java' -o -name '*IT.java' \) -print -quit 2>/dev/null | grep -q .; then
279+
filtered_it_module_list+=("$module")
280+
fi
281+
done
282+
printf "Modules with integration tests:\n"
283+
printf " %s\n" "${filtered_it_module_list[@]}"
284+
echo "Found ${#filtered_it_module_list[@]} modules with integration tests (out of ${#modified_module_list[@]} modified modules)"
285+
}
286+
219287
function run_integration_tests() {
220288
printf "Running integration tests for modules:\n%s\n" "$1"
221289
parse_all_submodules "$1"

generation_config.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
gapic_generator_version: 2.67.0
2-
googleapis_commitish: c662840a94dbdf708caa44893a2d49119cdd391c
2+
googleapis_commitish: c83d354f79b02e3dc98f22248e22851fcf9b961d
33
libraries_bom_version: 26.76.0
44
libraries:
55
- api_shortname: accessapproval

java-aiplatform/README.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -42,20 +42,20 @@ If you are using Maven without the BOM, add this to your dependencies:
4242
<dependency>
4343
<groupId>com.google.cloud</groupId>
4444
<artifactId>google-cloud-aiplatform</artifactId>
45-
<version>3.86.0</version>
45+
<version>3.87.0</version>
4646
</dependency>
4747
```
4848

4949
If you are using Gradle without BOM, add this to your dependencies:
5050

5151
```Groovy
52-
implementation 'com.google.cloud:google-cloud-aiplatform:3.86.0'
52+
implementation 'com.google.cloud:google-cloud-aiplatform:3.87.0'
5353
```
5454

5555
If you are using SBT, add this to your dependencies:
5656

5757
```Scala
58-
libraryDependencies += "com.google.cloud" % "google-cloud-aiplatform" % "3.86.0"
58+
libraryDependencies += "com.google.cloud" % "google-cloud-aiplatform" % "3.87.0"
5959
```
6060

6161
## Authentication
@@ -175,7 +175,7 @@ Java is a registered trademark of Oracle and/or its affiliates.
175175
[javadocs]: https://cloud.google.com/java/docs/reference/google-cloud-aiplatform/latest/overview
176176
[stability-image]: https://img.shields.io/badge/stability-stable-green
177177
[maven-version-image]: https://img.shields.io/maven-central/v/com.google.cloud/google-cloud-aiplatform.svg
178-
[maven-version-link]: https://central.sonatype.com/artifact/com.google.cloud/google-cloud-aiplatform/3.86.0
178+
[maven-version-link]: https://central.sonatype.com/artifact/com.google.cloud/google-cloud-aiplatform/3.87.0
179179
[authentication]: https://github.com/googleapis/google-cloud-java#authentication
180180
[auth-scopes]: https://developers.google.com/identity/protocols/oauth2/scopes
181181
[predefined-iam-roles]: https://cloud.google.com/iam/docs/understanding-roles#predefined_roles

0 commit comments

Comments
 (0)