@@ -11,6 +11,7 @@ plugins {
11
11
`java- library`
12
12
`java- test- fixtures`
13
13
`maven- publish`
14
+ `signing`
14
15
}
15
16
16
17
val repoUrl = " https://github.com/gabrielfeo/gradle-enterprise-api-kotlin"
@@ -172,15 +173,6 @@ tasks.named<Jar>("javadocJar") {
172
173
from(tasks.dokkaHtml)
173
174
}
174
175
175
- publishing {
176
- publications {
177
- create<MavenPublication >(" library" ) {
178
- artifactId = " gradle-enterprise-api-kotlin"
179
- from(components[" java" ])
180
- }
181
- }
182
- }
183
-
184
176
testing {
185
177
suites {
186
178
getByName<JvmTestSuite >(" test" ) {
@@ -192,7 +184,6 @@ testing {
192
184
}
193
185
register<JvmTestSuite >(" integrationTest" ) {
194
186
dependencies {
195
- // implementation(project())
196
187
implementation(" org.jetbrains.kotlinx:kotlinx-coroutines-test:1.7.1" )
197
188
}
198
189
}
@@ -229,3 +220,65 @@ dependencies {
229
220
implementation(" com.squareup.retrofit2:converter-scalars:2.9.0" )
230
221
api(" org.jetbrains.kotlinx:kotlinx-coroutines-core:1.7.1" )
231
222
}
223
+
224
+ publishing {
225
+ publications {
226
+ create<MavenPublication >(" library" ) {
227
+ artifactId = " gradle-enterprise-api-kotlin"
228
+ from(components[" java" ])
229
+ pom {
230
+ name.set(" Gradle Enterprise API Kotlin" )
231
+ description.set(" A library to use the Gradle Enterprise REST API in Kotlin" )
232
+ url.set(" https://github.com/gabrielfeo/gradle-enterprise-api-kotlin" )
233
+ licenses {
234
+ license {
235
+ name.set(" MIT" )
236
+ url.set(" https://spdx.org/licenses/MIT.html" )
237
+ distribution.set(" repo" )
238
+ }
239
+ }
240
+ developers {
241
+ developer {
242
+ id.set(" gabrielfeo" )
243
+ name.set(" Gabriel Feo" )
244
+
245
+ }
246
+ }
247
+ scm {
248
+ val basicUrl = " github.com/gabrielfeo/gradle-enterprise-api-kotlin"
249
+ connection.set(" scm:git:git://$basicUrl .git" )
250
+ developerConnection.set(" scm:git:ssh://$basicUrl .git" )
251
+ url.set(" https://$basicUrl /" )
252
+ }
253
+ }
254
+ }
255
+ }
256
+ repositories {
257
+ maven {
258
+ name = " mavenCentral"
259
+ val releasesRepoUrl = uri(" https://s01.oss.sonatype.org/service/local/staging/deploy/maven2/" )
260
+ val snapshotsRepoUrl = uri(" https://s01.oss.sonatype.org/content/repositories/snapshots/" )
261
+ val isSnapshot = version.toString().endsWith(" SNAPSHOT" )
262
+ url = if (isSnapshot) snapshotsRepoUrl else releasesRepoUrl
263
+ authentication {
264
+ register<BasicAuthentication >(" basic" )
265
+ }
266
+ credentials {
267
+ username = project.properties[" maven.central.username" ] as String?
268
+ password = project.properties[" maven.central.password" ] as String?
269
+ }
270
+ }
271
+ }
272
+ }
273
+
274
+ fun isCI () = System .getenv(" CI" ).toBoolean()
275
+
276
+ signing {
277
+ sign(publishing.publications[" library" ])
278
+ if (isCI()) {
279
+ useInMemoryPgpKeys(
280
+ project.properties[" signing.secretKey" ] as String? ,
281
+ project.properties[" signing.password" ] as String? ,
282
+ )
283
+ }
284
+ }
0 commit comments