-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathbuild.gradle.kts
More file actions
118 lines (106 loc) · 3.15 KB
/
build.gradle.kts
File metadata and controls
118 lines (106 loc) · 3.15 KB
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
plugins {
java
`maven-publish`
signing
alias(libs.plugins.kotlin.jvm)
alias(libs.plugins.spotless)
alias(libs.plugins.publish)
alias(libs.plugins.release)
}
val isReleaseVersion = !version.toString().endsWith("SNAPSHOT")
repositories {
mavenCentral()
}
dependencies {
}
kotlin {
jvmToolchain(17)
}
spotless {
kotlin {
target("**/*.kt")
targetExclude("**/build/**/*.kt")
ktlint()
suppressLintsFor {
step = "ktlint"
shortCode = "standard:no-wildcard-imports"
}
suppressLintsFor {
step = "ktlint"
shortCode = "standard:backing-property-naming"
}
}
kotlinGradle {
target("**/*.gradle.kts")
ktlint()
}
}
tasks {
build {
dependsOn(spotlessApply)
}
}
configure(subprojects.filter { !it.name.startsWith("example") }) {
apply(plugin = "java")
apply(plugin = "maven-publish")
apply(plugin = "signing")
java {
withJavadocJar()
withSourcesJar()
}
publishing {
publications {
create<MavenPublication>("maven") {
from(components["java"])
pom {
val projectUrl: String by project
name.set(project.name)
description.set(project.description)
url.set(projectUrl)
licenses {
license {
name.set("The Apache Software License, Version 2.0")
url.set("https://www.apache.org/licenses/LICENSE-2.0.txt")
}
}
developers {
developer {
id.set("nakamura-to")
name.set("Toshihiro Nakamura")
email.set("toshihiro.nakamura@gmail.com")
}
}
scm {
val githubUrl: String by project
connection.set("scm:git:$githubUrl")
developerConnection.set("scm:git:$githubUrl")
url.set(projectUrl)
}
}
}
}
}
signing {
val signingKey: String? by project
val signingPassword: String? by project
useInMemoryPgpKeys(signingKey, signingPassword)
val publishing = extensions.getByType(PublishingExtension::class)
sign(publishing.publications)
isRequired = isReleaseVersion
}
}
rootProject.apply {
nexusPublishing {
repositories {
// see https://central.sonatype.org/publish/publish-portal-ossrh-staging-api/#configuration
sonatype {
nexusUrl.set(uri("https://ossrh-staging-api.central.sonatype.com/service/local/"))
snapshotRepositoryUrl.set(uri("https://central.sonatype.com/repository/maven-snapshots/"))
}
}
}
release {
newVersionCommitMessage.set("[Gradle Release Plugin] - [skip ci] new version commit: ")
tagTemplate.set("v\$version")
}
}