Skip to content

Instantly share code, notes, and snippets.

@skhatri
Last active May 20, 2020 00:36
Show Gist options
  • Save skhatri/cb4266bc5bbe5dbddc94c8fb6b8f0750 to your computer and use it in GitHub Desktop.
Save skhatri/cb4266bc5bbe5dbddc94c8fb6b8f0750 to your computer and use it in GitHub Desktop.
Example Java Protobuf Build
plugins {
id "com.google.protobuf" version "0.8.12"
id "java"
id "idea"
}
sourceSets{
main {
java {
srcDir 'src/main/java'
srcDir 'src/generated/main/java'
srcDir 'src/generated/main/grpc'
}
proto {
srcDir 'src/main/proto'
include '**/*.proto'
}
}
}
protobuf {
generatedFilesBaseDir="$projectDir/src/generated"
protoc {
artifact='com.google.protobuf:protoc:3.0.0'
}
plugins {
grpc {
artifact = 'io.grpc:protoc-gen-grpc-java:1.29.0'
}
}
generateProtoTasks {
all().each{ task ->
task.builtins {
//go {}
}
task.plugins {
grpc{}
}
}
}
}
repositories {
mavenCentral()
}
dependencies {
compile 'com.google.protobuf:protobuf-java:3.0.0'
compile "io.grpc:grpc-protobuf:1.29.0"
compile "io.grpc:grpc-stub:1.29.0"
runtimeOnly "io.grpc:grpc-netty-shaded:1.29.0"
compileOnly "org.apache.tomcat:annotations-api:6.0.53"
}
//protoc -I todo/src/main/proto --proto_path=todo/src --go_out=plugins=grpc:$f/todo todo.proto
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment