@@ -32,7 +32,7 @@ buildscript {
3232}
3333
3434group = " com.adamratzman"
35- version = " 3.4.03 "
35+ version = " 3.5.0-rc.1 "
3636
3737tasks.withType<Test > {
3838 this .testLogging {
@@ -94,7 +94,6 @@ kotlin {
9494 }
9595
9696 mavenPublication {
97- artifactId = " spotify-api-kotlin-android"
9897 setupPom(artifactId)
9998 }
10099
@@ -112,14 +111,12 @@ kotlin {
112111 }
113112
114113 mavenPublication {
115- artifactId = " spotify-api-kotlin"
116114 setupPom(artifactId)
117115 }
118116 }
119117
120118 js(KotlinJsCompilerType .LEGACY ) {
121119 mavenPublication {
122- artifactId = " spotify-api-kotlin-js"
123120 setupPom(artifactId)
124121 }
125122
@@ -147,11 +144,65 @@ kotlin {
147144 }
148145
149146 val hostOs = System .getProperty(" os.name" )
147+ val isMainHost = hostOs.contains(" mac" , true )
148+ // val isMainPlatform =
150149 val isMingwX64 = hostOs.startsWith(" Windows" )
151150
152- macosX64()
153- linuxX64()
154- mingwX64()
151+ macosX64 {
152+ mavenPublication {
153+ setupPom(artifactId)
154+ }
155+ }
156+ linuxX64 {
157+ mavenPublication {
158+ setupPom(artifactId)
159+ }
160+ }
161+ mingwX64 {
162+ mavenPublication {
163+ setupPom(artifactId)
164+ }
165+ }
166+
167+ val publicationsFromMainHost =
168+ listOf (jvm(), js()).map { it.name } + " kotlinMultiplatform"
169+
170+ publishing {
171+ publications {
172+ matching { it.name in publicationsFromMainHost }.all {
173+ val targetPublication = this @all
174+ tasks.withType<AbstractPublishToMaven >()
175+ .matching { it.publication == targetPublication }
176+ .configureEach { onlyIf { findProperty(" isMainHost" ) == " true" } }
177+ }
178+
179+ val kotlinMultiplatform by getting(MavenPublication ::class ) {
180+ artifactId = " spotify-api-kotlin-core"
181+ setupPom(artifactId)
182+ }
183+
184+ /* val metadata by getting(MavenPublication::class) {
185+ artifactId = "spotify-api-kotlin-metadata"
186+ setupPom(artifactId)
187+ }*/
188+ }
189+
190+ repositories {
191+ maven {
192+ name = " nexus"
193+ val releasesRepoUrl = " https://oss.sonatype.org/service/local/staging/deploy/maven2/"
194+ val snapshotsRepoUrl = " https://oss.sonatype.org/content/repositories/snapshots/"
195+ url = uri(if (version.toString().endsWith(" SNAPSHOT" )) snapshotsRepoUrl else releasesRepoUrl)
196+
197+ credentials {
198+ val nexusUsername: String? by project.extra
199+ val nexusPassword: String? by project.extra
200+ username = nexusUsername
201+ password = nexusPassword
202+ }
203+ }
204+ }
205+ }
155206
156207 targets {
157208 sourceSets {
@@ -276,35 +327,6 @@ kotlin {
276327 }
277328}
278329
279- publishing {
280- publications {
281- val kotlinMultiplatform by getting(MavenPublication ::class ) {
282- artifactId = " spotify-api-kotlin-core"
283- setupPom(artifactId)
284- }
285-
286- /* val metadata by getting(MavenPublication::class) {
287- artifactId = "spotify-api-kotlin-metadata"
288- setupPom(artifactId)
289- }*/
290- }
291-
292- repositories {
293- maven {
294- name = " nexus"
295- val releasesRepoUrl = " https://oss.sonatype.org/service/local/staging/deploy/maven2/"
296- val snapshotsRepoUrl = " https://oss.sonatype.org/content/repositories/snapshots/"
297- url = uri(if (version.toString().endsWith(" SNAPSHOT" )) snapshotsRepoUrl else releasesRepoUrl)
298-
299- credentials {
300- val nexusUsername: String? by project.extra
301- val nexusPassword: String? by project.extra
302- username = nexusUsername
303- password = nexusPassword
304- }
305- }
306- }
307- }
308330
309331signing {
310332 if (project.hasProperty(" signing.keyId" )
@@ -382,3 +404,4 @@ fun MavenPublication.setupPom(publicationName: String) {
382404 }
383405 }
384406}
407+
0 commit comments