-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.gradle.kts
92 lines (75 loc) · 1.88 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
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
import com.google.protobuf.gradle.*
import org.jetbrains.kotlin.js.inline.clean.removeDuplicateImports
val protobuf_version: String by project
val grpc_version: String by project
val grpc_kotlin_version: String by project
plugins {
kotlin("jvm") version "1.6.20"
id("com.google.protobuf") version "0.8.15"
idea
application
}
group = "org.example"
version = "1.0-SNAPSHOT"
repositories {
mavenCentral()
}
tasks {
withType<Copy> {
duplicatesStrategy = DuplicatesStrategy.EXCLUDE
}
}
dependencies {
implementation("io.grpc:grpc-kotlin-stub:$grpc_kotlin_version")
implementation("io.grpc:grpc-protobuf:$grpc_version")
implementation("com.google.protobuf:protobuf-kotlin:$protobuf_version")
runtimeOnly("io.grpc:grpc-netty:$grpc_version")
testImplementation(kotlin("test"))
}
tasks.test {
useJUnitPlatform()
}
tasks.withType<KotlinCompile> {
kotlinOptions.jvmTarget = "1.8"
}
application {
mainClass.set("MainKt")
}
sourceSets {
main {
proto {
srcDir("src/main/proto")
}
}
}
protobuf {
protoc {
artifact = "com.google.protobuf:protoc:$protobuf_version"
}
plugins {
id("grpc") {
artifact = "io.grpc:protoc-gen-grpc-java:$grpc_version"
}
id("grpckt") {
artifact = "io.grpc:protoc-gen-grpc-kotlin:$grpc_kotlin_version:jdk7@jar"
}
}
generateProtoTasks {
all().forEach {
it.plugins {
id("grpc")
id("grpckt")
}
it.builtins {
id("kotlin")
}
}
}
}
idea {
module {
sourceDirs.plusAssign(file("${projectDir}/build/generated/source/proto/main/kotlin"))
sourceDirs.plusAssign(file("${projectDir}/build/generated/source/proto/main/grpckt"))
}
}