forked from AS-BIG-FEMALE/Docker.md
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathuniffi
65 lines (57 loc) · 2.71 KB
/
uniffi
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
#!/bin/bash
# This scripts downloads google-cloud-java repo, loop through modules with names starting "java-",
# grabs artifactId from pom.xml file within submodule name starting with "google-", and
# service name from *StubSettings.java file.
# Run this script from repo root dir
# input: N/A
# output: txt file with comma separated artifact_id, service_name.
git clone https://github.com/googleapis/google-cloud-java.git
cd ./google-cloud-java || exit
filename="../artifacts_to_services.txt"
for module in $(find . -mindepth 2 -maxdepth 2 -name pom.xml | sort | xargs dirname); do
echo "module: ${module}"
# Only modules starting with java- contain client library artifacts.
if [[ ${module} != ./java-* ]]; then
echo "not a client library, continue..."
continue
fi
# special cases, add manually later.
if [[ ${module} == ./java-dns ]] || [[ ${module} == ./java-grafeas ]] || [[ ${module} == ./java-notification ]] || [[ ${module} == ./java-alloydb-connectors ]]; then
continue
fi
cd "${module}" || exit
# Find submodule with name starting with "google-", this is to exclude proto, grpc and bom folders,
# and locate artifact id of client library
folder=$(find . -mindepth 1 -maxdepth 1 -type d -name "google-*" ! -name "*-bom" )
echo "folder: ${folder}"
cd "${folder}" || continue
artifact_id_string=$(find . -name 'pom.xml' -print -quit | xargs grep -m 1 '<artifactId>' | cut -d '>' -f 2 | cut -d '<' -f 1)
echo "artifact_id_string: ${artifact_id_string}"
cd .. # exist from folder ${folder}
# Find *StubSettings file, get the first line containing '.googleapis.com:443'
# Extract service name from it
string=$(find . -name '*StubSettings.java' -print -quit | xargs grep -m 1 '.googleapis.com:443')
service_name=$(echo "${string}" | grep -o '".*"' | tr -d '"' | cut -d "." -f 1 | cut -d "-" -f 1)
echo "service name: ${service_name}"
echo "${artifact_id_string}, ${service_name}" >> "$filename"
cd .. # exit from ${module}
done
# add handwritten libraries manually.
{
echo "google-cloud-bigquery, bigquery"
echo "google-cloud-bigtable, bigtable"
echo "google-cloud-bigquerystorage, bigquerystorage"
echo "google-cloud-datastore, datastore"
echo "google-cloud-firestore, firestore"
echo "google-cloud-logging, logging"
echo "google-cloud-pubsub, pubsub"
echo "google-cloud-pubsublite, pubsublite"
echo "google-cloud-storage, bigstore"
echo "google-cloud-storage-control, storage"
echo "google-cloud-spanner, spanner"
echo "google-cloud-dns, dns"
} >> "./artifacts_to_services.txt"
cd ..
mv ./google-cloud-java/artifacts_to_services.txt ./libraries-release-data/artifacts_to_services.txt
# clean up
rm -rf google-cloud-java/