-
Notifications
You must be signed in to change notification settings - Fork 3
/
build.gradle.kts
144 lines (136 loc) · 4.99 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
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
plugins {
kotlin("jvm") version "1.9.22"
`java-library`
`maven-publish`
signing
id("org.jetbrains.dokka") version "1.9.10"
id("org.javamodularity.moduleplugin") version "1.8.12"
}
group = "org.rationalityfrontline"
version = "2.3.1"
val NAME = "kevent"
val DESC = "A powerful in-process event dispatcher based on Kotlin and Coroutines"
val GITHUB_REPO = "RationalityFrontline/kevent"
repositories {
mavenCentral()
}
dependencies {
val coroutinesVersion = "1.8.0"
/** Kotlin --------------------------------------------------------- */
implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core-jvm:$coroutinesVersion")
/** Logging -------------------------------------------------------- */
implementation("io.github.oshai:kotlin-logging-jvm:6.0.3")
/** Testing -------------------------------------------------------- */
val spekVersion = "2.0.19"
testImplementation("org.slf4j:slf4j-simple:2.0.4")
testImplementation("com.github.doyaaaaaken:kotlin-csv-jvm:1.9.3")
testImplementation(kotlin("test"))
testImplementation("org.spekframework.spek2:spek-dsl-jvm:$spekVersion")
testRuntimeOnly("org.spekframework.spek2:spek-runner-junit5:$spekVersion")
testRuntimeOnly("org.junit.platform:junit-platform-commons:1.10.2")
testRuntimeOnly(kotlin("reflect"))
testRuntimeOnly("org.jetbrains.kotlinx:kotlinx-coroutines-swing:$coroutinesVersion")
}
sourceSets.main {
java.srcDirs("src/main/kotlin")
}
tasks {
withType(JavaCompile::class.java) {
options.release.set(11)
}
withType(KotlinCompile::class.java) {
kotlinOptions.jvmTarget = "11"
}
dokkaHtml {
outputDirectory.set(layout.buildDirectory.dir("javadoc"))
moduleName.set("KEvent")
dokkaSourceSets {
named("main") {
includes.from("module.md")
}
}
}
test {
testLogging.showStandardStreams = true
useJUnitPlatform {
doFirst { classpath.forEach { it.mkdirs() } }
jvmArgs = listOf(
"--add-exports", "org.junit.platform.commons/org.junit.platform.commons.util=ALL-UNNAMED",
"--add-exports", "org.junit.platform.commons/org.junit.platform.commons.logging=ALL-UNNAMED",
"--add-reads", "kevent=spek.dsl.jvm",
"--add-reads", "kevent=kotlin.test",
"--add-reads", "kevent=java.desktop"
)
includeEngines("spek2")
}
}
register<Jar>("javadocJar") {
archiveClassifier.set("javadoc")
from(dokkaHtml)
}
register<Jar>("sourcesJar") {
archiveClassifier.set("sources")
from(sourceSets["main"].allSource)
}
jar {
manifest.attributes(mapOf(
"Implementation-Title" to NAME,
"Implementation-Version" to project.version,
"Implementation-Vendor" to "RationalityFrontline"
))
}
}
publishing {
publications {
create<MavenPublication>("maven") {
from(components["java"])
artifact(tasks["sourcesJar"])
artifact(tasks["javadocJar"])
pom {
name.set(NAME)
description.set(DESC)
packaging = "jar"
url.set("https://github.com/$GITHUB_REPO")
licenses {
license {
name.set("The Apache Software License, Version 2.0")
url.set("https://www.apache.org/licenses/LICENSE-2.0.txt")
}
}
developers {
developer {
name.set("RationalityFrontline")
email.set("[email protected]")
organization.set("RationalityFrontline")
organizationUrl.set("https://github.com/RationalityFrontline")
}
}
scm {
connection.set("scm:git:git://github.com/$GITHUB_REPO.git")
developerConnection.set("scm:git:ssh://github.com:$GITHUB_REPO.git")
url.set("https://github.com/$GITHUB_REPO/tree/master")
}
}
}
}
repositories {
fun env(propertyName: String): String {
return if (project.hasProperty(propertyName)) {
project.property(propertyName) as String
} else "Unknown"
}
maven {
val releasesRepoUrl = uri("https://oss.sonatype.org/service/local/staging/deploy/maven2/")
val snapshotsRepoUrl = uri("https://oss.sonatype.org/content/repositories/snapshots/")
url = if (version.toString().endsWith("SNAPSHOT")) snapshotsRepoUrl else releasesRepoUrl
credentials {
username = env("ossrhUsername")
password = env("ossrhPassword")
}
}
}
}
signing {
sign(publishing.publications["maven"])
}