This repository has been archived by the owner on Sep 22, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.gradle.kts
142 lines (121 loc) · 4.58 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
import org.cyclonedx.gradle.CycloneDxTask
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
import com.google.protobuf.gradle.*
plugins {
kotlin("jvm") version ("1.9.10")
kotlin("plugin.serialization") version "1.9.10"
id("com.google.protobuf") version "0.9.4"
id("org.cyclonedx.bom") version "1.7.4"
application
}
group = "io.nais"
version = "generatedlater"
apply(plugin = "com.google.protobuf")
repositories {
maven("https://jitpack.io")
maven("https://packages.confluent.io/maven/")
mavenCentral()
}
configurations {
this.all {
exclude(group = "ch.qos.logback")
}
}
val junitVersion = "5.10.0"
val ktorVersion = "2.3.4"
val log4jVersion = "2.20.0"
val assertJVersion = "3.24.2"
val prometheusVersion = "0.16.0"
val micrometerVersion = "1.11.4"
val serializerVersion = "0.20.0"
val protobufVersion = "3.24.3"
dependencies {
implementation(kotlin("stdlib-jdk8:1.9.0"))
implementation("org.jetbrains.kotlin:kotlin-reflect:1.9.10")
implementation("com.natpryce:konfig:1.6.10.0")
implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core-jvm:1.7.3")
implementation("org.apache.logging.log4j:log4j-api:$log4jVersion")
implementation("org.apache.logging.log4j:log4j-core:$log4jVersion")
implementation("org.apache.logging.log4j:log4j-slf4j-impl:$log4jVersion")
implementation("com.vlkan.log4j2:log4j2-logstash-layout-fatjar:1.0.5")
implementation("org.jetbrains.kotlinx:kotlinx-serialization-json:$serializerVersion")
implementation("org.jetbrains.kotlinx:kotlinx-serialization-runtime:$serializerVersion")
implementation("org.jetbrains.kotlinx:kotlinx-serialization-runtime-common:$serializerVersion")
implementation("io.prometheus:simpleclient:$prometheusVersion")
implementation("io.micrometer:micrometer-registry-prometheus:$micrometerVersion")
implementation("commons-codec:commons-codec:1.16.0")
implementation("com.fasterxml.jackson.module:jackson-module-kotlin:2.15.2")
implementation("org.apache.kafka:kafka-clients:7.5.0-ce")
implementation("io.confluent:kafka-protobuf-serializer:7.5.0")
api("com.google.protobuf:protobuf-java:$protobufVersion")
implementation("io.ktor:ktor-server-default-headers:$ktorVersion")
implementation("io.ktor:ktor-server-call-logging:$ktorVersion")
implementation("io.ktor:ktor-server-content-negotiation-jvm:$ktorVersion")
implementation("io.ktor:ktor-server-netty-jvm:$ktorVersion")
implementation("io.ktor:ktor-server-metrics-micrometer-jvm:$ktorVersion")
implementation("io.ktor:ktor-server-auth-jvm:$ktorVersion")
implementation("io.ktor:ktor-serialization-kotlinx-json:$ktorVersion")
protobuf(files("src/main/protobuf/"))
testImplementation("org.assertj:assertj-core:$assertJVersion")
testImplementation("org.junit.jupiter:junit-jupiter-api:$junitVersion")
testImplementation("org.junit.jupiter:junit-jupiter-engine:$junitVersion")
testImplementation("org.assertj:assertj-core:$assertJVersion")
}
java {
sourceCompatibility = JavaVersion.VERSION_17
targetCompatibility = JavaVersion.VERSION_17
}
tasks {
withType<CycloneDxTask> {
setOutputFormat("json")
setIncludeLicenseText(false)
}
withType<KotlinCompile> {
kotlinOptions.jvmTarget = "17"
}
withType<Test> {
useJUnitPlatform()
testLogging {
showExceptions = true
showStackTraces = true
exceptionFormat = org.gradle.api.tasks.testing.logging.TestExceptionFormat.FULL
events("passed", "skipped", "failed")
}
}
named<Jar>("jar") {
archiveFileName.set("app.jar")
manifest {
attributes["Main-Class"] = "io.nais.devrapid.AppKt"
attributes["Class-Path"] = configurations.runtimeClasspath.get().joinToString(separator = " ") {
it.name
}
}
doLast {
configurations.runtimeClasspath.get().forEach {
val file = File("$buildDir/libs/${it.name}")
if (!file.exists())
it.copyTo(file)
}
}
}
}
java {
val mainJavaSourceSet: SourceDirectorySet = sourceSets.getByName("main").java
val protoSrcDir = "$buildDir/generated/source/proto/main"
mainJavaSourceSet.srcDirs("$protoSrcDir/java", "$protoSrcDir/grpc", "$protoSrcDir/grpckotlin")
}
protobuf {
protoc {
artifact = "com.google.protobuf:protoc:$protobufVersion"
}
}
sourceSets{
create("proto"){
proto {
srcDir("src/main/protobuf/")
}
}
}
application {
mainClass.set("io.nais.devrapid.App")
}