Create multiproject build, add python grpc build support

This commit is contained in:
Piv
2020-04-17 20:47:37 +09:30
parent f42778057f
commit 3446bcaa53
16 changed files with 100 additions and 34 deletions

48
protobuf/build.gradle Normal file
View File

@@ -0,0 +1,48 @@
plugins {
id 'java'
id 'com.google.protobuf'
id 'idea'
}
configurations {
// For grpc python codegen.
python {
canBeResolved = false
canBeConsumed = true
}
}
protobuf {
protoc { artifact = 'com.google.protobuf:protoc:3.11.0' }
plugins {
grpc {
artifact = 'io.grpc:protoc-gen-grpc-java:1.28.1' // CURRENT_GRPC_VERSION
}
grpc_python { path = "$projectDir/grpc_python_plugin" }
}
generateProtoTasks {
all().each { task ->
task.builtins {
java { option 'lite' }
python {}
}
task.plugins {
grpc { // Options added to --grpc_out
option 'lite'
}
grpc_python {
outputSubDir = 'python'
}
}
}
}
}
dependencies {
implementation 'io.grpc:grpc-okhttp:1.28.1' // CURRENT_GRPC_VERSION
implementation 'io.grpc:grpc-protobuf-lite:1.28.1' // CURRENT_GRPC_VERSION
implementation 'io.grpc:grpc-stub:1.28.1' // CURRENT_GRPC_VERSION
implementation 'javax.annotation:javax.annotation-api:1.2'
}