-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathbuild.gradle.kts
113 lines (95 loc) · 3.42 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
plugins {
kotlin("jvm") version "2.0.0"
kotlin("plugin.serialization") version "1.9.23"
id("com.diffplug.spotless") version "6.25.0"
id("maven-publish")
id("signing")
}
group = "com.wolt"
repositories { mavenCentral() }
java {
sourceCompatibility = JavaVersion.VERSION_11
targetCompatibility = JavaVersion.VERSION_11
withSourcesJar()
withJavadocJar()
}
dependencies {
val ktorVersion = "2.3.11"
api("io.ktor:ktor-server-core-jvm:${ktorVersion}")
implementation("io.ktor:ktor-server-netty-jvm:${ktorVersion}")
implementation("io.ktor:ktor-server-content-negotiation:${ktorVersion}")
implementation("io.ktor:ktor-serialization-kotlinx-json:${ktorVersion}")
implementation("io.github.oshai:kotlin-logging-jvm:6.0.9")
testImplementation("io.ktor:ktor-server-status-pages:2.3.11")
testImplementation("io.ktor:ktor-server-test-host:${ktorVersion}")
testImplementation("io.mockk:mockk:1.13.13")
testImplementation("org.jetbrains.kotlin:kotlin-test")
}
tasks.test { useJUnitPlatform() }
kotlin { jvmToolchain(21) }
spotless {
kotlin {
ktfmt("0.47")
ktlint()
}
kotlinGradle { ktfmt("0.47").kotlinlangStyle() }
}
tasks {
compileKotlin { kotlinOptions.jvmTarget = "11" }
compileTestKotlin { kotlinOptions.jvmTarget = "11" }
}
publishing {
publications {
create<MavenPublication>("mavenJava") {
from(components["kotlin"])
groupId = project.group.toString()
artifactId = project.name
version = project.version.toString()
artifact(tasks.kotlinSourcesJar)
artifact(tasks.named("javadocJar"))
pom {
name.set("Ktor Idempotency Plugin")
description.set("A Ktor plugin for handling idempotency in HTTP requests")
url.set("https://github.com/woltapp/ktor-idempotency")
licenses {
license {
name.set("The MIT License")
url.set("https://github.com/woltapp/ktor-idempotency/blob/main/LICENSE")
}
}
developers {
developer {
id.set("muatik")
name.set("Mustafa Atik")
email.set("[email protected]")
}
}
scm {
connection.set("scm:git:https://github.com/woltapp/ktor-idempotency.git")
developerConnection.set(
"scm:git:https://github.com/woltapp/ktor-idempotency.git"
)
url.set("https://github.com/woltapp/ktor-idempotency")
}
}
}
}
repositories {
maven {
name = "sonatype"
url = uri("https://oss.sonatype.org/service/local/staging/deploy/maven2/")
credentials(PasswordCredentials::class)
}
}
}
val isReleaseVersion = !version.toString().endsWith("-SNAPSHOT")
signing {
setRequired {
// signing is required if this is a release version and the artifacts are to be published
isReleaseVersion && gradle.taskGraph.allTasks.any { it is PublishToMavenRepository }
}
val signingKey: String? by project
val signingPassword: String? by project
useInMemoryPgpKeys(signingKey, signingPassword)
sign(publishing.publications["mavenJava"])
}