-
Notifications
You must be signed in to change notification settings - Fork 25
Expand file tree
/
Copy pathgenerateprotos.sh
More file actions
executable file
·53 lines (48 loc) · 1.54 KB
/
generateprotos.sh
File metadata and controls
executable file
·53 lines (48 loc) · 1.54 KB
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
#!/bin/bash
# Uses protoc and the gRPC plugin in tools to generate
# all the protos we use:
#
# - protoc compiler plugin
# - Generator config protos (e.g. service config, snippets)
# - GAPIC ShowCase
# Cross-platform tools
case "$OSTYPE" in
win* | msys* | cygwin*)
protoc_executable="tools/protoc.exe" # default to Windows
grpc_csharp_executable="tools/grpc_csharp_plugin.exe" # default to Windows
;;
linux*)
protoc_executable="tools/protoc"
grpc_csharp_executable="tools/grpc_csharp_plugin"
;;
darwin*)
protoc_executable="tools/protoc_macosx_x64"
grpc_csharp_executable="tools/grpc_csharp_plugin_macosx_x64"
chmod +x tools/protoc_macosx_x64
chmod +x tools/grpc_csharp_plugin_macosx_x64
;;
*)
echo "Unknown OSTYPE: $OSTYPE"
exit 1
esac
# Generator config protos
echo "Generating generator config protos"
"$protoc_executable" \
--csharp_out=Google.Api.Generator/ConfigProtos \
-Itools/protos \
-Igoogleapis \
-IGoogle.Api.Generator/ConfigProtos \
Google.Api.Generator/ConfigProtos/*.proto
# GAPIC Showcase
echo "Generating GAPIC Showcase"
"$protoc_executable" \
--csharp_out=Google.Api.Generator.Tests/ProtoTests/Showcase \
--csharp_opt=file_extension=.g.cs \
--plugin=protoc-gen-grpc="$grpc_csharp_executable" \
--grpc_out=Google.Api.Generator.Tests/ProtoTests/Showcase \
--grpc_opt=file_suffix=Grpc.g.cs \
-Itools/protos \
-Igoogleapis \
-IGoogle.Api.Generator.Tests/ProtoTests/Showcase \
Google.Api.Generator.Tests/ProtoTests/Showcase/google/showcase/v1beta1/*.proto
echo "Done"