-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathgenerate_java_macOS.sh
More file actions
executable file
·60 lines (48 loc) · 2.23 KB
/
generate_java_macOS.sh
File metadata and controls
executable file
·60 lines (48 loc) · 2.23 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
54
55
56
57
58
59
60
#!/bin/bash
# Define CWD
CURRENT_WORKING_DIRECTORY=$(pwd)
# Define Directories
TMP_DIRECTORY="${CURRENT_WORKING_DIRECTORY}/tmp"
BUILD_DIRECTORY="${CURRENT_WORKING_DIRECTORY}/Build"
SOURCE_DIRECTORY="${CURRENT_WORKING_DIRECTORY}/JVMSource"
JVM_OUT_DIRECTORY="${SOURCE_DIRECTORY}/lib/src/main/java"
OS_HW_VARIANTS=""
# Clean Source Directory First
rm -rf ${SOURCE_DIRECTORY}
mkdir ${SOURCE_DIRECTORY}
# Check for directory exists
if [ ! -d "${TMP_DIRECTORY}" ]; then
mkdir $TMP_DIRECTORY
fi
# Download GRPC-Kotlin
KOTLIN_GRPC_PACKAGE="${TMP_DIRECTORY}/protoc_plugin"
curl -L https://repo1.maven.org/maven2/io/grpc/protoc-gen-grpc-java/1.40.1/protoc-gen-grpc-java-1.40.1-osx-x86_64.exe > $KOTLIN_GRPC_PACKAGE
chmod a+x $KOTLIN_GRPC_PACKAGE
# Setup Gradle Jar Repository
cd ${SOURCE_DIRECTORY}
unzip $CURRENT_WORKING_DIRECTORY/gradle_template.zip
cd ${CURRENT_WORKING_DIRECTORY}
# Execute
PROTOC=$(which protoc)
$PROTOC --plugin=protoc-gen-grpc=$KOTLIN_GRPC_PACKAGE --proto_path=./Protos --java_out=${JVM_OUT_DIRECTORY} --grpc_out=${JVM_OUT_DIRECTORY} CommonCommunication.proto
$PROTOC --plugin=protoc-gen-grpc=$KOTLIN_GRPC_PACKAGE --proto_path=./Protos --java_out=${JVM_OUT_DIRECTORY} --grpc_out=${JVM_OUT_DIRECTORY} AuthenticationService/UserService.proto
$PROTOC --plugin=protoc-gen-grpc=$KOTLIN_GRPC_PACKAGE --proto_path=./Protos --java_out=${JVM_OUT_DIRECTORY} --grpc_out=${JVM_OUT_DIRECTORY} AuthenticationService/CommunicationMessage.proto
$PROTOC --plugin=protoc-gen-grpc=$KOTLIN_GRPC_PACKAGE --proto_path=./Protos --java_out=${JVM_OUT_DIRECTORY} --grpc_out=${JVM_OUT_DIRECTORY} StorageService/FolderService.proto
$PROTOC --plugin=protoc-gen-grpc=$KOTLIN_GRPC_PACKAGE --proto_path=./Protos --java_out=${JVM_OUT_DIRECTORY} --grpc_out=${JVM_OUT_DIRECTORY} StorageService/StorageMessage.proto
# Build Library
cd ${SOURCE_DIRECTORY}
# Publish to Repository
./gradlew clean build publish
buildResult=$?
# If publishing failed, exit now.
if [ $buildResult -ne 0 ]; then
echo "Gradlew exited with ${buildResult}. Exiting Script."
# Cleanup
cd ${CURRENT_WORKING_DIRECTORY}
rm -rf $TMP_DIRECTORY # ${SOURCE_DIRECTORY}
exit $buildResult
fi
./gradlew closeRepository
cd ${CURRENT_WORKING_DIRECTORY}
# Cleanup
rm -rf $TMP_DIRECTORY # ${SOURCE_DIRECTORY}