Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[build] Add protobuf compiler plugin and required dependencies for generating gRPC Java stubs #462

Merged
merged 7 commits into from
Jun 6, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 12 additions & 2 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ plugins {
id 'com.form.diff-coverage' version '0.9.5' apply false
id 'me.champeau.jmh' version '0.6.7' apply false
id 'io.github.lhotari.gradle-nar-plugin' version '0.5.1' apply false

id 'com.google.protobuf' version '0.9.1'
}

apply from: "$rootDir/gradle/helper/git.gradle"
Expand Down Expand Up @@ -45,6 +47,9 @@ def log4j2Version = '2.17.1'
def pegasusVersion = '29.31.0'
def jacksonVersion = '2.13.3'

def grpcVersion = '1.54.1'
def protobufVersion = '3.21.7'

ext.libraries = [
avro: 'org.apache.avro:avro:' + avroVersion,
avroCompiler: 'org.apache.avro:avro-compiler:' + avroVersion,
Expand Down Expand Up @@ -114,7 +119,13 @@ ext.libraries = [
xerces: 'xerces:xercesImpl:2.9.1',
zkclient: 'com.101tec:zkclient:0.7', // For Kafka AdminUtils
zookeeper: 'org.apache.zookeeper:zookeeper:3.5.9',
zstd: 'com.github.luben:zstd-jni:1.5.2-3'
zstd: 'com.github.luben:zstd-jni:1.5.2-3',

grpcNettyShaded: 'io.grpc:grpc-netty-shaded:' + grpcVersion,
grpcProtobuf: 'io.grpc:grpc-protobuf:' + grpcVersion,
grpcStub: 'io.grpc:grpc-stub:' + grpcVersion,
tomcatAnnotations: 'org.apache.tomcat:annotations-api:6.0.53',
adamxchen marked this conversation as resolved.
Show resolved Hide resolved
guava: 'com.google.guava:guava:30.1-jre'
rkunds marked this conversation as resolved.
Show resolved Hide resolved
]

group = 'com.linkedin.venice'
Expand Down Expand Up @@ -201,7 +212,6 @@ subprojects {
}
compileOnly {
// These dependencies are transitively used at runtime, so we cannot exclude them further than compileOnly
exclude group: 'com.google.guava'
rkunds marked this conversation as resolved.
Show resolved Hide resolved
exclude group: 'com.typesafe.scala-logging'
exclude group: 'log4j'
exclude group: 'org.slf4j'
Expand Down
26 changes: 26 additions & 0 deletions services/venice-server/build.gradle
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
plugins {
id 'application'
id 'com.github.johnrengelman.shadow'
id 'com.google.protobuf'
}

application {
Expand Down Expand Up @@ -48,6 +49,12 @@ dependencies {
// It's necessary to pull in the most recent version of zkclient explicitly, otherwise Helix won't have it...
implementation libraries.zkclient

implementation libraries.grpcNettyShaded
implementation libraries.grpcProtobuf
implementation libraries.grpcStub
compileOnly libraries.tomcatAnnotations
implementation libraries.guava
rkunds marked this conversation as resolved.
Show resolved Hide resolved

testImplementation libraries.fastUtil
testImplementation project(':internal:alpini:router:alpini-router-api')
testImplementation project(':services:venice-router')
Expand All @@ -63,6 +70,25 @@ jar {
}
}

def grpcVersion = '1.54.1'
def protobufVersion = '3.21.7'

protobuf {
rkunds marked this conversation as resolved.
Show resolved Hide resolved
protoc {
artifact = 'com.google.protobuf:protoc:' + protobufVersion
}
plugins {
grpc {
artifact = 'io.grpc:protoc-gen-grpc-java:' + grpcVersion
}
}
generateProtoTasks {
all()*.plugins {
grpc {}
}
}
}

ext {
jacocoCoverageThreshold = 0.23
}
Expand Down
13 changes: 13 additions & 0 deletions services/venice-server/src/main/proto/VeniceReadService.proto
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
syntax = 'proto3';

service VeniceServer {
rpc ServeRequest (ClientRequest) returns (ServerReply) {}
}

message ClientRequest {
string message = 1;
}

message ServerReply {
string message = 1;
}