-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.gradle.kts
173 lines (158 loc) · 4.92 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
import com.github.benmanes.gradle.versions.updates.DependencyUpdatesTask
import org.jetbrains.kotlin.gradle.plugin.KotlinPlatformType
import org.jreleaser.model.Active
import org.jreleaser.model.Changelog
import org.jreleaser.model.Signing
plugins {
kotlin("jvm") version "2.0.21"
id("org.jetbrains.kotlin.plugin.serialization") version "2.1.0-RC2"
id("maven-publish")
id("org.jreleaser") version "1.16.0"
id("org.jetbrains.dokka") version "2.0.0"
id("signing")
id("com.github.ben-manes.versions") version "0.52.0"
}
java {
withJavadocJar()
withSourcesJar()
}
kotlin {
target {
attributes {
if (KotlinPlatformType.attribute !in this) {
attribute(KotlinPlatformType.attribute, KotlinPlatformType.androidJvm)
}
}
}
}
KotlinPlatformType.setupAttributesMatchingStrategy(dependencies.attributesSchema)
group = "io.github.chrisimx"
version = "1.3.0"
publishing {
publications {
create<MavenPublication>("Maven") {
from(components["java"])
groupId = group.toString()
artifactId = "esclkt"
description =
"An implementation of AirScan (eSCL) in Kotlin, making it easy to use network-attached scanners"
}
withType<MavenPublication> {
pom {
packaging = "jar"
name.set("esclkt")
description.set("eSCLKt: AirScan protocol (eSCL) in Kotlin")
url.set("https://github.com/chrisimx/eSCLKt")
inceptionYear.set("2024")
licenses {
license {
name.set("GPL-3.0-or-later")
url.set("https://www.gnu.org/licenses/gpl-3.0.html")
}
}
developers {
developer {
id.set("chrisimx")
name.set("Christian Nagel")
email.set("chris.imx@online.de")
}
}
scm {
connection.set("scm:git:git@github.com:Chrisimx/eSCLKt.git")
developerConnection.set("scm:git:ssh:git@github.com:Chrisimx/eSCLKt.git")
url.set("https://github.com/chrisimx/eSCLKt")
}
}
}
}
repositories {
maven {
url = layout.buildDirectory.dir("staging-deploy").get().asFile.toURI()
}
}
}
jreleaser {
project {
name = rootProject.name
versionPattern.set("SEMVER")
copyright.set("Christian Nagel and contributors")
}
gitRootSearch.set(true)
release {
github {
enabled = true
draft = true
changelog {
enabled = true
links = true
sort.set(Changelog.Sort.DESC)
formatted.set(Active.ALWAYS)
preset.set("conventional-commits")
format.set("- {{commitShortHash}} {{commitTitle}}")
append {
// Enables appending to an existing changelog file.
// Defaults to `false`.
//
enabled = true
}
contributors {
enabled = false
}
}
}
}
signing {
active.set(Active.ALWAYS)
mode.set(Signing.Mode.COMMAND)
armored.set(true)
command {
executable.set("gpg")
defaultKeyring = true
}
}
deploy {
maven {
mavenCentral {
create("sonatype") {
active.set(Active.ALWAYS)
url.set("https://central.sonatype.com/api/v1/publisher")
stagingRepositories.add("build/staging-deploy")
applyMavenCentralRules = true
maxRetries = 200
}
}
}
}
}
repositories {
mavenCentral()
}
dependencies {
implementation("io.github.pdvrieze.xmlutil:core:0.90.3")
implementation("io.github.pdvrieze.xmlutil:serialization:0.90.3")
implementation("com.squareup.okhttp3:okhttp:4.12.0")
testImplementation(kotlin("test"))
testImplementation("com.squareup.okhttp3:mockwebserver:4.12.0")
}
tasks.test {
useJUnitPlatform()
val testOutputDir = "testOutput"
mkdir(testOutputDir)
workingDir("$testOutputDir/")
}
tasks.jar {
enabled = true
// Remove `plain` postfix from jar file name
archiveClassifier.set("")
}
fun isNonStable(version: String): Boolean {
val stableKeyword = listOf("RELEASE", "FINAL", "GA").any { version.uppercase().contains(it) }
val regex = "^[0-9,.v-]+(-r)?$".toRegex()
val isStable = stableKeyword || regex.matches(version)
return isStable.not()
}
tasks.withType<DependencyUpdatesTask> {
rejectVersionIf {
isNonStable(candidate.version)
}
}