-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.gradle.kts
134 lines (120 loc) · 3.77 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
import org.jetbrains.kotlin.gradle.dsl.KotlinMultiplatformExtension
import org.jetbrains.kotlin.gradle.plugin.KotlinMultiplatformPluginWrapper
plugins {
alias(libs.plugins.kotlinMultiplatform) apply false
alias(libs.plugins.dokka) apply false
alias(libs.plugins.spotless)
}
allprojects {
buildscript {
repositories {
mavenCentral()
}
}
repositories {
mavenCentral()
}
}
subprojects {
plugins.withType<MavenPublishPlugin> {
apply(plugin = "org.gradle.signing")
plugins.withType<KotlinMultiplatformPluginWrapper> {
apply(plugin = libs.plugins.dokka.get().pluginId)
val dokkaHtml by tasks.existing(org.jetbrains.dokka.gradle.DokkaTask::class)
val javadocJar by tasks.registering(Jar::class) {
group = LifecycleBasePlugin.BUILD_GROUP
description = "Assembles a jar archive containing the Javadoc API documentation."
archiveClassifier.set("javadoc")
from(dokkaHtml)
}
configure<KotlinMultiplatformExtension> {
explicitApi()
jvm {
mavenPublication {
artifact(javadocJar.get())
}
}
ios()
}
}
configure<PublishingExtension> {
repositories {
maven {
name = "MavenCentral"
val releasesRepoUrl = uri("https://oss.sonatype.org/service/local/staging/deploy/maven2/")
val snapshotsRepoUrl = uri("https://oss.sonatype.org/content/repositories/snapshots/")
val versionName: String by project
url = if (versionName.endsWith("SNAPSHOT")) snapshotsRepoUrl else releasesRepoUrl
credentials {
username = project.property("NEXUS_USERNAME")?.toString()
password = project.property("NEXUS_PASSWORD")?.toString()
}
}
}
publications.withType<MavenPublication> {
val versionName: String by project
val pomGroupId: String by project
groupId = pomGroupId
version = versionName
pom {
val pomDescription: String by project
val pomUrl: String by project
val pomName: String by project
description.set(pomDescription)
url.set(pomUrl)
name.set(pomName)
scm {
val pomScmUrl: String by project
val pomScmConnection: String by project
val pomScmDevConnection: String by project
url.set(pomScmUrl)
connection.set(pomScmConnection)
developerConnection.set(pomScmDevConnection)
}
licenses {
license {
val pomLicenseName: String by project
val pomLicenseUrl: String by project
val pomLicenseDist: String by project
name.set(pomLicenseName)
url.set(pomLicenseUrl)
distribution.set(pomLicenseDist)
}
}
developers {
developer {
val pomDeveloperId: String by project
val pomDeveloperName: String by project
id.set(pomDeveloperId)
name.set(pomDeveloperName)
}
}
}
}
configure<SigningExtension> {
sign(publications)
}
}
}
}
spotless {
kotlin {
target("**/*.kt")
targetExclude("!**/build/**/*.*")
ktlint(libs.versions.ktlint.get())
.editorConfigOverride(
mapOf("indent_size" to "2", "max_line_length" to "120", "disabled_rules" to "trailing-comma")
)
trimTrailingWhitespace()
endWithNewline()
}
kotlinGradle {
target("**/*.gradle.kts")
ktlint(libs.versions.ktlint.get())
.editorConfigOverride(
mapOf("indent_size" to "2", "max_line_length" to "120", "disabled_rules" to "trailing-comma")
)
trimTrailingWhitespace()
endWithNewline()
}
}