forked from imdavi/ImmVisServerPython
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathgenerate_csharp_libs.sh
More file actions
50 lines (33 loc) · 1.25 KB
/
Copy pathgenerate_csharp_libs.sh
File metadata and controls
50 lines (33 loc) · 1.25 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
#!/bin/bash
SCRIPT_DIR="$( cd "$(dirname "$0")" ; pwd -P )"
ROOT_DIR=$(dirname "$SCRIPT_DIR")
PROTO_DIR=$ROOT_DIR/proto
PROTO_FILE=$PROTO_DIR/immvis.proto
GRPC_VERSION=2.26.0
CSHARP_DIR=$ROOT_DIR/csharp
NUGET_DIR=$CSHARP_DIR/nuget
if hash nuget 2>/dev/null; then
if [ ! -e $CSHARP_DIR ]; then
mkdir $CSHARP_DIR
fi
if [ ! -e $NUGET_DIR ]; then
mkdir $NUGET_DIR
fi
(cd $NUGET_DIR; nuget install Grpc -Version $GRPC_VERSION)
(cd $NUGET_DIR; nuget install Grpc.Tools -Version $GRPC_VERSION)
GRPC_TOOLS_PATH=$NUGET_DIR/Grpc.Tools.$GRPC_VERSION/tools/linux_x86
GRPC_CSHARP_PLUGIN_PATH=$GRPC_TOOLS_PATH/grpc_csharp_plugin
PROTOC_PATH=$GRPC_TOOLS_PATH/protoc
OUTPUT_DIR=$CSHARP_DIR
if [ ! -e $OUTPUT_DIR ]; then
mkdir $OUTPUT_DIR
fi
if [ -e $PROTOC_PATH ]; then
$PROTOC_PATH -I $PROTO_DIR --csharp_out $OUTPUT_DIR --grpc_out $OUTPUT_DIR $PROTO_FILE --plugin=protoc-gen-grpc=$GRPC_CSHARP_PLUGIN_PATH
echo Done! The generated filed are available on $OUTPUT_DIR.
else
echo Coundn\'t find protoc tools, please check if the script ran properly.
fi
else
echo "It seems that nuget is not installed. Please install dotnet core and nuget to run this script."
fi