-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.gradle.kts
208 lines (172 loc) · 6.52 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
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
/*
* SLF4K - A set of SLF4J extensions for Kotlin to make logging more idiomatic.
* Copyright (c) 2021-2024 solonovamax <[email protected]>
*
* The file build.gradle.kts is part of SLF4K
* Last modified on 22-09-2024 09:55 p.m.
*
* MIT License
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* SLF4K IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
@file:Suppress("UnstableApiUsage")
import ca.solostudios.nyx.util.reposiliteMaven
import ca.solostudios.nyx.util.soloStudios
import java.io.Serializable
import java.time.Year
import org.jetbrains.dokka.base.DokkaBase
import org.jetbrains.dokka.base.DokkaBaseConfiguration
import org.jetbrains.dokka.gradle.DokkaTask
import kotlin.math.max
plugins {
java
signing
`java-library`
`maven-publish`
alias(libs.plugins.kotlin.jvm)
alias(libs.plugins.kotlin.ksp)
alias(libs.plugins.dokka)
alias(libs.plugins.axion.release)
alias(libs.plugins.nyx)
}
nyx {
info {
name = "SLF4K"
module = "slf4k"
group = "ca.solo-studios"
version = scmVersion.version
description = """
A set of SLF4J extensions for Kotlin to make logging more idiomatic.
""".trimIndent()
organizationName = "Solo Studios"
organizationUrl = "https://solo-studios.ca/"
repository.fromGithub("solo-studios", "SLF4K")
license.useMIT()
developer {
id.set("solonovamax")
name.set("solonovamax")
email.set("[email protected]")
url.set("https://github.com/solonovamax")
}
}
compile {
jvmTarget = 8
sourcesJar = true
javadocJar = true
allWarnings = true
warningsAsErrors = true
distributeLicense = true
buildDependsOnJar = true
reproducibleBuilds = true
kotlin {
withExplicitApi()
apiVersion = "1.7"
}
}
publishing {
withSignedPublishing()
repositories {
maven {
name = "SonatypeStaging"
val repositoryId: String? by project
url = when {
repositoryId != null -> uri("https://s01.oss.sonatype.org/service/local/staging/deployByRepositoryId/$repositoryId/")
else -> uri("https://s01.oss.sonatype.org/service/local/staging/deploy/maven2/")
}
credentials(PasswordCredentials::class)
}
reposiliteMaven {
name = "SoloStudiosReleases"
url = uri("https://maven.solo-studios.ca/releases/")
credentials(PasswordCredentials::class)
}
reposiliteMaven {
name = "SoloStudiosSnapshots"
url = uri("https://maven.solo-studios.ca/snapshots/")
credentials(PasswordCredentials::class)
}
}
}
}
repositories {
soloStudios()
mavenCentral()
}
dependencies {
implementation(libs.kotlin.stdlib)
implementation(libs.kotlin.reflect)
api(libs.slf4j)
compileOnlyApi(libs.kotlinx.coroutines)
compileOnlyApi(libs.kotlinx.coroutines.slf4j)
kspTest(libs.ksp.service)
testCompileOnly(libs.ksp.service)
testImplementation(libs.slf4j.simple)
testImplementation(libs.kotlin.test)
testImplementation(libs.kotlinx.coroutines)
testImplementation(libs.kotlinx.coroutines.test)
testImplementation(libs.kotlinx.coroutines.debug)
testImplementation(libs.bundles.junit)
}
tasks {
withType<Test>().configureEach {
useJUnitPlatform()
failFast = false
maxParallelForks = max(Runtime.getRuntime().availableProcessors() - 1, 1)
}
val processDokkaIncludes by registering(ProcessResources::class) {
group = JavaBasePlugin.DOCUMENTATION_GROUP
description = "Processes the included dokka files"
val projectInfo = ProjectInfo(nyx.info.group, nyx.info.module.get(), nyx.info.version)
inputs.property("projectInfo", projectInfo)
from(projectDir.resolve("dokka/includes")) {
filesMatching("Module.md") {
expand(
"project" to projectInfo,
"versions" to mapOf(
"slf4j" to libs.versions.slf4j.get(),
"kotlinxCoroutines" to libs.versions.kotlinx.coroutines.get(),
),
)
}
}
destinationDir = layout.buildDirectory.dir("dokka-include").map { it.asFile }.get()
}
withType<DokkaTask>().configureEach {
group = JavaBasePlugin.DOCUMENTATION_GROUP
dependsOn(processDokkaIncludes)
pluginConfiguration<DokkaBase, DokkaBaseConfiguration> {
footerMessage = "© ${Year.now()} Copyright solo-studios"
separateInheritedMembers = true
}
dokkaSourceSets.configureEach {
includes.from(processDokkaIncludes.map { it.destinationDir.walk().filter { file -> file.isFile }.toList() })
jdkVersion.set(8)
reportUndocumented.set(true)
// Documentation link
sourceLink {
localDirectory = projectDir.resolve("src")
remoteUrl = nyx.info.repository.projectUrl.map { uri("$it/tree/master/src").toURL() }
remoteLineSuffix = "#L"
}
val slf4jDocsUrl = "https://www.slf4j.org/api/"
externalDocumentationLink(slf4jDocsUrl, "$slf4jDocsUrl/element-list")
}
}
}
data class ProjectInfo(val group: String, val module: String, val version: String) : Serializable