@@ -38,7 +38,6 @@ System.getenv("signing.keyId")?.let { project.ext["signing.keyId"] = it }
38
38
System .getenv(" signing.password" )?.let { project.ext[" signing.password" ] = it }
39
39
System .getenv(" signing.secretKeyRingFile" )?.let { project.ext[" signing.secretKeyRingFile" ] = it }
40
40
41
-
42
41
tasks.withType<Test > {
43
42
this .testLogging {
44
43
this .showStandardStreams = true
@@ -173,40 +172,7 @@ kotlin {
173
172
listOf (jvm(), js()).map { it.name } + " kotlinMultiplatform"
174
173
175
174
publishing {
176
- publications {
177
- matching { it.name in publicationsFromMainHost }.all {
178
- val targetPublication = this @all
179
- tasks.withType<AbstractPublishToMaven >()
180
- .matching { it.publication == targetPublication }
181
- .configureEach { onlyIf { findProperty(" isMainHost" ) == " true" } }
182
- }
183
-
184
- val kotlinMultiplatform by getting(MavenPublication ::class ) {
185
- artifactId = " spotify-api-kotlin-core"
186
- setupPom(artifactId)
187
- }
188
-
189
- /* val metadata by getting(MavenPublication::class) {
190
- artifactId = "spotify-api-kotlin-metadata"
191
- setupPom(artifactId)
192
- }*/
193
- }
194
-
195
- repositories {
196
- maven {
197
- name = " nexus"
198
- val releasesRepoUrl = " https://oss.sonatype.org/service/local/staging/deploy/maven2/"
199
- val snapshotsRepoUrl = " https://oss.sonatype.org/content/repositories/snapshots/"
200
- url = uri(if (version.toString().endsWith(" SNAPSHOT" )) snapshotsRepoUrl else releasesRepoUrl)
201
-
202
- credentials {
203
- val nexusUsername: String? = System .getenv(" nexus.username" ) ? : if (project.extra.has(" nexusUsername" )) project.extra[" nexusUsername" ] as ? String else null
204
- val nexusPassword: String? = System .getenv(" nexus.password" ) ? : if (project.extra.has(" nexusPassword" )) project.extra[" nexusPassword" ] as ? String else null
205
- username = nexusUsername
206
- password = nexusPassword
207
- }
208
- }
209
- }
175
+ registerPublishing()
210
176
}
211
177
212
178
targets {
@@ -330,6 +296,10 @@ kotlin {
330
296
}
331
297
}
332
298
299
+ publishing {
300
+ registerPublishing()
301
+ }
302
+
333
303
signing {
334
304
if (project.hasProperty(" signing.keyId" )
335
305
&& project.hasProperty(" signing.password" )
@@ -408,3 +378,32 @@ fun MavenPublication.setupPom(publicationName: String) {
408
378
}
409
379
}
410
380
381
+ fun PublishingExtension.registerPublishing () {
382
+ publications {
383
+ val kotlinMultiplatform by getting(MavenPublication ::class ) {
384
+ artifactId = " spotify-api-kotlin-core"
385
+ setupPom(artifactId)
386
+ }
387
+
388
+ /* val metadata by getting(MavenPublication::class) {
389
+ artifactId = "spotify-api-kotlin-metadata"
390
+ setupPom(artifactId)
391
+ }*/
392
+ }
393
+
394
+ repositories {
395
+ maven {
396
+ name = " nexus"
397
+ val releasesRepoUrl = " https://oss.sonatype.org/service/local/staging/deploy/maven2/"
398
+ val snapshotsRepoUrl = " https://oss.sonatype.org/content/repositories/snapshots/"
399
+ url = uri(if (version.toString().endsWith(" SNAPSHOT" )) snapshotsRepoUrl else releasesRepoUrl)
400
+
401
+ credentials {
402
+ val nexusUsername: String? = System .getenv(" nexus.username" ) ? : if (project.extra.has(" nexusUsername" )) project.extra[" nexusUsername" ] as ? String else null
403
+ val nexusPassword: String? = System .getenv(" nexus.password" ) ? : if (project.extra.has(" nexusPassword" )) project.extra[" nexusPassword" ] as ? String else null
404
+ username = nexusUsername
405
+ password = nexusPassword
406
+ }
407
+ }
408
+ }
409
+ }
0 commit comments