-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.gradle.kts
179 lines (161 loc) · 5.26 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
import io.gitlab.arturbosch.detekt.Detekt
import io.gitlab.arturbosch.detekt.DetektCreateBaselineTask
import org.jlleitschuh.gradle.ktlint.KtlintExtension
import org.jlleitschuh.gradle.ktlint.reporter.ReporterType
plugins {
kotlin("jvm") version "1.8.10"
kotlin("plugin.serialization") version "1.8.10"
id("org.jlleitschuh.gradle.ktlint") version "11.2.0"
id("io.gitlab.arturbosch.detekt") version "1.22.0"
id("org.jetbrains.dokka") version "1.8.10"
id("com.github.breadmoirai.github-release") version "2.4.1"
signing
`java-library`
`maven-publish`
}
group = "io.github.smaugfm"
version = "0.0.2"
val isReleaseVersion = !version.toString().endsWith("SNAPSHOT")
repositories {
mavenCentral()
}
val jdkVersion = "11"
val reactorCore = "3.5.2"
val reactorNetty = "1.1.2"
val mockserver = "5.15.0"
val logback = "1.4.5"
val resilience4j = "1.7.0"
dependencies {
api("io.projectreactor:reactor-core:$reactorCore")
api("io.projectreactor.netty:reactor-netty-http:$reactorNetty")
api("io.projectreactor.netty:reactor-netty-core:$reactorNetty")
api("io.github.resilience4j:resilience4j-reactor:$resilience4j")
api("io.github.resilience4j:resilience4j-ratelimiter:$resilience4j")
api("org.jetbrains.kotlinx:kotlinx-datetime:0.4.0")
implementation("io.github.microutils:kotlin-logging-jvm:3.0.5")
implementation("org.jetbrains.kotlinx:kotlinx-serialization-json:1.5.0")
testImplementation("org.mock-server:mockserver-netty:$mockserver")
testImplementation("org.mock-server:mockserver-client-java:$mockserver")
testImplementation("io.projectreactor:reactor-test:$reactorCore")
testImplementation("io.mockk:mockk:1.13.4")
testImplementation("com.willowtreeapps.assertk:assertk-jvm:0.25")
testImplementation("ch.qos.logback:logback-core:$logback")
testImplementation("ch.qos.logback:logback-classic:$logback")
testImplementation(kotlin("test"))
}
java {
withJavadocJar()
withSourcesJar()
}
configure<KtlintExtension> {
enableExperimentalRules.set(true)
reporters {
reporter(ReporterType.HTML)
}
}
detekt {
buildUponDefaultConfig = true
config = files("$projectDir/detekt.yml")
}
tasks {
test {
useJUnitPlatform()
}
withType<DetektCreateBaselineTask> {
jvmTarget = jdkVersion
}
withType<Detekt> {
jvmTarget = jdkVersion
reports {
html.required.set(true)
md.required.set(true)
xml.required.set(false)
txt.required.set(false)
sarif.required.set(false)
}
}
withType<Jar> {
from(rootDir.resolve("LICENSE")) {
into("META-INF")
}
}
named<Jar>("javadocJar") {
from(named("dokkaJavadoc"))
}
}
kotlin {
jvmToolchain(jdkVersion.toInt())
}
githubRelease {
val githubReleaseToken: String? by project
token(githubReleaseToken)
repo(project.name)
releaseAssets(
tasks.jar.get().destinationDirectory.asFile.get().listFiles()
)
targetCommitish("master")
overwrite(true)
}
publishing {
repositories {
maven {
if (isReleaseVersion) {
setUrl("https://s01.oss.sonatype.org/service/local/staging/deploy/maven2")
} else {
setUrl("https://s01.oss.sonatype.org/content/repositories/snapshots")
}
val ossrhUsername: String? by project
val ossrhPassword: String? by project
credentials {
username = ossrhUsername
password = ossrhPassword
}
}
}
publications {
create<MavenPublication>("mavenJava") {
groupId = project.group.toString()
artifactId = project.name
version = project.version.toString()
versionMapping {
usage("java-api") {
fromResolutionOf("runtimeClasspath")
}
usage("java-runtime") {
fromResolutionResult()
}
}
from(components["java"])
pom {
name.set(project.name)
description.set("Non-blocking client for Monobank developer API")
url.set("https://github.com/smaugfm/monobank")
inceptionYear.set("2023")
licenses {
license {
name.set("MIT License")
url.set("https://www.opensource.org/licenses/mit-license.php")
}
}
developers {
developer {
name.set("Dmytro Marchuk")
url.set("https://marchuk.io")
}
}
scm {
connection.set("scm:git:https://github.com/smaugfm/monobank")
developerConnection.set("scm:git:git@github.com:smaugfm/monobank.git")
url.set("https://github.com/smaugfm/monobank")
}
issueManagement {
system.set("GitHub")
url.set("https://github.com/smaugfm/monobank/issues")
}
}
}
configure<SigningExtension> {
sign(publications)
}
}
}