diff --git a/buildSrc/src/main/kotlin/com/soywiz/korlibs/modules/Publishing.kt b/buildSrc/src/main/kotlin/com/soywiz/korlibs/modules/Publishing.kt index 9c9328f97..d4ca02d79 100644 --- a/buildSrc/src/main/kotlin/com/soywiz/korlibs/modules/Publishing.kt +++ b/buildSrc/src/main/kotlin/com/soywiz/korlibs/modules/Publishing.kt @@ -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) { diff --git a/korge-gradle-plugin/build.gradle b/korge-gradle-plugin/build.gradle index 66979f2bb..7be2326b6 100644 --- a/korge-gradle-plugin/build.gradle +++ b/korge-gradle-plugin/build.gradle @@ -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 @@ -25,6 +26,7 @@ pluginBundle { gradlePlugin { plugins { create("korge") { + //PluginDeclaration decl = it id = "com.soywiz.korge" displayName = "Korge" description = "Multiplatform Game Engine for Kotlin" @@ -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