Skip to content

Commit 8b19f15

Browse files
committed
set up multiplatform publishing
1 parent c0f78cb commit 8b19f15

File tree

1 file changed

+41
-28
lines changed

1 file changed

+41
-28
lines changed

build.gradle.kts

Lines changed: 41 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ plugins {
1515
}
1616

1717
group = "com.adamratzman"
18-
version = "3.1.02"
18+
version = "3.1.03"
1919

2020
java {
2121
withSourcesJar()
@@ -133,6 +133,16 @@ kotlin {
133133

134134
publishing {
135135
publications {
136+
val js by getting(MavenPublication::class) {
137+
artifactId = "spotify-api-kotlin-js"
138+
setupPom("spotify-api-kotlin-js")
139+
}
140+
141+
val kotlinMultiplatform by getting(MavenPublication::class) {
142+
artifactId = "spotify-api-kotlin-core"
143+
setupPom("spotify-api-kotlin-core")
144+
}
145+
136146
val jvm by getting(MavenPublication::class) {
137147
artifactId = "spotify-api-kotlin"
138148
artifact(tasks.getByName("javadocJar"))
@@ -145,31 +155,7 @@ publishing {
145155
}
146156
}
147157

148-
pom {
149-
name.set("spotify-api-kotlin")
150-
description.set("A Kotlin wrapper for the Spotify Web API.")
151-
url.set("https://github.com/adamint/spotify-web-api-kotlin")
152-
inceptionYear.set("2018")
153-
scm {
154-
url.set("https://github.com/adamint/spotify-web-api-kotlin")
155-
connection.set("scm:https://github.com/adamint/spotify-web-api-kotlin.git")
156-
developerConnection.set("scm:git://github.com/adamint/spotify-web-api-kotlin.git")
157-
}
158-
licenses {
159-
license {
160-
name.set("The Apache Software License, Version 2.0")
161-
url.set("http://www.apache.org/licenses/LICENSE-2.0.txt")
162-
distribution.set("repo")
163-
}
164-
}
165-
developers {
166-
developer {
167-
id.set("adamratzman")
168-
name.set("Adam Ratzman")
169-
email.set("[email protected]")
170-
}
171-
}
172-
}
158+
setupPom("spotify-api-kotlin")
173159
}
174160
}
175161
repositories {
@@ -204,8 +190,7 @@ publishing {
204190

205191
signing {
206192
if (System.getenv("publishLocation") == "nexus") {
207-
sign(publishing.publications["jvm"])
208-
sign(publishing.publications["js"])
193+
sign(publishing.publications)
209194
}
210195
}
211196

@@ -318,4 +303,32 @@ tasks {
318303
dependsOn.add(dokka)
319304
dependsOn.add("publishJvmPublicationToNexusRepository")
320305
}
306+
}
307+
308+
fun MavenPublication.setupPom(publicationName: String) {
309+
pom {
310+
name.set(publicationName)
311+
description.set("A Kotlin wrapper for the Spotify Web API.")
312+
url.set("https://github.com/adamint/spotify-web-api-kotlin")
313+
inceptionYear.set("2018")
314+
scm {
315+
url.set("https://github.com/adamint/spotify-web-api-kotlin")
316+
connection.set("scm:https://github.com/adamint/spotify-web-api-kotlin.git")
317+
developerConnection.set("scm:git://github.com/adamint/spotify-web-api-kotlin.git")
318+
}
319+
licenses {
320+
license {
321+
name.set("The Apache Software License, Version 2.0")
322+
url.set("http://www.apache.org/licenses/LICENSE-2.0.txt")
323+
distribution.set("repo")
324+
}
325+
}
326+
developers {
327+
developer {
328+
id.set("adamratzman")
329+
name.set("Adam Ratzman")
330+
email.set("[email protected]")
331+
}
332+
}
333+
}
321334
}

0 commit comments

Comments
 (0)