Skip to content
This repository has been archived by the owner on Jul 8, 2022. It is now read-only.

Commit

Permalink
Try to fix gradle plugin pom rewriting so central accepts it
Browse files Browse the repository at this point in the history
  • Loading branch information
soywiz committed May 28, 2022
1 parent 69e7eae commit 56ee455
Show file tree
Hide file tree
Showing 2 changed files with 40 additions and 39 deletions.
66 changes: 27 additions & 39 deletions buildSrc/src/main/kotlin/com/soywiz/korlibs/modules/Publishing.kt
Original file line number Diff line number Diff line change
Expand Up @@ -106,47 +106,35 @@ fun Project.configurePublishing(multiplatform: Boolean = true) {
//println("PUBLICATION: ${publication.name}")

//if (multiplatform) {
if (!isGradlePluginMarker) {
publication.pom.withXml {
val baseProjectName = project.name.substringBefore('-')
//println("baseProjectName=$baseProjectName")
val defaultGitUrl = "https://github.com/korlibs/$baseProjectName"
this.asNode().apply {
//replaceNode(Node(this, "name", project.name))
appendNode("name", project.name)
appendNode(
"description",
project.description ?: project.getCustomProp("project.description", project.description ?: project.name)
)
appendNode("url", project.getCustomProp("project.scm.url", defaultGitUrl))
appendNode("licenses").apply {
appendNode("license").apply {
appendNode("name").setValue(project.getCustomProp("project.license.name", "MIT"))
appendNode("url").setValue(
project.getCustomProp(
"project.license.url",
"https://raw.githubusercontent.com/korlibs/$baseProjectName/master/LICENSE"
)
)
}
}
appendNode("developers").apply {
appendNode("developer").apply {
appendNode("id").setValue(project.getCustomProp("project.author.id", "soywiz"))
appendNode("name").setValue(
project.getCustomProp("project.author.name", "Carlos Ballesteros Velasco")
)
appendNode("email").setValue(
project.getCustomProp("project.author.email", "soywiz@gmail.com")
)
}
//if (!isGradlePluginMarker) {
run {
val baseProjectName = project.name.substringBefore('-')
val defaultGitUrl = "https://github.com/korlibs/$baseProjectName"
publication.pom.also { pom ->
pom.name.set(project.name)
pom.description.set(project.description ?: project.getCustomProp("project.description", project.description ?: project.name))
pom.url.set(project.getCustomProp("project.scm.url", defaultGitUrl))
pom.licenses {
license {
this.name.set(project.getCustomProp("project.license.name", "MIT"))
this.url.set(project.getCustomProp("project.license.url", "https://raw.githubusercontent.com/korlibs/$baseProjectName/master/LICENSE"))
}
appendNode("scm").apply {
appendNode("url").setValue(project.getCustomProp("project.scm.url", defaultGitUrl))
}
pom.developers {
developer {
this.id.set(project.getCustomProp("project.author.id", "soywiz"))
this.name.set(project.getCustomProp("project.author.name", "Carlos Ballesteros Velasco"))
this.email.set(project.getCustomProp("project.author.email", "soywiz@gmail.com"))
}

// Changes runtime -> compile in Android's AAR publications
if (publication.pom.packaging == "aar") {
}
pom.scm {
this.url.set(project.getCustomProp("project.scm.url", defaultGitUrl))
}
}
if (publication.pom.packaging == "aar") {
publication.pom.withXml {
//println("baseProjectName=$baseProjectName")
this.asNode().apply {
val nodes: NodeList =
this.getAt(QName("dependencies")).getAt("dependency").getAt("scope")
for (node in nodes as List<Node>) {
Expand Down
13 changes: 13 additions & 0 deletions korge-gradle-plugin/build.gradle
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import org.apache.tools.ant.taskdefs.optional.unix.Symlink
import org.gradle.api.publish.maven.internal.publication.DefaultMavenPom

import java.nio.file.Files

Expand All @@ -25,6 +26,7 @@ pluginBundle {
gradlePlugin {
plugins {
create("korge") {
//PluginDeclaration decl = it
id = "com.soywiz.korge"
displayName = "Korge"
description = "Multiplatform Game Engine for Kotlin"
Expand All @@ -33,6 +35,17 @@ gradlePlugin {
}
}

/*
afterEvaluate {
GenerateMavenPom generatePomFileForKorgePluginMarkerMavenPublication = tasks.findByName("generatePomFileForKorgePluginMarkerMavenPublication")
generatePomFileForKorgePluginMarkerMavenPublication.pom.licenses {
it.license {
it.name = "MIT"
}
}
}
*/

java {
sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8
Expand Down

0 comments on commit 56ee455

Please sign in to comment.