forked from leancodepl/patrol
-
Notifications
You must be signed in to change notification settings - Fork 0
/
gen_protobufs
executable file
·48 lines (40 loc) · 1.21 KB
/
gen_protobufs
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
#!/usr/bin/env bash
set -euo pipefail
# gen_protobufs generates Protocol Buffers classes for every used language
# (Dart, Swift, Kotlin/Java) in the appropriate directory.
#
# To use it, you need to have the following programs in your $PATH:
#
# * protoc
#
# * Dart plugin (https://pub.dev/packages/protoc_plugin)
#
# * Swift plugin (https://github.com/apple/swift-protobuf)
#
# * Java plugin (https://github.com/grpc/grpc-java)
#
# * Kotlin plugin (https://github.com/grpc/grpc-kotlin/tree/master/compiler)
cd "$(dirname "$0")" || exit
SRC_DIR="."
PROTO_PATH="./contracts.proto"
mkdir -p ./patrol/packages/patrol/android/src/main/kotlin
mkdir -p ./packages/patrol/ios/Classes/AutomatorServer
dart_out="./packages/patrol/lib/src/native/contracts"
java_out="packages/patrol/android/src/main/kotlin"
kotlin_out="$java_out"
swift_out="./packages/patrol/ios/Classes/AutomatorServer"
protoc \
--dart_out="grpc:$dart_out" \
-I="$SRC_DIR" \
"$PROTO_PATH"
protoc \
--java_out="lite:$java_out" \
--kotlin_out="lite:$kotlin_out" \
--grpc-java_out="lite:$java_out" \
--grpckt_out="lite:$kotlin_out" \
"$PROTO_PATH"
protoc \
--swift_out="$swift_out" \
--grpc-swift_out="$swift_out" \
--swift_opt=Visibility=Public \
"$PROTO_PATH"