forked from googleapis/google-cloud-dotnet
-
Notifications
You must be signed in to change notification settings - Fork 2
/
generateapis.sh
executable file
·67 lines (54 loc) · 1.44 KB
/
generateapis.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
64
65
66
67
#!/bin/bash
set -e
source toolversions.sh
declare -r CORE_PROTOS_ROOT=$PROTOBUF_TOOLS_ROOT/tools
# This script generates all APIs from the googleapis/googleapis github repository,
# using the code generator from googleapis/gapic-generator-csharp.
# It will fetch both repositories if necessary.
if [[ "$GOOGLEAPIS_DIR" != "" ]]
then
declare -r GOOGLEAPIS="$GOOGLEAPIS_DIR"
else
declare -r GOOGLEAPIS="$PWD/googleapis"
fi
if [[ "$GENERATOR_OUTPUT" != "" ]]
then
declare -r GENERATOR_OUTPUT_DIR="$GENERATOR_OUTPUT"
else
declare -r GENERATOR_OUTPUT_DIR="$PWD"
fi
if [[ "$GENERATOR_INPUT" != "" ]]
then
declare -r GENERATOR_INPUT_DIR="$GENERATOR_INPUT"
else
declare -r GENERATOR_INPUT_DIR="$PWD/generator-input"
fi
fetch_github_repos() {
# We assume that if the directory has been explicitly specified, we don't need
# to fetch it.
if [[ "$GOOGLEAPIS_DIR" != "" ]]
then
return 0
fi
if [ -d "$GOOGLEAPIS" ]
then
git -C $GOOGLEAPIS pull -q
else
git clone https://github.com/googleapis/googleapis $GOOGLEAPIS
fi
}
# Entry point
echo "Preparing tools"
install_protoc
install_microgenerator
install_grpc
fetch_github_repos
# Allow other processes to know where to find repos, binaries etc.
export GOOGLEAPIS
export GRPC_PLUGIN
export PROTOBUF_TOOLS_ROOT
export GAPIC_PLUGIN
export PROTOC
export GENERATOR_OUTPUT_DIR
export GENERATOR_INPUT_DIR
dotnet run --project tools/Google.Cloud.Tools.ReleaseManager -- generate-apis $*