Skip to content

Commit 45eb9ac

Browse files
Merge pull request #7 from michallaskowski/fix-pom-meta-and-signing
Fix pom meta and signing
2 parents 7706a62 + f1fdf8a commit 45eb9ac

File tree

2 files changed

+58
-17
lines changed

2 files changed

+58
-17
lines changed

gradle/publish.gradle

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
apply plugin: 'maven-publish'
2+
apply plugin: 'signing'
3+
4+
publishing {
5+
publications.all { publication ->
6+
def publicationName = publication.name == 'kotlinMultiplatform' ? "common" : publication.name
7+
publication.artifactId = "mokttp-$publicationName"
8+
9+
pom {
10+
name = "mokttp"
11+
description = "Kotlin Multiplatform wrapper for HTTP server libraries - " +
12+
"GCDWebServers (iOS) and OkHttp's MockWebServer (Android)"
13+
url = "https://github.com/michallaskowski/mokttp"
14+
licenses {
15+
license {
16+
name = 'The Apache License, Version 2.0'
17+
url = 'http://www.apache.org/licenses/LICENSE-2.0.txt'
18+
}
19+
}
20+
scm {
21+
url = "https://github.com/michallaskowski/mokttp.git"
22+
}
23+
developers {
24+
developer {
25+
id = 'michallaskowski'
26+
name = 'Michal Laskowski'
27+
28+
}
29+
}
30+
}
31+
}
32+
33+
repositories {
34+
maven {
35+
name = "central"
36+
def snapshotRepoUrl = "https://oss.sonatype.org/content/repositories/snapshots"
37+
def stagingRepoUrl = "https://oss.sonatype.org/service/local/staging/deploy/maven2"
38+
url = version.endsWith('SNAPSHOT') ? snapshotRepoUrl : stagingRepoUrl
39+
credentials {
40+
username = System.getenv("MAVEN_USERNAME")
41+
password = System.getenv("MAVEN_PASSWORD")
42+
}
43+
}
44+
}
45+
}
46+
47+
signing {
48+
required { isReleaseBuild() }
49+
if (isReleaseBuild()) {
50+
useInMemoryPgpKeys(System.getenv("PGP_SIGNING_KEY"), System.getenv("PGP_SIGNING_PASSWORD"))
51+
sign publishing.publications
52+
}
53+
}
54+
55+
def isReleaseBuild() {
56+
return !scmVersion.version.contains("SNAPSHOT")
57+
}

library/build.gradle

Lines changed: 1 addition & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -3,23 +3,7 @@ apply plugin: 'maven'
33
apply plugin: 'maven-publish'
44
apply plugin: 'com.android.library'
55

6-
publishing {
7-
publications {
8-
kotlinMultiplatform.artifactId = "mokttp-common"
9-
}
10-
repositories {
11-
maven {
12-
name = "central"
13-
def snapshotRepoUrl = "https://oss.sonatype.org/content/repositories/snapshots"
14-
def stagingRepoUrl = "https://oss.sonatype.org/service/local/staging/deploy/maven2"
15-
url = version.endsWith('SNAPSHOT') ? snapshotRepoUrl : stagingRepoUrl
16-
credentials {
17-
username = System.getenv("MAVEN_USERNAME")
18-
password = System.getenv("MAVEN_PASSWORD")
19-
}
20-
}
21-
}
22-
}
6+
apply from: rootProject.file("gradle/publish.gradle")
237

248
android {
259
compileSdkVersion 29

0 commit comments

Comments
 (0)