-
Notifications
You must be signed in to change notification settings - Fork 2
/
build.gradle.kts
149 lines (131 loc) · 4.79 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
import com.github.benmanes.gradle.versions.updates.DependencyUpdatesTask
import io.gitlab.arturbosch.detekt.Detekt
import io.gitlab.arturbosch.detekt.DetektCreateBaselineTask
import org.jetbrains.kotlin.gradle.dsl.JvmTarget
plugins {
id("org.jetbrains.kotlin.jvm") version "2.0.21"
id("com.github.mfarsikov.kewt-versioning") version "1.0.0"
id("se.patrikerdes.use-latest-versions") version "0.2.18"
id("com.github.ben-manes.versions") version "0.51.0"
id("java-library")
id("maven-publish")
id("org.gradle.signing")
id("io.github.gradle-nexus.publish-plugin") version "2.0.0"
id("org.jlleitschuh.gradle.ktlint") version "12.1.1"
id("com.adarshr.test-logger") version "4.0.0"
id("io.gitlab.arturbosch.detekt") version "1.23.7"
}
allprojects {
apply {
plugin("com.github.mfarsikov.kewt-versioning")
plugin("se.patrikerdes.use-latest-versions")
plugin("com.github.ben-manes.versions")
plugin("java-library")
plugin("maven-publish")
plugin("org.gradle.signing")
plugin("org.jetbrains.kotlin.jvm")
plugin("org.jlleitschuh.gradle.ktlint")
plugin("com.adarshr.test-logger")
plugin("io.gitlab.arturbosch.detekt")
}
repositories {
mavenCentral()
}
kewtVersioning.configuration {
separator = ""
}
version = kewtVersioning.version
group = "io.github.open-coap"
java {
sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8
}
kotlin {
compilerOptions {
jvmTarget.set(JvmTarget.JVM_1_8)
freeCompilerArgs.add("-Werror")
}
}
tasks {
withType<Detekt>().configureEach {
jvmTarget = "1.8"
}
withType<DetektCreateBaselineTask>().configureEach {
jvmTarget = "1.8"
}
withType<DependencyUpdatesTask> {
rejectVersionIf {
val stableKeyword = listOf("RELEASE", "FINAL", "GA").any { candidate.version.uppercase().contains(it) }
val regex = "^[0-9,.v-]+(-r)?$".toRegex()
val isNonStable = !(stableKeyword || regex.matches(candidate.version))
// newer version of logback-classic is not java8 compatible
// newer version of kewt-versioning plugin requires java 21
isNonStable || listOf("logback-classic", "com.github.mfarsikov.kewt-versioning.gradle.plugin").contains(candidate.module)
}
}
create<Jar>("sourceJar") {
archiveClassifier.set("sources")
from(sourceSets["main"].allSource)
}
create<Jar>("javadocJar") {
archiveClassifier.set("javadoc")
from(javadoc)
}
}
detekt {
source.setFrom("$projectDir/src/main/kotlin")
config.setFrom("$rootDir/detekt.yml")
buildUponDefaultConfig = true
}
publishing {
publications {
create<MavenPublication>("OSSRH") {
from(components["java"])
groupId = "io.github.open-coap"
artifact(tasks["javadocJar"])
artifact(tasks["sourceJar"])
pom {
name.set("Kotlin mbedtls")
description.set("Bridge of mbedtls and jvm (kotlin)")
url.set("https://github.com/open-coap/kotlin-mbedtls")
scm {
url.set("https://github.com/open-coap/kotlin-mbedtls")
}
licenses {
license {
name.set("Apache License, Version 2.0")
url.set("https://www.apache.org/licenses/LICENSE-2.0.txt")
}
}
developers {
developer {
name.set("Szymon Sasin")
email.set("[email protected]")
}
}
}
}
}
}
signing {
val signingKeyId: String? by project
val signingKey: String? by project
val signingPassword: String? by project
if (signingKey != null) {
useInMemoryPgpKeys(signingKeyId, signingKey, signingPassword)
sign(publishing.publications["OSSRH"])
}
}
}
nexusPublishing {
repositories {
sonatype {
val ossrhUserName: String? by project
val ossrhPassword: String? by project
nexusUrl.set(uri("https://s01.oss.sonatype.org/service/local/"))
snapshotRepositoryUrl.set(uri("https://s01.oss.sonatype.org/content/repositories/snapshots/"))
username.set(ossrhUserName)
password.set(ossrhPassword)
}
}
}