[Java / Python | gRPC] University project
-
Download core from here.
-
Put project files into extracted
grpc-java-*/examples/src/main
:- in
/proto
pasteHospital.proto
file, - in
/java/someJavaPackage
paste Java files.
- in
-
cd ../../..
- go upper to examples directory. -
Add dependencies to
build.gradle
(in grpc-java-*/examples):... task mainServer(type: CreateStartScripts) { mainClassName = 'someJavaPackage.MainServer' applicationName = 'main-server' outputDir = new File(project.buildDir, 'tmp') classpath = jar.outputs.files + project.configurations.runtime } applicationDistribution.into('bin') { ... from(mainServer) }
-
Generate grpc classes from
Hospital.proto
:./gradlew installDist
and./gradlew dependencies
(still in grpc-java-*/examples). -
Run our app via bash (in grpc-java-*/examples.):
./build/install/examples/bin/main-server
. -
Upper commands can be further re-run via
gen_java.sh
.
-
Ensure
Hospital.proto
is located in home project directory (or uncomment lines ingen_python.sh
ifHospital.proto
is moved togrpc-java-*/examples/src/main/proto
). -
Run
./gen_python.sh
. -
Ensure generated grpc python files (
Hospital_pb2.py
andHospital_pb2_grpc.py
) are located in/python
directory.
Directories: /gen
, /java
and /python
should be marked as a source directories.