Skip to content

Commit 6d03337

Browse files
authored
chore: migrate java-datastore to monorepo
chore: migrate java-datastore to monorepo
2 parents 2be059a + f919796 commit 6d03337

File tree

458 files changed

+179957
-0
lines changed

Some content is hidden

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

458 files changed

+179957
-0
lines changed
Lines changed: 147 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,147 @@
1+
# Copyright 2022 Google LLC
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# http://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
# Github action job to test core java library features on
15+
# downstream client libraries before they are released.
16+
on:
17+
push:
18+
branches:
19+
- main
20+
pull_request:
21+
name: java-datastore ci
22+
env:
23+
BUILD_SUBDIR: java-datastore
24+
jobs:
25+
filter:
26+
runs-on: ubuntu-latest
27+
outputs:
28+
library: ${{ steps.filter.outputs.library }}
29+
steps:
30+
- uses: actions/checkout@v4
31+
- uses: dorny/paths-filter@v3
32+
id: filter
33+
with:
34+
filters: |
35+
library:
36+
- 'java-datastore/**'
37+
units:
38+
needs: filter
39+
if: ${{ needs.filter.outputs.library == 'true' }}
40+
runs-on: ubuntu-latest
41+
strategy:
42+
fail-fast: false
43+
matrix:
44+
java: [11, 17, 21, 25]
45+
steps:
46+
- uses: actions/checkout@v4
47+
- uses: actions/setup-java@v4
48+
with:
49+
distribution: temurin
50+
java-version: ${{matrix.java}}
51+
- run: java -version
52+
- run: .kokoro/build.sh
53+
env:
54+
JOB_TYPE: test
55+
units-java8:
56+
needs: filter
57+
if: ${{ needs.filter.outputs.library == 'true' }}
58+
# Building using Java 17 and run the tests with Java 8 runtime
59+
name: "units (8)"
60+
runs-on: ubuntu-latest
61+
steps:
62+
- uses: actions/checkout@v4
63+
- uses: actions/setup-java@v4
64+
with:
65+
java-version: 8
66+
distribution: temurin
67+
- name: "Set jvm system property environment variable for surefire plugin (unit tests)"
68+
# Maven surefire plugin (unit tests) allows us to specify JVM to run the tests.
69+
# https://maven.apache.org/surefire/maven-surefire-plugin/test-mojo.html#jvm
70+
run: echo "SUREFIRE_JVM_OPT=-Djvm=${JAVA_HOME}/bin/java -P !java17" >> $GITHUB_ENV
71+
shell: bash
72+
- uses: actions/setup-java@v4
73+
with:
74+
java-version: 17
75+
distribution: temurin
76+
- run: .kokoro/build.sh
77+
env:
78+
JOB_TYPE: test
79+
windows:
80+
needs: filter
81+
if: ${{ needs.filter.outputs.library == 'true' }}
82+
# Building using Java 11 and run the tests with Java 8 runtime
83+
runs-on: windows-latest
84+
steps:
85+
- name: Support longpaths
86+
run: git config --system core.longpaths true
87+
- name: Support longpaths
88+
run: git config --system core.longpaths true
89+
- uses: actions/checkout@v4
90+
- uses: actions/setup-java@v4
91+
with:
92+
java-version: 8
93+
distribution: temurin
94+
- name: "Set jvm system property environment variable for surefire plugin (unit tests)"
95+
run: echo "SUREFIRE_JVM_OPT=-Djvm=${JAVA_HOME}\bin\java -P !java17" >> $GITHUB_ENV
96+
shell: bash
97+
- uses: actions/setup-java@v4
98+
with:
99+
distribution: temurin
100+
java-version: 11
101+
- run: java -version
102+
- run: .kokoro/build.sh
103+
env:
104+
JOB_TYPE: test
105+
dependencies:
106+
needs: filter
107+
if: ${{ needs.filter.outputs.library == 'true' }}
108+
runs-on: ubuntu-latest
109+
strategy:
110+
matrix:
111+
java: [17]
112+
steps:
113+
- uses: actions/checkout@v4
114+
- uses: actions/setup-java@v4
115+
with:
116+
distribution: temurin
117+
java-version: ${{matrix.java}}
118+
- run: java -version
119+
- run: .kokoro/dependencies.sh
120+
javadoc:
121+
needs: filter
122+
if: ${{ needs.filter.outputs.library == 'true' }}
123+
runs-on: ubuntu-latest
124+
steps:
125+
- uses: actions/checkout@v4
126+
- uses: actions/setup-java@v4
127+
with:
128+
distribution: temurin
129+
java-version: 17
130+
- run: java -version
131+
- run: .kokoro/build.sh
132+
env:
133+
JOB_TYPE: javadoc
134+
lint:
135+
needs: filter
136+
if: ${{ needs.filter.outputs.library == 'true' }}
137+
runs-on: ubuntu-latest
138+
steps:
139+
- uses: actions/checkout@v4
140+
- uses: actions/setup-java@v4
141+
with:
142+
distribution: temurin
143+
java-version: 17
144+
- run: java -version
145+
- run: .kokoro/build.sh
146+
env:
147+
JOB_TYPE: lint

.kokoro/build.sh

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,21 @@ case ${JOB_TYPE} in
9494
install_modules "${BUILD_SUBDIR}"
9595
echo "Running in subdir: ${BUILD_SUBDIR}"
9696
pushd "${BUILD_SUBDIR}"
97+
98+
if [[ "${BUILD_SUBDIR}" == "java-datastore" ]]; then
99+
# Kokoro integration tests use both JDK 11 and JDK 8. Integration
100+
# tests require JDK 11 export as JAVA env variable to run cloud datastore
101+
# emulator (https://cloud.google.com/sdk/docs/release-notes#39300_2022-07-12).
102+
# For Java 8 environment, we will still run the tests using Java 8 with
103+
# SUREFIRE_JVM_OPT for Maven surefire plugin:
104+
# https://maven.apache.org/surefire/maven-surefire-plugin/test-mojo.html#jvm
105+
if [[ -n "${JAVA11_HOME}" && -n "${JAVA8_HOME}" ]]
106+
then
107+
export JAVA=${JAVA11_HOME}/bin/java
108+
export SUREFIRE_JVM_OPT=-Djvm=${JAVA8_HOME}/bin/java
109+
fi
110+
fi
111+
97112
echo "SUREFIRE_JVM_OPT: ${SUREFIRE_JVM_OPT}"
98113
echo "INTEGRATION_TEST_ARGS: ${INTEGRATION_TEST_ARGS}"
99114
mvn verify -Penable-integration-tests \

.kokoro/common.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ excluded_modules=(
2020
'java-vertexai'
2121
'java-logging'
2222
'java-bigquerystorage'
23+
'java-datastore'
2324
)
2425

2526
function retry_with_backoff {
Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
# Format: //devtools/kokoro/config/proto/build.proto
2+
3+
# Configure the docker image for kokoro-trampoline.
4+
env_vars: {
5+
key: "TRAMPOLINE_IMAGE"
6+
value: "gcr.io/cloud-devrel-public-resources/graalvm_sdk_platform_a:3.56.0" # {x-version-update:google-cloud-shared-dependencies:current}
7+
}
8+
9+
env_vars: {
10+
key: "JOB_TYPE"
11+
value: "graalvm-single"
12+
}
13+
14+
# TODO: remove this after we've migrated all tests and scripts
15+
env_vars: {
16+
key: "GCLOUD_PROJECT"
17+
value: "gcloud-devel"
18+
}
19+
20+
env_vars: {
21+
key: "GOOGLE_CLOUD_PROJECT"
22+
value: "gcloud-devel"
23+
}
24+
25+
env_vars: {
26+
key: "GOOGLE_APPLICATION_CREDENTIALS"
27+
value: "secret_manager/java-it-service-account"
28+
}
29+
30+
env_vars: {
31+
key: "SECRET_MANAGER_KEYS"
32+
value: "java-it-service-account"
33+
}
34+
35+
env_vars: {
36+
key: "IT_SERVICE_ACCOUNT_EMAIL"
37+
value: "it-service-account@gcloud-devel.iam.gserviceaccount.com"
38+
}
39+
40+
env_vars: {
41+
key: "BUILD_SUBDIR"
42+
value: "java-datastore"
43+
}
44+
45+
env_vars: {
46+
key: "DATASTORE_PROJECT_ID"
47+
value: "gcloud-devel"
48+
}
Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
# Format: //devtools/kokoro/config/proto/build.proto
2+
3+
# Configure the docker image for kokoro-trampoline.
4+
env_vars: {
5+
key: "TRAMPOLINE_IMAGE"
6+
value: "gcr.io/cloud-devrel-kokoro-resources/java8"
7+
}
8+
9+
env_vars: {
10+
key: "JOB_TYPE"
11+
value: "integration-single"
12+
}
13+
14+
# TODO: remove this after we've migrated all tests and scripts
15+
env_vars: {
16+
key: "GCLOUD_PROJECT"
17+
value: "gcloud-devel"
18+
}
19+
20+
env_vars: {
21+
key: "GOOGLE_CLOUD_PROJECT"
22+
value: "gcloud-devel"
23+
}
24+
25+
env_vars: {
26+
key: "DATASTORE_PROJECT_ID"
27+
value: "gcloud-devel"
28+
}
29+
30+
env_vars: {
31+
key: "GOOGLE_APPLICATION_CREDENTIALS"
32+
value: "secret_manager/java-it-service-account"
33+
}
34+
35+
env_vars: {
36+
key: "SECRET_MANAGER_KEYS"
37+
value: "java-it-service-account"
38+
}
39+
40+
env_vars: {
41+
key: "BUILD_SUBDIR"
42+
value: "java-datastore"
43+
}
44+
45+
env_vars: {
46+
key: "DATASTORE_PROJECT_ID"
47+
value: "gcloud-devel"
48+
}

gapic-libraries-bom/pom.xml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -518,6 +518,13 @@
518518
<type>pom</type>
519519
<scope>import</scope>
520520
</dependency>
521+
<dependency>
522+
<groupId>com.google.cloud</groupId>
523+
<artifactId>google-cloud-datastore-bom</artifactId>
524+
<version>2.34.1-SNAPSHOT</version><!-- {x-version-update:google-cloud-datastore:current} -->
525+
<type>pom</type>
526+
<scope>import</scope>
527+
</dependency>
521528
<dependency>
522529
<groupId>com.google.cloud</groupId>
523530
<artifactId>google-cloud-datastream-bom</artifactId>

generation/check_non_release_please_versions.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ for pomFile in $(find . -mindepth 2 -name pom.xml | sort ); do
99
[[ "${pomFile}" =~ .*CoverageAggregator.* ]] || \
1010
[[ "${pomFile}" =~ .*java-shared-dependencies*. ]] || \
1111
[[ "${pomFile}" =~ .*java-bigquerystorage.* ]] || \
12+
[[ "${pomFile}" =~ .*java-datastore.* ]] || \
1213
[[ "${pomFile}" =~ .*.github*. ]]; then
1314
continue
1415
fi

generation_config.yaml

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -852,6 +852,27 @@ libraries:
852852
- proto_path: google/cloud/metastore/v1
853853
- proto_path: google/cloud/metastore/v1alpha
854854
- proto_path: google/cloud/metastore/v1beta
855+
- api_shortname: datastore
856+
name_pretty: Cloud Datastore
857+
product_documentation: https://cloud.google.com/datastore
858+
client_documentation: https://cloud.google.com/java/docs/reference/google-cloud-datastore/latest/history
859+
issue_tracker: https://issuetracker.google.com/savedsearches/559768
860+
release_level: stable
861+
language: java
862+
distribution_name: com.google.cloud:google-cloud-datastore
863+
api_id: datastore.googleapis.com
864+
library_type: GAPIC_COMBO
865+
api_description: is a fully managed, schemaless database for\nstoring non-relational
866+
data. Cloud Datastore automatically scales with\nyour users and supports ACID
867+
transactions, high availability of reads and\nwrites, strong consistency for reads
868+
and ancestor queries, and eventual\nconsistency for all other queries.
869+
excluded_dependencies: grpc-google-cloud-datastore-v1
870+
extra_versioned_modules: datastore-v1-proto-client
871+
excluded_poms: grpc-google-cloud-datastore-v1
872+
recommended_package: com.google.cloud.datastore
873+
GAPICs:
874+
- proto_path: google/datastore/v1
875+
- proto_path: google/datastore/admin/v1
855876
- api_shortname: datastream
856877
name_pretty: Datastream
857878
product_documentation: https://cloud.google.com/datastream/docs
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
# Copyright 2021 Google LLC
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# http://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
15+
deep-remove-regex:
16+
- /java-datastore/proto-google-.*/src
17+
deep-preserve-regex:
18+
- /java-datastore/google-.*/src/test/java/com/google/cloud/.*/v.*/it/IT.*Test.java
19+
deep-copy-regex:
20+
- source: /google/datastore/(v.*)/.*-java/proto-google-.*/src
21+
dest: /owl-bot-staging/java-datastore/$1/proto-google-cloud-datastore-$1/src
22+
- source: /google/datastore/admin/(v.*)/.*-java/proto-google-.*/src
23+
dest: /owl-bot-staging/java-datastore/$1/proto-google-cloud-datastore-admin-$1/src
24+
- source: /google/datastore/(v.*)/.*-java/grpc-google-.*/src
25+
dest: /owl-bot-staging/java-datastore/$1/grpc-google-cloud-datastore-$1/src
26+
- source: /google/datastore/admin/(v.*)/.*-java/grpc-google-.*/src
27+
dest: /owl-bot-staging/java-datastore/$1/grpc-google-cloud-datastore-admin-$1/src
28+
- source: /google/datastore/(v.*)/.*-java/gapic-google-.*/src
29+
dest: /owl-bot-staging/java-datastore/$1/google-cloud-datastore/src
30+
- source: /google/datastore/admin/(v.*)/.*-java/gapic-google-.*/src
31+
dest: /owl-bot-staging/java-datastore/$1/google-cloud-datastore/src
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
steps:
2+
- name: gcr.io/cloud-devrel-public-resources/java11
3+
entrypoint: ls
4+
args: [
5+
'-alt',
6+
]
7+
- name: gcr.io/cloud-devrel-public-resources/java11
8+
entrypoint: curl
9+
args: [
10+
'--header',
11+
'Metadata-Flavor: Google',
12+
'http://metadata.google.internal/computeMetadata/v1/instance/service-accounts/default/email'
13+
]
14+
- name: gcr.io/cloud-devrel-public-resources/java11
15+
entrypoint: pwd
16+
- name: gcr.io/cloud-devrel-public-resources/java11
17+
entrypoint: bash
18+
args: [
19+
'.kokoro/build.sh'
20+
]
21+
env:
22+
- 'JOB_TYPE=samples'
23+
- 'GOOGLE_CLOUD_PROJECT=cloud-java-ci-sample'
24+
- 'KOKORO_GITHUB_PULL_REQUEST_NUMBER=$_PR_NUMBER'
25+
- name: gcr.io/cloud-devrel-public-resources/java11
26+
entrypoint: echo
27+
args: [
28+
'Sample job succeeded',
29+
]
30+
timeout: 3600s
31+
options:
32+
defaultLogsBucketBehavior: REGIONAL_USER_OWNED_BUCKET

0 commit comments

Comments
 (0)