-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.gradle.kts
66 lines (58 loc) · 1.49 KB
/
build.gradle.kts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
import com.google.protobuf.gradle.*
plugins {
id("com.google.protobuf") version "0.8.15"
kotlin("jvm") version "1.6.21"
}
group = "mono"
version = "0.0.1-SNAPSHOT"
java.sourceCompatibility = JavaVersion.VERSION_11
apply(plugin = "com.google.protobuf")
apply(plugin = "kotlin")
configurations.forEach {
if (it.name.toLowerCase().contains("proto")) {
it.attributes.attribute(Usage.USAGE_ATTRIBUTE, objects.named(Usage::class.java, "java-runtime"))
}
}
repositories {
mavenCentral()
}
dependencies {
// grpc
api("com.google.protobuf:protobuf-java-util:3.14.0")
api("io.grpc:grpc-kotlin-stub:1.0.0")
api("io.grpc:grpc-protobuf:1.34.0")
api("io.grpc:grpc-netty-shaded:1.34.0")
}
protobuf {
generatedFilesBaseDir = "$projectDir/build/generated/source"
protoc {
artifact = "com.google.protobuf:protoc:3.14.0"
}
plugins {
id("grpc") {
artifact = "io.grpc:protoc-gen-grpc-java:1.34.0"
}
id("grpckt") {
artifact = "io.grpc:protoc-gen-grpc-kotlin:1.0.0:jdk7@jar"
}
}
generateProtoTasks {
ofSourceSet("main").forEach {
it.plugins {
id("grpc")
id("grpckt")
}
it.generateDescriptorSet = true
it.descriptorSetOptions.includeSourceInfo = true
it.descriptorSetOptions.includeImports = true
it.descriptorSetOptions.path = "$buildDir/resources/META-INF/armeria/grpc/service-name.dsc"
}
}
}
sourceSets {
main {
java.srcDir("build/generated/source/main/grpckt")
java.srcDir("build/generated/source/main/grpc")
java.srcDir("build/generated/source/main/java")
}
}