forked from googleapis/google-cloud-dotnet
-
Notifications
You must be signed in to change notification settings - Fork 2
/
generateapis.sh
executable file
·51 lines (40 loc) · 1.09 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
#!/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
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
dotnet run --project tools/Google.Cloud.Tools.ReleaseManager -- generate-apis $*