-
Notifications
You must be signed in to change notification settings - Fork 16
/
build.gradle.kts
98 lines (84 loc) · 2.4 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
import org.jetbrains.kotlin.gradle.dsl.JvmTarget
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
plugins {
kotlin("jvm") version libs.versions.kotlin
}
allprojects {
group = "com.github.codeborne.klite"
version = "master-SNAPSHOT" // see tags/releases
}
subprojects {
apply(plugin = "kotlin")
apply(plugin = "maven-publish")
repositories {
mavenCentral()
}
dependencies {
val libs = rootProject.libs
testImplementation(libs.junit)
testRuntimeOnly(libs.junit.engine)
testImplementation(libs.atrium) {
exclude("org.jetbrains.kotlin")
}
testImplementation(libs.mockk) {
exclude("org.jetbrains.kotlin")
}
testImplementation(libs.kotlinx.coroutines.test)
}
sourceSets {
main {
java.setSrcDirs(emptyList<String>())
kotlin.setSrcDirs(listOf("src"))
resources.setSrcDirs(listOf("src")).exclude("**/*.kt")
}
test {
java.setSrcDirs(emptyList<String>())
kotlin.setSrcDirs(listOf("test"))
resources.setSrcDirs(listOf("test")).exclude("**/*.kt")
}
}
java.sourceCompatibility = JavaVersion.VERSION_11
tasks.withType<KotlinCompile> {
compilerOptions {
jvmTarget.set(JvmTarget.JVM_11)
freeCompilerArgs.add("-opt-in=kotlin.ExperimentalStdlibApi")
freeCompilerArgs.add("-Xcontext-receivers")
}
}
tasks.jar {
archiveBaseName.set("${rootProject.name}-${project.name}")
manifest {
attributes(mapOf(
"Implementation-Title" to archiveBaseName,
"Implementation-Version" to project.version
))
}
}
java {
withSourcesJar()
}
tasks.named<Jar>("sourcesJar") {
duplicatesStrategy = DuplicatesStrategy.EXCLUDE
}
tasks.test {
useJUnitPlatform()
// enable JUnitAssertionImprover from klite.jdbc-test
jvmArgs("--enable-preview", "-Djunit.jupiter.extensions.autodetection.enabled=true", "--add-opens=java.base/java.lang=ALL-UNNAMED")
}
// disable publishing gradle .modules files as JitPack omits excludes from there: https://github.com/jitpack/jitpack.io/issues/5349
tasks.withType<GenerateModuleMetadata> {
enabled = false
}
configure<PublishingExtension> {
publications {
if (project.name != "sample") {
register<MavenPublication>("maven") {
from(components["java"])
afterEvaluate {
artifactId = tasks.jar.get().archiveBaseName.get()
}
}
}
}
}
}