-
Notifications
You must be signed in to change notification settings - Fork 1
/
build.gradle.kts
185 lines (160 loc) · 5.18 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
import org.gradle.kotlin.dsl.support.listFilesOrdered
import org.jetbrains.kotlin.gradle.ExperimentalWasmDsl
plugins {
kotlin("multiplatform") version "2.0.20"
id("maven-publish")
id("signing")
id("io.github.gradle-nexus.publish-plugin") version "1.3.0"
id("org.jetbrains.dokka") version "1.9.20"
}
val artifactVersion: String by extra
group = "at.asitplus"
version = artifactVersion
repositories {
mavenCentral()
}
val dokkaOutputDir = "$projectDir/docs"
tasks.dokkaHtml {
val moduleDesc = File("$rootDir/dokka-tmp.md").also {
it.createNewFile()
File("$rootDir/multibase.png").copyTo(File("$rootDir/docs/multibase.png"), overwrite = true)
}
val readme =
File("${rootDir}/README.md").readText().replaceFirst("# ", "")
val moduleTitle = "multibase"
moduleDesc.writeText("# Module $moduleTitle\n$readme"
)
moduleName.set(moduleTitle)
dokkaSourceSets {
named("commonMain") {
includes.from(moduleDesc)
sourceLink {
localDirectory.set(file("src/$name/kotlin"))
remoteUrl.set(
uri("https://github.com/a-sit-plus/multibase/tree/development/src/$name/kotlin").toURL()
)
// Suffix which is used to append the line number to the URL. Use #L for GitHub
remoteLineSuffix.set("#L")
}
}
}
outputDirectory.set(file("${rootDir}/docs"))
doLast {
rootDir.listFilesOrdered { it.extension.lowercase() == "png" || it.extension.lowercase() == "svg" }
.forEach { it.copyTo(File("$rootDir/docs/${it.name}"), overwrite = true) }
}
}
val deleteDokkaOutputDir by tasks.register<Delete>("deleteDokkaOutputDirectory") {
delete(dokkaOutputDir)
}
val javadocJar = tasks.register<Jar>("javadocJar") {
dependsOn(deleteDokkaOutputDir, tasks.dokkaHtml)
archiveClassifier.set("javadoc")
from(dokkaOutputDir)
}
//first sign everything, then publish!
tasks.withType<AbstractPublishToMaven>() {
tasks.withType<Sign>().forEach {
dependsOn(it)
}
}
kotlin {
macosArm64()
macosX64()
tvosArm64()
tvosX64()
tvosSimulatorArm64()
iosX64()
iosArm64()
iosSimulatorArm64()
jvmToolchain(17)
jvm {
compilations.all {
kotlinOptions {
freeCompilerArgs = listOf(
"-Xjsr305=strict"
)
}
}
withJava() //for Java Interop tests
}
listOf(
js(IR).apply { browser { testTask { enabled = false } } },
@OptIn(ExperimentalWasmDsl::class)
wasmJs().apply { browser { testTask { enabled = false } } }
).forEach {
it.nodejs()
}
linuxX64()
linuxArm64()
mingwX64()
sourceSets {
commonMain.dependencies {
implementation("com.ionspin.kotlin:bignum:0.3.10")
api("io.matthewnelson.encoding:base64:2.2.1")
api("io.matthewnelson.encoding:base32:2.2.1")
api("io.matthewnelson.encoding:base16:2.2.1")
}
commonTest.dependencies {
implementation(kotlin("test"))
}
}
repositories {
mavenCentral()
}
publishing {
publications {
withType<MavenPublication> {
artifact(javadocJar)
pom {
name.set("Multibase")
description.set("KMP Multibase Encoder/Decoder")
url.set("https://github.com/a-sit-plus/multibase")
licenses {
license {
name.set("MIT License")
url.set("https://opensource.org/licenses/MIT")
}
}
developers {
developer {
id.set("JesusMcCloud")
name.set("Bernd Prünster")
email.set("[email protected]")
}
developer {
id.set("n0900")
name.set("Simon Müller")
email.set("[email protected]")
}
}
scm {
connection.set("scm:git:[email protected]:a-sit-plus/multibase.git")
developerConnection.set("scm:git:[email protected]:a-sit-plus/multibase.git")
url.set("https://github.com/a-sit-plus/multibase")
}
}
}
}
repositories {
mavenLocal {
signing.isRequired = false
}
}
}
}
signing {
val signingKeyId: String? by project
val signingKey: String? by project
val signingPassword: String? by project
useInMemoryPgpKeys(signingKeyId, signingKey, signingPassword)
sign(publishing.publications)
}
nexusPublishing {
repositories {
sonatype {
nexusUrl.set(uri("https://s01.oss.sonatype.org/service/local/"))
snapshotRepositoryUrl.set(uri("https://s01.oss.sonatype.org/content/repositories/snapshots/"))
}
}
}