-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.gradle.kts
85 lines (73 loc) · 1.81 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
import com.google.protobuf.gradle.*
import java.net.URI
plugins {
id("java")
id("com.google.protobuf") version("0.9.4")
}
group = "org.dlms"
version = "1.0-SNAPSHOT"
val grpcVersion = "1.68.0"
repositories {
mavenCentral()
google()
maven {
url = URI.create("https://maven.pkg.github.com/bxute/dlms-schemas") // For release
credentials {
username = (project.findProperty("gpr.user") ?: "").toString()
password = (project.findProperty("gpr.token") ?: "").toString()
}
}
}
dependencies {
implementation("io.grpc:grpc-all:${grpcVersion}")
implementation("com.google.protobuf:protobuf-java:4.28.2")
// annotation
implementation("javax.annotation:javax.annotation-api:1.3.2")
// schemas
implementation("org.dlms.protos:dlms-schemas:1.0.22")
// tests
testImplementation(platform("org.junit:junit-bom:5.10.0"))
testImplementation("org.junit.jupiter:junit-jupiter")
}
protobuf {
protoc { artifact = "com.google.protobuf:protoc:3.25.3" }
plugins {
id("grpc") {
artifact = "io.grpc:protoc-gen-grpc-java:$grpcVersion"
}
}
generateProtoTasks {
all().forEach { tasks ->
tasks.plugins {
id("grpc") {}
}
}
}
}
sourceSets {
main {
proto {
srcDir("$buildDir/extracted-include-protos/main")
}
java {
srcDir("$projectDir/src/generated/")
}
}
}
// Apply a specific Java toolchain to ease working on different environments.
java {
toolchain {
languageVersion = JavaLanguageVersion.of(17)
}
}
tasks {
compileJava {
dependsOn("generateProto")
}
processResources {
dependsOn("extractIncludeProto")
}
}
tasks.test {
useJUnitPlatform()
}