-
Notifications
You must be signed in to change notification settings - Fork 8
/
build.gradle.kts
182 lines (158 loc) · 5.53 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
import net.researchgate.release.GitAdapter
import net.researchgate.release.ReleaseExtension
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
fun prop(key: String) = properties[key]?.toString()
buildscript {
dependencies {
classpath("org.jetbrains.kotlin", "kotlin-gradle-plugin", properties["kotlin_version"].toString())
}
}
plugins {
kotlin("jvm") version "1.9.22" apply false
id("net.researchgate.release") version "2.8.1"
`java-library`
signing
`maven-publish`
}
defaultTasks("clean", "build")
fun ReleaseExtension.git(configureFn: GitAdapter.GitConfig.() -> Unit) {
(propertyMissing("git") as GitAdapter.GitConfig).configureFn()
}
release {
failOnCommitNeeded = true
failOnPublishNeeded = false
failOnSnapshotDependencies = true
failOnUnversionedFiles = true
failOnUpdateNeeded = false
revertOnFail = true
git {
requireBranch = "main"
pushToRemote = "origin"
}
}
tasks {
val modules = listOf("tekniq-core", "tekniq-cache", "tekniq-jdbc", "tekniq-rest")
"beforeReleaseBuild" {
modules.forEach { dependsOn(":$it:test") }
}
"afterReleaseBuild" {
dependsOn("publish")
modules.forEach { dependsOn(":$it:publish") }
}
}
allprojects {
apply(plugin = "kotlin")
apply<JavaLibraryPlugin>()
apply<SigningPlugin>()
apply<MavenPublishPlugin>()
group = "io.tekniq"
repositories {
mavenCentral()
}
dependencies {
implementation(kotlin("stdlib"))
implementation(kotlin("stdlib-jdk8"))
implementation(kotlin("reflect"))
testImplementation(kotlin("test"))
testImplementation("io.kotest:kotest-runner-junit5:${properties["kotest_version"]}")
testImplementation("io.kotest:kotest-assertions-core:${properties["kotest_version"]}")
testImplementation("io.kotest:kotest-property:${properties["kotest_version"]}")
testImplementation("org.jetbrains.kotlinx:kotlinx-coroutines-core:1.7.3")
testImplementation("ch.qos.logback", "logback-classic", prop("logback_version"))
}
tasks {
withType<KotlinCompile> {
kotlinOptions {
jvmTarget = JavaVersion.VERSION_11.majorVersion
apiVersion = "1.9"
languageVersion = "1.9"
javaParameters = true
suppressWarnings = true
freeCompilerArgs = listOf("-Xallow-result-return-type")
}
}
withType<Sign>().configureEach {
onlyIf { !version.toString().endsWith("-SNAPSHOT") }
}
withType<Test> {
useJUnitPlatform()
}
}
java {
toolchain {
languageVersion.set(JavaLanguageVersion.of(JavaVersion.VERSION_11.majorVersion))
}
withJavadocJar()
withSourcesJar()
}
publishing {
publications {
create<MavenPublication>("maven") {
from(components["java"])
pom {
name.set(project.name)
packaging = "jar"
description.set("Kotlin idiomatic framework for improved JVM/Application development")
url.set("https://github.com/sepatel/tekniq")
scm {
connection.set("scm:git:git://github.com/sepatel/tekniq.git")
developerConnection.set("scm:git:git://github.com/sepatel/tekniq")
url.set("https://github.com/sepatel/tekniq")
}
licenses {
license {
name.set("MIT License")
url.set("https://raw.githubusercontent.com/sepatel/tekniq/main/LICENSE")
}
}
developers {
developer {
id.set("sepatel")
name.set("Sejal Patel")
email.set("sejal@tekniq.io")
}
}
}
}
}
repositories {
maven {
name = "sonatype"
if (version.toString().endsWith("-SNAPSHOT")) {
setUrl("https://oss.sonatype.org/content/repositories/snapshots/")
} else {
setUrl("https://oss.sonatype.org/service/local/staging/deploy/maven2/")
}
credentials {
username = project.findProperty("ossrhUsername").toString()
password = project.findProperty("ossrhPassword").toString()
}
}
}
}
signing {
useGpgCmd()
isRequired = true
sign(publishing.publications)
}
}
project(":tekniq-cache") {
dependencies {
implementation(project(":tekniq-core"))
implementation("com.github.ben-manes.caffeine", "caffeine", prop("caffeine_version"))
}
}
project(":tekniq-jdbc") {
dependencies {
implementation(project(":tekniq-core"))
testImplementation("org.hsqldb:hsqldb:2.3.4")
}
}
project(":tekniq-rest") {
dependencies {
implementation("com.fasterxml.jackson.core", "jackson-core", prop("jackson_version"))
implementation("com.fasterxml.jackson.module", "jackson-module-kotlin", prop("jackson_version"))
testImplementation("io.javalin:javalin:${properties["javalin_version"]}")
testImplementation("ch.qos.logback:logback-classic:${properties["logback_version"]}")
}
}