Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
gitpod-io
GitHub Repository: gitpod-io/gitpod
Path: blob/main/components/supervisor-api/generate-java.sh
2492 views
1
#!/bin/bash
2
# Copyright (c) 2022 Gitpod GmbH. All rights reserved.
3
# Licensed under the GNU Affero General Public License (AGPL).
4
# See License.AGPL.txt in the project root for license information.
5
6
# replace Java reserved keywords
7
sed -i 's/private = 0;/private_visibility = 0;/g' status.proto
8
sed -i 's/public = 1;/public_visibility = 1;/g' status.proto
9
10
PROTOC_GEN_GRPC_JAVA_PATH=/tmp/protoc-gen-grpc-java
11
12
if [ ! -f $PROTOC_GEN_GRPC_JAVA_PATH ]; then
13
curl -sSo $PROTOC_GEN_GRPC_JAVA_PATH https://repo1.maven.org/maven2/io/grpc/protoc-gen-grpc-java/1.49.0/protoc-gen-grpc-java-1.49.0-linux-x86_64.exe
14
chmod +x $PROTOC_GEN_GRPC_JAVA_PATH
15
fi
16
17
OUT_DIR=java/src/main/java/
18
19
mkdir -p $OUT_DIR
20
21
protoc \
22
-I. -Ithird_party \
23
--plugin=protoc-gen-grpc-java=$PROTOC_GEN_GRPC_JAVA_PATH \
24
--grpc-java_out=$OUT_DIR \
25
--java_out=$OUT_DIR \
26
./*.proto
27
28
# revert Java reserved keywords
29
sed -i 's/private_visibility = 0;/private = 0;/g' status.proto
30
sed -i 's/public_visibility = 1;/public = 1;/g' status.proto
31
32