From da89672a411c5e7471aa6e4ebd17f4e2f4e90f33 Mon Sep 17 00:00:00 2001 From: Erwin Tumbul <erwin.tumbul@student.tugraz.at> Date: Fri, 27 May 2022 15:43:03 +0200 Subject: [PATCH] Include grpc netcode generation into gradle build chain. --- client/android/Notifier/app/build.gradle | 36 ++++++++++++++++++++++++ shared/netcode.proto | 6 ++++ 2 files changed, 42 insertions(+) diff --git a/client/android/Notifier/app/build.gradle b/client/android/Notifier/app/build.gradle index 292b1ab..53af7d2 100644 --- a/client/android/Notifier/app/build.gradle +++ b/client/android/Notifier/app/build.gradle @@ -1,5 +1,6 @@ plugins { id 'com.android.application' + id 'com.google.protobuf' version '0.8.17' } android { @@ -25,8 +26,38 @@ android { sourceCompatibility JavaVersion.VERSION_1_8 targetCompatibility JavaVersion.VERSION_1_8 } + + sourceSets { + main { + proto { + srcDirs "../../../../shared" + } + } + } +} + +protobuf { + protoc { + artifact = "com.google.protobuf:protoc:3.19.2" + } + plugins { + grpc { + artifact = 'io.grpc:protoc-gen-grpc-java:1.45.1' + } + } + generateProtoTasks { + all().each { task -> + task.builtins { + java { option 'lite' } + } + task.plugins { + grpc { option 'lite' } + } + } + } } + dependencies { implementation "androidx.core:core:1.7.0" @@ -36,4 +67,9 @@ dependencies { testImplementation 'junit:junit:4.13.2' androidTestImplementation 'androidx.test.ext:junit:1.1.3' androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0' + + implementation 'io.grpc:grpc-okhttp:1.45.1' + implementation 'io.grpc:grpc-protobuf-lite:1.45.1' + implementation 'io.grpc:grpc-stub:1.45.1' + compileOnly 'org.apache.tomcat:annotations-api:6.0.53' // necessary for Java 9+ } \ No newline at end of file diff --git a/shared/netcode.proto b/shared/netcode.proto index efb2582..542ada6 100644 --- a/shared/netcode.proto +++ b/shared/netcode.proto @@ -1,4 +1,10 @@ syntax = "proto3"; + +option java_multiple_files = true; +option java_package = "io.grpc.notifier"; +option java_outer_classname = "NotifierComProto"; +option objc_class_prefix = "NC"; + package netcode; service NotifierCom { -- GitLab