1
1
import org.jetbrains.dokka.gradle.DokkaTask
2
2
import org.jetbrains.kotlin.gradle.targets.js.webpack.KotlinWebpackOutput.Target
3
- import java.net.URI
4
3
5
4
plugins {
6
5
`maven- publish`
@@ -32,7 +31,7 @@ buildscript {
32
31
}
33
32
34
33
group = " com.adamratzman"
35
- version = " 3.1.03 "
34
+ version = " 3.2.0 "
36
35
37
36
/* java {
38
37
withSourcesJar()
@@ -73,13 +72,36 @@ android {
73
72
}
74
73
}
75
74
75
+ val dokkaJar by tasks.registering(Jar ::class ) {
76
+ group = JavaBasePlugin .DOCUMENTATION_GROUP
77
+ description = " Docs"
78
+ classifier = " javadoc"
79
+ from(tasks.dokka)
80
+ }
81
+
76
82
kotlin {
77
- android() {
83
+ android {
84
+ mavenPublication {
85
+ artifactId = " spotify-api-kotlin-android"
86
+ setupPom(artifactId)
87
+ }
88
+
89
+ publishLibraryVariants(" release" )
90
+ }
78
91
92
+ jvm {
93
+ mavenPublication {
94
+ artifactId = " spotify-api-kotlin"
95
+ setupPom(artifactId)
96
+ }
79
97
}
80
98
81
- jvm()
82
99
js {
100
+ mavenPublication {
101
+ artifactId = " spotify-api-kotlin-js"
102
+ setupPom(artifactId)
103
+ }
104
+
83
105
browser {
84
106
dceTask {
85
107
keep(" ktor-ktor-io.\$\$ importsForInline\$\$ .ktor-ktor-io.io.ktor.utils.io" )
@@ -201,101 +223,42 @@ kotlin {
201
223
202
224
publishing {
203
225
publications {
204
- val js by getting(MavenPublication ::class ) {
205
- artifactId = " com.adamratzman.spotify-api-kotlin-js"
206
- setupPom(" com.adamratzman.spotify-api-kotlin-js" )
207
- }
208
-
209
226
val kotlinMultiplatform by getting(MavenPublication ::class ) {
210
- artifactId = " com.adamratzman. spotify-api-kotlin-core"
211
- setupPom(" com.adamratzman.spotify-api-kotlin-core " )
227
+ artifactId = " spotify-api-kotlin-core"
228
+ setupPom(artifactId )
212
229
}
213
230
214
- val jvm by getting(MavenPublication ::class ) {
215
- artifactId = " com.adamratzman.spotify-api-kotlin"
216
- // artifact(tasks.getByName("javadocJar"))
217
- versionMapping {
218
- usage(" java-api" ) {
219
- fromResolutionOf(" runtimeClasspath" )
220
- }
221
- usage(" java-runtime" ) {
222
- fromResolutionResult()
223
- }
224
- }
225
-
226
- setupPom(" com.adamratzman.spotify-api-kotlin" )
231
+ val metadata by getting(MavenPublication ::class ) {
232
+ artifactId = " spotify-api-kotlin-metadata"
233
+ setupPom(artifactId)
227
234
}
228
235
}
236
+
229
237
repositories {
230
- if (System .getenv(" publishLocation" ) == " nexus" ) {
231
- maven {
232
- name = " nexus"
233
- val releasesRepoUrl = " https://oss.sonatype.org/service/local/staging/deploy/maven2/"
234
- val snapshotsRepoUrl = " https://oss.sonatype.org/content/repositories/snapshots/"
235
- url = uri(if (version.toString().endsWith(" SNAPSHOT" )) snapshotsRepoUrl else releasesRepoUrl)
236
-
237
- credentials {
238
- val nexusUsername: String? by project.extra
239
- val nexusPassword: String? by project.extra
240
- username = nexusUsername
241
- password = nexusPassword
242
- }
243
- }
244
- } else {
245
- if (project.extra.has(" spaceUser" ) && project.extra.has(" spacePassword" )) {
246
- maven {
247
- credentials {
248
- username = project.extra[" spaceUser" ]?.toString()
249
- password = project.extra[" spacePassword" ]?.toString()
250
- }
251
-
252
- url = URI .create(" https://maven.jetbrains.space/adam/ratzman" )
253
- }
238
+ maven {
239
+ name = " nexus"
240
+ val releasesRepoUrl = " https://oss.sonatype.org/service/local/staging/deploy/maven2/"
241
+ val snapshotsRepoUrl = " https://oss.sonatype.org/content/repositories/snapshots/"
242
+ url = uri(if (version.toString().endsWith(" SNAPSHOT" )) snapshotsRepoUrl else releasesRepoUrl)
243
+
244
+ credentials {
245
+ val nexusUsername: String? by project.extra
246
+ val nexusPassword: String? by project.extra
247
+ username = nexusUsername
248
+ password = nexusPassword
254
249
}
255
250
}
256
251
}
257
252
}
258
253
259
254
signing {
260
- if (System .getenv(" publishLocation" ) == " nexus" ) {
261
- sign(publishing.publications)
262
- }
263
- }
264
-
265
- // get signing confs interactively if needed
266
- gradle.taskGraph.whenReady {
267
- val alreadyConfigured = with (project.extra) {
268
- (has(" signing.keyId" ) && has(" signing.secretKeyRingFile" ) && has(" signing.password" ))
269
- || (has(" signing.notNeeded" ) && get(" signing.notNeeded" ) == " true" )
270
- }
271
- if (! alreadyConfigured && allTasks.any { it is Sign }) {
272
- // Use Java's console to read from the console (no good for
273
- // a CI environment)
274
- val console = System .console()
275
- requireNotNull(console) { " Could not get signing config: please provide yours in the gradle.properties file." }
276
- console.printf(
277
- " \n\n We have to sign some things in this build." +
278
- " \n\n Please enter your signing details.\n\n "
279
- )
280
-
281
- val id = console.readLine(" PGP Key Id: " )
282
- val file = console.readLine(" PGP Secret Key Ring File (absolute path): " )
283
- val password = console.readPassword(" PGP Private Key Password: " )
284
-
285
- allprojects {
286
- project.extra[" signing.keyId" ] = id
287
- project.extra[" signing.secretKeyRingFile" ] = file
288
- project.extra[" signing.password" ] = password
289
- }
290
-
291
- console.printf(" \n Thanks.\n\n " )
292
- }
255
+ sign(publishing.publications)
293
256
}
294
257
295
258
tasks {
296
259
val dokka by getting(DokkaTask ::class ) {
297
- outputDirectory = " docs/docs"
298
260
outputFormat = " html"
261
+ outputDirectory = " $buildDir /javadoc"
299
262
300
263
multiplatform {
301
264
val js by creating {
@@ -344,10 +307,6 @@ tasks {
344
307
from(javadoc)
345
308
}*/
346
309
347
- artifacts {
348
- // archives(javadocJar)
349
- }
350
-
351
310
spotless {
352
311
kotlin {
353
312
target(" **/*.kt" )
@@ -374,7 +333,10 @@ tasks {
374
333
375
334
}
376
335
336
+
377
337
fun MavenPublication.setupPom (publicationName : String ) {
338
+ artifact(dokkaJar.get())
339
+
378
340
pom {
379
341
name.set(publicationName)
380
342
description.set(" A Kotlin wrapper for the Spotify Web API." )
0 commit comments