-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.gradle.kts
192 lines (161 loc) · 6.39 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
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
import org.gradle.crypto.checksum.Checksum
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
plugins {
application // Provide convenience executables for trying out the examples.
jacoco
kotlin("jvm") version "1.9.22"
id("idea")
id("org.gradle.crypto.checksum") version "1.4.0"
id("org.jlleitschuh.gradle.ktlint") version "11.6.1"
}
group = "io.provenance"
version = System.getenv("VERSION") ?: "0-SNAPSHOT"
application {
mainClass.set("io.provenance.abci.listener.AbciListenerServerKt")
}
repositories {
// The Google mirror is less flaky than mavenCentral()
maven { url = project.uri("https://maven-central.storage-download.googleapis.com/maven2/") }
maven { url = project.uri("https://packages.confluent.io/maven/") } // confluent
maven { url = project.uri("https://jitpack.io") } // cp-testcontainers
mavenCentral()
mavenLocal()
}
val grpcVersion = "1.53.0"
val grpcKotlinVersion = "1.3.0"
val protobufVersion = "3.21.9"
val coroutinesVersion = "1.7.3"
val confluentVersion = "7.3.0"
val junitJupiterVersion = "5.10.2"
val testContainersVersion = "1.19.4"
val provenanceProtoKotlinVersion = "1.17.1"
dependencies {
// Kotlin
implementation(kotlin("stdlib"))
implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core-jvm:$coroutinesVersion")
// Grpc services
implementation("io.grpc:grpc-services:$grpcVersion")
implementation("io.provenance:proto-kotlin:$provenanceProtoKotlinVersion")
// Grpc server
implementation("io.grpc:grpc-netty-shaded:$grpcVersion")
runtimeOnly("io.grpc:grpc-netty:$grpcVersion")
// Log
implementation("org.slf4j:slf4j-api:2.0.11")
implementation("ch.qos.logback:logback-classic:1.4.14")
implementation("io.github.microutils:kotlin-logging-jvm:3.0.5")
// Kafka clients
implementation("io.confluent:kafka-protobuf-serializer:$confluentVersion")
// Configuration lib for JVM languages (HOCON)
implementation("com.typesafe:config:1.4.3")
// Test
testImplementation(kotlin("test-junit"))
testImplementation("org.assertj:assertj-core:3.25.2")
testImplementation("io.grpc:grpc-testing:$grpcVersion")
testImplementation("org.junit.jupiter:junit-jupiter-api:$junitJupiterVersion")
testRuntimeOnly("org.junit.jupiter:junit-jupiter-engine:$junitJupiterVersion")
testImplementation("org.jetbrains.kotlinx:kotlinx-coroutines-debug:$coroutinesVersion")
testImplementation("org.testcontainers:testcontainers:$testContainersVersion")
testImplementation("org.testcontainers:junit-jupiter:$testContainersVersion")
testImplementation("org.testcontainers:kafka:$testContainersVersion")
testImplementation("com.github.christophschubert:cp-testcontainers:v0.2.1")
}
java {
toolchain {
languageVersion.set(JavaLanguageVersion.of(11))
}
}
tasks.withType<Javadoc> { enabled = false }
tasks.withType<KotlinCompile> {
kotlinOptions {
freeCompilerArgs = listOf(
"-Xjsr305=strict",
"-opt-in=kotlin.RequiresOptIn"
)
jvmTarget = "11"
languageVersion = "1.7"
apiVersion = "1.7"
}
}
tasks.distTar {
compression = Compression.GZIP
archiveExtension.set("tar.gz")
finalizedBy("checksumDist")
}
tasks.register<Checksum>("checksumDist") {
val dir = layout.buildDirectory.dir("distributions")
inputFiles.setFrom(dir)
outputDirectory.set(dir)
checksumAlgorithm.set(Checksum.Algorithm.MD5)
appendFileNameToChecksum.set(true)
dependsOn(tasks.distTar)
}
tasks.withType<Test> {
useJUnitPlatform()
// JUnit 5 parallel test execution
// https://github.com/gradle/gradle/issues/6453#issuecomment-463702749
systemProperties["junit.jupiter.execution.parallel.enabled"] = true
systemProperties["junit.jupiter.execution.parallel.mode.default"] = "concurrent"
maxParallelForks = (Runtime.getRuntime().availableProcessors() / 2).takeIf { it > 0 } ?: 1
testLogging {
showStandardStreams = true
// set options for log level LIFECYCLE
events = setOf(
org.gradle.api.tasks.testing.logging.TestLogEvent.FAILED,
org.gradle.api.tasks.testing.logging.TestLogEvent.PASSED,
org.gradle.api.tasks.testing.logging.TestLogEvent.SKIPPED,
org.gradle.api.tasks.testing.logging.TestLogEvent.STANDARD_OUT
)
exceptionFormat = org.gradle.api.tasks.testing.logging.TestExceptionFormat.FULL
showExceptions = true
showCauses = true
showStackTraces = true
// set options for log level DEBUG and INFO
debug {
events = setOf(
org.gradle.api.tasks.testing.logging.TestLogEvent.STARTED,
org.gradle.api.tasks.testing.logging.TestLogEvent.FAILED,
org.gradle.api.tasks.testing.logging.TestLogEvent.PASSED,
org.gradle.api.tasks.testing.logging.TestLogEvent.SKIPPED,
org.gradle.api.tasks.testing.logging.TestLogEvent.STANDARD_ERROR,
org.gradle.api.tasks.testing.logging.TestLogEvent.STANDARD_OUT
)
exceptionFormat = org.gradle.api.tasks.testing.logging.TestExceptionFormat.FULL
}
info.events = debug.events
info.exceptionFormat = debug.exceptionFormat
}
afterSuite(
KotlinClosure2({ desc: TestDescriptor, result: TestResult ->
if (desc.parent == null) { // will match the outermost suite
println(
"Results: ${result.resultType} (" +
"${result.testCount} tests, " +
"${result.successfulTestCount} successes," +
"${result.failedTestCount} failures, " +
"${result.skippedTestCount} skipped)"
)
}
})
)
finalizedBy(tasks.jacocoTestReport) // report is always generated after tests run
}
tasks.withType<JacocoReport> {
dependsOn(tasks.test) // tests are required to run before generating the report
}
tasks.withType<JacocoCoverageVerification> {
violationRules {
rule {
limit {
minimum = "0.5".toBigDecimal()
}
}
}
}
configurations.all {
resolutionStrategy.eachDependency {
if (requested.group == "org.apache.logging.log4j" && (requested.version == "2.14.1") || (requested.version == "2.15.0")) {
useVersion("2.15.0")
because("CVE-2021-44228")
}
}
}