Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .github/generated-files-bot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ externalManifests:
file: '.github/readme/synth.metadata/synth.metadata'
jsonpath: '$.generatedFiles[*]'
ignoreAuthors:
- 'cloud-java-bot'
- 'renovate-bot'
- 'yoshi-automation'
- 'release-please[bot]'
Expand Down
11 changes: 9 additions & 2 deletions .github/scripts/update_generation_config.sh
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,15 @@ set -e
function get_latest_released_version() {
local group_id=$1
local artifact_id=$2
latest=$(curl -s "https://search.maven.org/solrsearch/select?q=g:${group_id}+AND+a:${artifact_id}&core=gav&rows=500&wt=json" | jq -r '.response.docs[] | select(.v | test("^[0-9]+(\\.[0-9]+)*$")) | .v' | sort -V | tail -n 1)
echo "${latest}"
json_content=$(curl -s "https://search.maven.org/solrsearch/select?q=g:${group_id}+AND+a:${artifact_id}&core=gav&rows=500&wt=json")
latest=$(jq -r '.response.docs[] | select(.v | test("^[0-9]+(\\.[0-9]+)*$")) | .v' <<< "${json_content}" | sort -V | tail -n 1)
if [[ -z "${latest}" ]]; then
echo "The latest version of ${group_id}:${artifact_id} is empty."
echo "The returned json from maven.org is invalid: ${json_content}"
exit 1
else
echo "${latest}"
fi
}

# Update a key to a new value in the generation config.
Expand Down
12 changes: 2 additions & 10 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -59,23 +59,15 @@ jobs:
env:
JOB_TYPE: test
windows:
# Building using Java 11 and run the tests with Java 8 runtime
runs-on: windows-latest
steps:
- name: Support longpaths
run: git config --system core.longpaths true
- uses: actions/checkout@v4
- uses: actions/setup-java@v4
with:
java-version: 8
distribution: temurin
- name: "Set jvm system property environment variable for surefire plugin (unit tests)"
run: echo "SUREFIRE_JVM_OPT=-Djvm=${JAVA_HOME}\bin\java" >> $GITHUB_ENV
shell: bash
- uses: actions/setup-java@v4
with:
distribution: temurin
java-version: 11
java-version: 8
- run: java -version
- run: .kokoro/build.bat
env:
Expand Down Expand Up @@ -112,7 +104,7 @@ jobs:
- uses: actions/setup-java@v4
with:
distribution: temurin
java-version: 11
java-version: 17
- run: java -version
- run: .kokoro/build.sh
env:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/hermetic_library_generation.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ jobs:
with:
fetch-depth: 0
token: ${{ secrets.CLOUD_JAVA_BOT_TOKEN }}
- uses: googleapis/sdk-platform-java/.github/scripts@v2.55.1
- uses: googleapis/sdk-platform-java/.github/scripts@v2.56.0
if: env.SHOULD_RUN == 'true'
with:
base_ref: ${{ github.base_ref }}
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/renovate_config_check.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ on:

jobs:
renovate_bot_config_validation:
runs-on: ubuntu-22.04
runs-on: ubuntu-24.04

steps:
- name: Checkout code
Expand All @@ -16,7 +16,7 @@ jobs:
- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: '20'
node-version: '22'

- name: Install Renovate and Config Validator
run: |
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/samples.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ jobs:
- uses: actions/setup-java@v4
with:
distribution: temurin
java-version: 8
java-version: 17
- name: Run checkstyle
run: mvn -P lint --quiet --batch-mode checkstyle:check
working-directory: samples/snippets
6 changes: 4 additions & 2 deletions .github/workflows/update_generation_config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,14 @@ on:

jobs:
update-generation-config:
runs-on: ubuntu-22.04
runs-on: ubuntu-24.04
env:
# the branch into which the pull request is merged
base_branch: main
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
token: ${{ secrets.CLOUD_JAVA_BOT_TOKEN }}
- name: Update params in generation config to latest
shell: bash
Expand All @@ -36,7 +37,8 @@ jobs:
[ -z "$(git config user.email)" ] && git config --global user.email "[email protected]"
[ -z "$(git config user.name)" ] && git config --global user.name "cloud-java-bot"
bash .github/scripts/update_generation_config.sh \
--base_branch "${base_branch}"\
--base_branch "${base_branch}" \
--repo ${{ github.repository }}
env:
GH_TOKEN: ${{ secrets.CLOUD_JAVA_BOT_TOKEN }}

36 changes: 12 additions & 24 deletions .kokoro/build.sh
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
#!/bin/bash
# Copyright 2019 Google LLC
# Copyright 2025 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
Expand Down Expand Up @@ -42,54 +42,41 @@ if [[ ! -z "${GOOGLE_APPLICATION_CREDENTIALS}" && "${GOOGLE_APPLICATION_CREDENTI
export GOOGLE_APPLICATION_CREDENTIALS=$(realpath ${KOKORO_GFILE_DIR}/${GOOGLE_APPLICATION_CREDENTIALS})
fi


RETURN_CODE=0
set +e

case ${JOB_TYPE} in
test)
echo "SUREFIRE_JVM_OPT: ${SUREFIRE_JVM_OPT}"
mvn test -B -ntp -Dclirr.skip=true -Denforcer.skip=true ${SUREFIRE_JVM_OPT}
mvn test -B -ntp -Dfmt.skip=true -Dclirr.skip=true -Denforcer.skip=true ${SUREFIRE_JVM_OPT}
RETURN_CODE=$?
;;
lint)
mvn com.coveo:fmt-maven-plugin:check -B -ntp
mvn com.spotify.fmt:fmt-maven-plugin:check -B -ntp
RETURN_CODE=$?
;;
javadoc)
mvn javadoc:javadoc javadoc:test-javadoc -B -ntp
mvn javadoc:javadoc javadoc:test-javadoc -B -ntp -Dfmt.skip=true
RETURN_CODE=$?
;;
integration)
# Kokoro integration tests use both JDK 11 and JDK 8. Integration
# tests require JDK 11 export as JAVA env variable to run cloud datastore
# emulator (https://cloud.google.com/sdk/docs/release-notes#39300_2022-07-12).
# For Java 8 environment, we will still run the tests using Java 8 with
# SUREFIRE_JVM_OPT for Maven surefire plugin:
# https://maven.apache.org/surefire/maven-surefire-plugin/test-mojo.html#jvm
if [[ -n "${JAVA11_HOME}" && -n "${JAVA8_HOME}" ]]
then
export JAVA=${JAVA11_HOME}/bin/java
export SUREFIRE_JVM_OPT=-Djvm=${JAVA8_HOME}/bin/java
fi

mvn -B ${INTEGRATION_TEST_ARGS} \
-ntp \
-Penable-integration-tests \
-DtrimStackTrace=false \
-Dclirr.skip=true \
-Denforcer.skip=true \
-Dcheckstyle.skip=true \
-DskipUnitTests=true \
-Dfmt.skip=true \
-fae \
verify
RETURN_CODE=$?
;;
graalvm)
# Run Unit and Integration Tests with Native Image
mvn -B ${INTEGRATION_TEST_ARGS} -ntp -Pnative test
RETURN_CODE=$?
;;
graalvm17)
# Run Unit and Integration Tests with Native Image
mvn -B ${INTEGRATION_TEST_ARGS} -ntp -Pnative test
mvn -B ${INTEGRATION_TEST_ARGS} -ntp -Pnative test -Dfmt.skip=true
RETURN_CODE=$?
;;
samples)
Expand All @@ -113,6 +100,7 @@ samples)
-DtrimStackTrace=false \
-Dclirr.skip=true \
-Denforcer.skip=true \
-Dfmt.skip=true \
-fae \
verify
RETURN_CODE=$?
Expand All @@ -122,7 +110,7 @@ samples)
fi
;;
clirr)
mvn -B -ntp -Denforcer.skip=true clirr:check
mvn -B -ntp -Dfmt.skip=true -Denforcer.skip=true clirr:check
RETURN_CODE=$?
;;
*)
Expand Down
38 changes: 38 additions & 0 deletions .kokoro/presubmit/graalvm-native-a.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
# Format: //devtools/kokoro/config/proto/build.proto

# Configure the docker image for kokoro-trampoline.
env_vars: {
key: "TRAMPOLINE_IMAGE"
value: "gcr.io/cloud-devrel-public-resources/graalvm_sdk_platform_a:3.45.1"
}

env_vars: {
key: "JOB_TYPE"
value: "graalvm"
}

# TODO: remove this after we've migrated all tests and scripts
env_vars: {
key: "GCLOUD_PROJECT"
value: "gcloud-devel"
}

env_vars: {
key: "GOOGLE_CLOUD_PROJECT"
value: "gcloud-devel"
}

env_vars: {
key: "GOOGLE_APPLICATION_CREDENTIALS"
value: "secret_manager/java-it-service-account"
}

env_vars: {
key: "SECRET_MANAGER_KEYS"
value: "java-it-service-account"
}

env_vars: {
key: "IT_SERVICE_ACCOUNT_EMAIL"
value: "[email protected]"
}
38 changes: 38 additions & 0 deletions .kokoro/presubmit/graalvm-native-b.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
# Format: //devtools/kokoro/config/proto/build.proto

# Configure the docker image for kokoro-trampoline.
env_vars: {
key: "TRAMPOLINE_IMAGE"
value: "gcr.io/cloud-devrel-public-resources/graalvm_sdk_platform_b:3.45.1"
}

env_vars: {
key: "JOB_TYPE"
value: "graalvm"
}

# TODO: remove this after we've migrated all tests and scripts
env_vars: {
key: "GCLOUD_PROJECT"
value: "gcloud-devel"
}

env_vars: {
key: "GOOGLE_CLOUD_PROJECT"
value: "gcloud-devel"
}

env_vars: {
key: "GOOGLE_APPLICATION_CREDENTIALS"
value: "secret_manager/java-it-service-account"
}

env_vars: {
key: "SECRET_MANAGER_KEYS"
value: "java-it-service-account"
}

env_vars: {
key: "IT_SERVICE_ACCOUNT_EMAIL"
value: "[email protected]"
}
38 changes: 38 additions & 0 deletions .kokoro/presubmit/graalvm-native-c.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
# Format: //devtools/kokoro/config/proto/build.proto

# Configure the docker image for kokoro-trampoline.
env_vars: {
key: "TRAMPOLINE_IMAGE"
value: "gcr.io/cloud-devrel-public-resources/graalvm_sdk_platform_c:3.45.1"
}

env_vars: {
key: "JOB_TYPE"
value: "graalvm"
}

# TODO: remove this after we've migrated all tests and scripts
env_vars: {
key: "GCLOUD_PROJECT"
value: "gcloud-devel"
}

env_vars: {
key: "GOOGLE_CLOUD_PROJECT"
value: "gcloud-devel"
}

env_vars: {
key: "GOOGLE_APPLICATION_CREDENTIALS"
value: "secret_manager/java-it-service-account"
}

env_vars: {
key: "SECRET_MANAGER_KEYS"
value: "java-it-service-account"
}

env_vars: {
key: "IT_SERVICE_ACCOUNT_EMAIL"
value: "[email protected]"
}
2 changes: 1 addition & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ Code in this repo is formatted with
[google-java-format](https://github.com/google/google-java-format).
To run formatting on your project, you can run:
```
mvn com.coveo:fmt-maven-plugin:format
mvn com.spotify.fmt:fmt-maven-plugin:format
```

[1]: https://cloud.google.com/docs/authentication/getting-started#creating_a_service_account
Expand Down
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ If you are using Maven with [BOM][libraries-bom], add this to your pom.xml file:
<dependency>
<groupId>com.google.cloud</groupId>
<artifactId>libraries-bom</artifactId>
<version>26.56.0</version>
<version>26.59.0</version>
<type>pom</type>
<scope>import</scope>
</dependency>
Expand All @@ -41,15 +41,15 @@ If you are using Maven without the BOM, add this to your dependencies:
<dependency>
<groupId>com.google.cloud</groupId>
<artifactId>google-cloud-datastore</artifactId>
<version>2.26.4</version>
<version>2.27.0</version>
</dependency>

```

If you are using Gradle 5.x or later, add this to your dependencies:

```Groovy
implementation platform('com.google.cloud:libraries-bom:26.57.0')
implementation platform('com.google.cloud:libraries-bom:26.59.0')

implementation 'com.google.cloud:google-cloud-datastore'
```
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -262,6 +262,7 @@ public synchronized File getProjectDirectory() {
static class StartupMonitor extends Thread {
private final InputStream inputStream;
private volatile boolean success = false;

/** This latch will reach 0 once server startup has completed. */
private final CountDownLatch startupCompleteLatch = new CountDownLatch(1);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,16 @@ public DatastoreException(String methodName, Code code, String message, Throwabl
this.code = code;
}

/** @return the canonical error code */
/**
* @return the canonical error code
*/
public Code getCode() {
return code;
}

/** @return the datastore method name */
/**
* @return the datastore method name
*/
public String getMethodName() {
return methodName;
}
Expand Down
Loading
Loading