Skip to content

Commit b3e2c69

Browse files
committed
use com.vanniktech.maven.publish
1 parent 5a809a3 commit b3e2c69

File tree

3 files changed

+37
-44
lines changed

3 files changed

+37
-44
lines changed

build.gradle.kts

Lines changed: 30 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,7 @@ import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
44
plugins {
55
`kotlin-dsl`
66
`java-gradle-plugin`
7-
`maven-publish`
8-
signing
7+
alias(libs.plugins.com.vanniktech.maven.publish)
98
}
109

1110
version = "2.3.0"
@@ -26,9 +25,6 @@ dependencies {
2625
java {
2726
sourceCompatibility = JavaVersion.VERSION_1_8
2827
targetCompatibility = JavaVersion.VERSION_1_8
29-
30-
withJavadocJar()
31-
withSourcesJar()
3228
}
3329

3430
tasks.withType<Test> {
@@ -54,55 +50,46 @@ gradlePlugin {
5450
}
5551
}
5652

57-
publishing {
58-
publications {
59-
create<MavenPublication>("pluginMaven") {
60-
pom {
53+
54+
afterEvaluate {
55+
publishing {
56+
publications {
57+
named<MavenPublication>("pluginMaven") {
6158
groupId = "io.github.luca992.multiplatform-swiftpackage"
6259
artifactId = "io.github.luca992.multiplatform-swiftpackage.gradle.plugin"
63-
64-
name.set("Multiplatform Swift Package")
65-
description.set("Gradle plugin to generate a Swift.package file and XCFramework to distribute a Kotlin Multiplatform iOS library")
66-
url.set(" https://github.com/luca992/multiplatform-swiftpackage")
67-
68-
licenses {
69-
license {
70-
name.set("Apache License, Version 2.0")
71-
url.set("https://www.apache.org/licenses/LICENSE-2.0.txt")
72-
}
73-
}
74-
developers {
75-
developer {
76-
name.set("Georg Dresler")
77-
}
78-
}
79-
scm {
80-
connection.set("scm:git: https://github.com/luca992/multiplatform-swiftpackage.git")
81-
developerConnection.set("scm:git:ssh://github.com/luca992/multiplatform-swiftpackage.git")
82-
url.set(" https://github.com/luca992/multiplatform-swiftpackage")
83-
}
8460
}
8561
}
8662
}
63+
}
64+
65+
mavenPublishing {
66+
pom {
67+
name.set("Multiplatform Swift Package")
68+
description.set("Gradle plugin to generate a Swift.package file and XCFramework to distribute a Kotlin Multiplatform iOS library")
69+
url.set("https://github.com/luca992/multiplatform-swiftpackage")
8770

88-
repositories {
89-
maven {
90-
val releasesUrl = "https://central.sonatype.com/api/v1/publisher/upload"
91-
val snapshotsUrl = "https://central.sonatype.com/repository/maven-snapshots/"
92-
name = "mavencentral"
93-
url = uri(if (version.toString().endsWith("SNAPSHOT")) snapshotsUrl else releasesUrl)
94-
credentials {
95-
username = System.getenv("ossrh.username") ?: properties["ossrh.username"].toString()
96-
password = System.getenv("ossrh.password") ?: properties["ossrh.password"].toString()
71+
licenses {
72+
license {
73+
name.set("Apache License, Version 2.0")
74+
url.set("https://www.apache.org/licenses/LICENSE-2.0.txt")
9775
}
9876
}
77+
developers {
78+
developer {
79+
name.set("Georg Dresler")
80+
}
81+
developer {
82+
name.set("Luca Spinazzola")
83+
}
84+
}
85+
scm {
86+
connection.set("scm:git:https://github.com/luca992/multiplatform-swiftpackage.git")
87+
developerConnection.set("scm:git:ssh://github.com/luca992/multiplatform-swiftpackage.git")
88+
url.set("https://github.com/luca992/multiplatform-swiftpackage")
89+
}
9990
}
10091
}
10192

102-
signing {
103-
sign(publishing.publications["pluginMaven"])
104-
}
105-
10693
tasks.javadoc {
10794
if (JavaVersion.current().isJava9Compatible) {
10895
(options as StandardJavadocDocletOptions).addBooleanOption("html5", true)

gradle.properties

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,4 @@
1-
org.gradle.configuration-cache=true
1+
org.gradle.configuration-cache=true
2+
3+
SONATYPE_HOST=CENTRAL_PORTAL
4+
RELEASE_SIGNING_ENABLED=true

gradle/libs.versions.toml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,13 @@
22

33
[plugins]
44

5+
com-vanniktech-maven-publish = { id = "com.vanniktech.maven.publish", version.ref = "vanniktech-publish" }
56

67

78
[versions]
89

10+
vanniktech-publish = "0.33.0"
11+
912
kotlin = "2.2.0"
1013

1114
kotest = "5.9.1"

0 commit comments

Comments
 (0)