Skip to content

Commit

Permalink
Do not create a new maven publication, but rather update the current …
Browse files Browse the repository at this point in the history
…ones
  • Loading branch information
gabfssilva committed Jan 22, 2024
1 parent a96d301 commit 5f20d9a
Showing 1 changed file with 51 additions and 57 deletions.
108 changes: 51 additions & 57 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -156,70 +156,66 @@ subprojects {
}
}

publications {
create<MavenPublication>("maven") {
groupId = "com.river-kt"
artifactId = project.name
version = "${project.version}"

// artifact(tasks["jvmJar"])
publications.forEach { publication ->
if (publication !is MavenPublication) {
return@forEach
}

artifact(tasks["sourcesJar"]) {
classifier = "sources"
}
publication.artifact(tasks["sourcesJar"]) {
classifier = "sources"
}

artifact(tasks["javadocJar"]) {
classifier = "javadoc"
}
publication.artifact(tasks["javadocJar"]) {
classifier = "javadoc"
}

pom {
name.set(project.name)
description.set("Extensions & Enterprise Integrations for Kotlin flows.")
publication.pom {
name.set(project.name)
description.set("Extensions & Enterprise Integrations for Kotlin flows.")

url.set("https://river-kt.com")
url.set("https://river-kt.com")

scm {
connection.set("scm:git:git:github.com/River-Kt/river.git")
developerConnection.set("scm:git:ssh://github.com/River-Kt/river.git")
url.set("https://github.com/River-Kt/river")
}
scm {
connection.set("scm:git:git:github.com/River-Kt/river.git")
developerConnection.set("scm:git:ssh://github.com/River-Kt/river.git")
url.set("https://github.com/River-Kt/river")
}

licenses {
license {
name.set("The MIT License")
url.set("https://opensource.org/license/mit/")
}
licenses {
license {
name.set("The MIT License")
url.set("https://opensource.org/license/mit/")
}
}

developers {
developer {
id.set("gabfssilva")
name.set("Gabriel Francisco")
email.set("[email protected]")
}
developers {
developer {
id.set("gabfssilva")
name.set("Gabriel Francisco")
email.set("[email protected]")
}
}

withXml {
asNode().appendNode("dependencies").apply {
val dependencies = configurations.asMap["api"]?.dependencies ?: emptySet()

for (dependency in dependencies) {
appendNode("dependency").apply {
appendNode("groupId", dependency.group)
appendNode("artifactId", dependency.name)
appendNode("version", dependency.version)

val excludeRules =
if (dependency is ModuleDependency) dependency.excludeRules
else emptySet()

if (excludeRules.isNotEmpty()) {
appendNode("exclusions").apply {
appendNode("exclusion").apply {
excludeRules.forEach { excludeRule ->
appendNode("groupId", excludeRule.group)
appendNode("artifactId", excludeRule.module)
}
withXml {
asNode().appendNode("dependencies").apply {
val dependencies = configurations.asMap["api"]?.dependencies ?: emptySet()

for (dependency in dependencies) {
appendNode("dependency").apply {
appendNode("groupId", dependency.group)
appendNode("artifactId", dependency.name)
appendNode("version", dependency.version)

val excludeRules =
if (dependency is ModuleDependency) dependency.excludeRules
else emptySet()

if (excludeRules.isNotEmpty()) {
appendNode("exclusions").apply {
appendNode("exclusion").apply {
excludeRules.forEach { excludeRule ->
appendNode("groupId", excludeRule.group)
appendNode("artifactId", excludeRule.module)
}
}
}
Expand All @@ -246,9 +242,7 @@ subprojects {

signing {
useInMemoryPgpKeys(signingKeyId, signingSecretKey, signingPassword)

sign(publishing.publications["maven"])
sign(tasks["javadocJar"])
sign(publishing.publications)
}

tasks.withType<PublishToMavenRepository>().configureEach {
Expand Down

0 comments on commit 5f20d9a

Please sign in to comment.