/
generate_showcase.sh
executable file
·63 lines (57 loc) · 2.24 KB
/
generate_showcase.sh
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
#!/bin/bash
# Generates showcase without post processing (i.e. raw gapic, grpc and proto
# libraries). It will compute the showcase version from
# `sdk-platform-java/showcase/gapic-showcase/pom.xml`. The generator version is
# inferred from versions.txt
set -ex
readonly SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )
lib_gen_scripts_dir="${SCRIPT_DIR}/../../library_generation/"
source "${lib_gen_scripts_dir}/utilities.sh"
readonly perform_cleanup=$1
cd "${SCRIPT_DIR}"
mkdir -p "${SCRIPT_DIR}/output"
# clone gapic-showcase
if [ ! -d schema ]; then
if [ -d gapic-showcase ]; then
rm -rdf gapic-showcase
fi
# looks at sdk-platform-java/showcase/gapic-showcase/pom.xml to extract the
# version of gapic-showcase
# see https://github.com/googleapis/gapic-showcase/releases
showcase_version=$(grep -e '<gapic-showcase.version>' "${SCRIPT_DIR}/../gapic-showcase/pom.xml" | cut -d'>' -f2 | cut -d'<' -f1)
sparse_clone https://github.com/googleapis/gapic-showcase.git "schema/google/showcase/v1beta1" "v${showcase_version}"
cd gapic-showcase
mv schema ../output
cd ..
rm -rdf gapic-showcase
fi
if [ ! -d google ];then
if [ -d googleapis ]; then
rm -rdf googleapis
fi
sparse_clone https://github.com/googleapis/googleapis.git "WORKSPACE google/api google/rpc google/cloud/common_resources.proto google/longrunning google/iam/v1 google/cloud/location google/type"
mv googleapis/google output
rm -rdf googleapis
fi
ggj_version=$(get_version_from_versions_txt ../../versions.txt "gapic-generator-java")
gapic_additional_protos="google/iam/v1/iam_policy.proto google/cloud/location/locations.proto"
rest_numeric_enums="false"
transport="grpc+rest"
include_samples="false"
rm -rdf output/showcase-output
mkdir output/showcase-output
set +e
bash "${SCRIPT_DIR}/../../library_generation/generate_library.sh" \
--proto_path "schema/google/showcase/v1beta1" \
--destination_path "showcase-output" \
--gapic_generator_version "${ggj_version}" \
--gapic_additional_protos "${gapic_additional_protos}" \
--rest_numeric_enums "${rest_numeric_enums}" \
--include_samples "${include_samples}" \
--transport "${transport}"
exit_code=$?
if [ "${exit_code}" -ne 0 ]; then
rm -rdf output
exit "${exit_code}"
fi
set +x