Skip to content

Commit

Permalink
properly apply vanniktech maven publish plugin
Browse files Browse the repository at this point in the history
  • Loading branch information
luca992 committed Feb 15, 2024
1 parent 4a7f3c3 commit 291f157
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 73 deletions.
55 changes: 2 additions & 53 deletions build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import org.jetbrains.kotlin.gradle.dsl.JvmTarget
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
import java.util.*

plugins {
alias(libs.plugins.org.jetbrains.kotlin.multiplatform) apply false
Expand All @@ -10,48 +9,17 @@ plugins {
alias(libs.plugins.com.vanniktech.maven.publish) apply false
}

val file = project.file("local.properties")

if (file.exists()) {
Properties().apply {
val inputStream = file.inputStream()
load(inputStream)
ext {
set("signing.keyId", getProperty("signing.keyId"))
set("signing.password", getProperty("signing.password"))
set("ossrh.username", getProperty("ossrh.username"))
set("ossrh.password", getProperty("ossrh.password"))
set("signing.secretKeyRingFile", getProperty("signing.secretKeyRingFile"))
set("stagingProfileId", getProperty("stagingProfileId"))
}
inputStream.close()
}
} else {
ext {
set("signing.keyId", System.getenv("SIGNING_KEY_ID"))
set("signing.password", System.getenv("SIGNING_PASSWORD"))
set("ossrh.username", System.getenv("OSSRH_USERNAME"))
set("ossrh.password", System.getenv("OSSRH_PASSWORD"))
set("signing.secretKeyRingFile", System.getenv("SIGNING_SECRET_KEY_RING_FILE"))
set("stagingProfileId", System.getenv("STAGING_PROFILE_ID"))
}
}

allprojects {

group = project.property("GROUP") as String
version = project.property("VERSION_NAME") as String

val emptyJavadocJar by tasks.registering(Jar::class) {
archiveClassifier.set("javadoc")
}

afterEvaluate {
extensions.findByType<PublishingExtension>()?.apply {
publications.withType<MavenPublication>().configureEach {

artifact(emptyJavadocJar.get())

pom {

name.set("Kamel")
Expand All @@ -61,7 +29,7 @@ allprojects {
licenses {
license {
name.set("The Apache Software License, Version 2.0")
url.set("http://www.apache.org/licenses/LICENSE-2.0.txt")
url.set("https://www.apache.org/licenses/LICENSE-2.0.txt")
distribution.set("repo")
}
}
Expand All @@ -79,33 +47,14 @@ allprojects {

scm {
connection.set("scm:git:github.com/Kamel-Media/Kamel.git")
developerConnection.set("scm:git:ssh://github.com/alialbaali/Kamel.git")
developerConnection.set("scm:git:ssh://github.com/Kamel-Media/Kamel.git")
url.set("https://github.com/Kamel-Media/Kamel/tree/main")
}

}

}

repositories {
maven {

name = "MavenCentral"

val releasesRepoUrl = "https://s01.oss.sonatype.org/service/local/staging/deploy/maven2/"
val snapshotsRepoUrl = "https://s01.oss.sonatype.org/content/repositories/snapshots/"

url = if (version.toString().endsWith("SNAPSHOT")) uri(snapshotsRepoUrl) else uri(releasesRepoUrl)

credentials {
username = rootProject.ext["ossrh.username"] as String? ?: ""
password = rootProject.ext["ossrh.password"] as String? ?: ""
}

}
}

extensions.findByType<SigningExtension>()?.sign(publications)
}
}

Expand Down
5 changes: 4 additions & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,7 @@ org.jetbrains.compose.experimental.macos.enabled=true
org.jetbrains.compose.experimental.uikit.enabled=true

GROUP=media.kamel
VERSION_NAME=0.9.2
VERSION_NAME=0.9.2

SONATYPE_HOST=S01
RELEASE_SIGNING_ENABLED=true
10 changes: 1 addition & 9 deletions kamel-core/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,8 @@ import org.jetbrains.kotlin.gradle.dsl.ExplicitApiMode
plugins {
alias(libs.plugins.org.jetbrains.kotlin.multiplatform)
alias(libs.plugins.org.jetbrains.compose)
`maven-publish`
signing
alias(libs.plugins.com.android.library)
alias(libs.plugins.com.vanniktech.maven.publish)
}

kotlin {
Expand Down Expand Up @@ -106,13 +105,6 @@ kotlin {
}
}

// https://youtrack.jetbrains.com/issue/KT-46466
val dependsOnTasks = mutableListOf<String>()
tasks.withType<AbstractPublishToMaven>().configureEach {
dependsOnTasks.add(this.name.replace("publish", "sign").replaceAfter("Publication", ""))
dependsOn(dependsOnTasks)
}

android {
namespace = "io.kamel.core.cache"
compileSdk = 34
Expand Down
11 changes: 1 addition & 10 deletions kamel-image/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,7 @@ plugins {
alias(libs.plugins.org.jetbrains.kotlin.multiplatform)
alias(libs.plugins.org.jetbrains.compose)
alias(libs.plugins.com.android.library)
`maven-publish`
signing
alias(libs.plugins.com.vanniktech.maven.publish)
}

android {
Expand Down Expand Up @@ -141,11 +140,3 @@ kotlin {

}
}

// https://youtrack.jetbrains.com/issue/KT-46466
val dependsOnTasks = mutableListOf<String>()
tasks.withType<AbstractPublishToMaven>().configureEach {
dependsOnTasks.add(this.name.replace("publish", "sign").replaceAfter("Publication", ""))
dependsOn(dependsOnTasks)
}

0 comments on commit 291f157

Please sign in to comment.