-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathbuild.gradle.kts
195 lines (179 loc) · 6.16 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
193
194
195
import com.vanniktech.maven.publish.JavadocJar
import com.vanniktech.maven.publish.KotlinJvm
import com.vanniktech.maven.publish.SonatypeHost
import groovy.util.Node
import groovy.util.NodeList
import org.gradle.api.tasks.testing.logging.TestExceptionFormat
import org.gradle.api.tasks.testing.logging.TestLogEvent
plugins {
id("com.google.cloud.tools.jib")
id("com.vanniktech.maven.publish")
id("me.qoomon.git-versioning")
id("org.jetbrains.dokka")
id("org.jlleitschuh.gradle.ktlint")
kotlin("jvm")
`java-library`
jacoco
}
repositories {
mavenCentral()
}
buildscript {
repositories {
mavenCentral()
}
}
val jacocoVersion: String by project
jacoco {
toolVersion = jacocoVersion
}
val eclipseCollectionsVersion: String by project
val jeromqVersion: String by project
val junitJupiterVersion: String by project
val junitPlatformLauncherVersion: String by project
val kotlinLoggingJvmVersion: String by project
val kotlinVersion: String by project
val kotlinxCoroutinesVersion: String by project
val ktlintVersion: String by project
val logbackVersion: String by project
val msgpackVersion: String by project
val nettyVersion: String by project
val restAssuredVersion: String by project
val slf4jVersion: String by project
val testcontainersVersion: String by project
dependencies {
implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core-jvm:$kotlinxCoroutinesVersion")
implementation("io.github.oshai:kotlin-logging-jvm:$kotlinLoggingJvmVersion")
implementation("org.zeromq:jeromq:$jeromqVersion")
implementation("org.jetbrains.kotlin:kotlin-reflect:$kotlinVersion")
implementation("org.msgpack:msgpack-core:$msgpackVersion")
implementation("io.netty:netty-buffer:$nettyVersion")
implementation("org.eclipse.collections:eclipse-collections:$eclipseCollectionsVersion")
implementation("ch.qos.logback:logback-classic:$logbackVersion")
implementation("org.slf4j:slf4j-api:$slf4jVersion")
// lint
compileOnly("com.pinterest.ktlint:ktlint-core:$ktlintVersion")
// test
testRuntimeOnly("org.junit.platform:junit-platform-launcher:$junitPlatformLauncherVersion")
testImplementation("org.junit.jupiter:junit-jupiter:$junitJupiterVersion")
testImplementation("org.testcontainers:junit-jupiter:$testcontainersVersion")
testImplementation("io.rest-assured:rest-assured:$restAssuredVersion")
testImplementation("io.rest-assured:kotlin-extensions:$restAssuredVersion")
}
group = "com.onepeloton.locust4k"
description = "Locust Worker Client for Kotlin"
version = "0.0.0-SNAPSHOT"
gitVersioning.apply {
refs {
tag("v(?<version>.*)") { version = "\${ref.version}" }
branch(".+") { version = "\${ref}-SNAPSHOT" }
}
}
mavenPublishing {
configure(
KotlinJvm(
javadocJar = JavadocJar.Dokka("dokkaHtml"),
sourcesJar = true,
),
)
publishToMavenCentral(SonatypeHost.CENTRAL_PORTAL)
signAllPublications()
coordinates(groupId = group as String, artifactId = rootProject.name, version = version as String)
pom {
name.set("Locust4k")
description.set(project.description)
inceptionYear.set("2024")
url.set("https://github.com/pelotoncycle/locust4k/")
licenses {
license {
name.set("MIT License")
url.set("https://github.com/pelotoncycle/locust4k/blob/main/LICENSE")
distribution.set("repo")
}
}
developers {
developer {
id.set("Travis Haagen <[email protected]>")
name.set("Travis Haagen")
email.set("[email protected]")
url.set("https://travishaagen.github.io/")
organization.set("Peloton Interactive, Inc.")
organizationUrl.set("https://www.onepeloton.com/")
}
}
scm {
url.set("https://github.com/pelotoncycle/locust4k/")
connection.set("scm:git:git://github.com/pelotoncycle/locust4k.git")
developerConnection.set("scm:git:ssh://[email protected]/pelotoncycle/locust4k.git")
}
withXml {
val dependencies = (asNode().get("dependencies") as NodeList).first() as Node
val dependencyList = dependencies.get("dependency") as NodeList
dependencyList.forEach {
val dependency = it as Node
val artifactId = (dependency.get("artifactId") as NodeList).last() as Node
// remove logback from the POM, which makes it optional
if (artifactId.text().contains("logback")) {
dependency.parent().remove(dependency)
}
}
}
}
}
jib {
to {
image = "locust4k/example"
}
container {
mainClass = "com.onepeloton.locust4k.examples.ExampleApp"
}
}
tasks.named("compileKotlin", org.jetbrains.kotlin.gradle.tasks.KotlinCompilationTask::class.java) {
compilerOptions {
freeCompilerArgs.add("-opt-in=kotlin.RequiresOptIn")
}
}
tasks.test {
dependsOn("cleanTest")
useJUnitPlatform()
testLogging {
events(
TestLogEvent.FAILED,
TestLogEvent.PASSED,
TestLogEvent.SKIPPED,
TestLogEvent.STANDARD_OUT,
)
exceptionFormat = TestExceptionFormat.FULL
showExceptions = true
showCauses = true
showStackTraces = true
}
}
tasks.jacocoTestReport {
dependsOn(tasks.test)
reports {
xml.required.set(true)
csv.required.set(false)
html.outputLocation.set(layout.buildDirectory.dir("jacocoHtml"))
}
}
tasks.jar {
manifest {
attributes(
mapOf(
"Implementation-Title" to project.name,
"Implementation-Version" to project.version,
),
)
}
}
tasks.register("runExample") {
description = "Run an example app by name."
val appName = project.providers.gradleProperty("name")
if (appName.isPresent) {
javaexec {
mainClass.set("com.onepeloton.locust4k.examples.${appName.get()}")
classpath = sourceSets["main"].runtimeClasspath
}
}
}