Permalink
Browse files

Publishing changes due to Gradle 4.8

Publishing element is now initialized like all other elements in Gradle 4.8, so the special workarounds could be removed.
Use the new POM API in Gradle 4.8 to add detail about licenses and developer.
install4j dependency no longer removed from browser artifact.
  • Loading branch information...
ingokegel committed Jun 18, 2018
1 parent ccc1859 commit 88fb18759eb2a24a21644c1eeffeab62841c2a51
@@ -11,5 +11,4 @@ dependencies {
//classpath ':dokka-fatjar'
//classpath ':dokka-gradle-plugin'
"compile"("com.jfrog.bintray.gradle:gradle-bintray-plugin:1.8.1")
"compile"("org.jetbrains.kotlinx:kotlinx.dom:0.0.10")
}
@@ -2,8 +2,6 @@
import com.jfrog.bintray.gradle.BintrayExtension
import com.jfrog.bintray.gradle.tasks.BintrayUploadTask
import kotlinx.dom.childElements
import kotlinx.dom.firstChildElement
import org.gradle.api.Project
import org.gradle.api.plugins.JavaPluginConvention
import org.gradle.api.publish.PublishingExtension
@@ -17,22 +15,6 @@ fun Project.configurePublishing() {
val bintrayUser: String? by extra
val bintrayApiKey: String? by extra
configure<BintrayExtension> {
if (bintrayUser != null && bintrayApiKey != null) {
user = bintrayUser
key = bintrayApiKey
pkg(closureOf<BintrayExtension.PackageConfig> {
repo = "maven"
name = "jclasslib"
setLicenses("GPL-2.0")
})
dryRun = project.hasProperty("dryRun")
publish = true
override = project.hasProperty("override")
}
setPublications("Module")
}
val publications = the<PublishingExtension>().publications
tasks {
"bintrayUpload"(BintrayUploadTask::class) {
@@ -52,19 +34,44 @@ fun Project.configurePublishing() {
dependsOn("publishModulePublicationToMavenLocal", "jar")
}
gradle.projectsEvaluated {
publications {
"Module"(MavenPublication::class) {
from(project.components["java"])
artifact(sourcesJar)
pom.withXml {
val dependencies = asElement().firstChildElement("dependencies")
dependencies?.childElements()
?.filter { it.firstChildElement("groupId")?.textContent == "com.install4j" }
?.forEach { dependencies.removeChild(it) }
publications {
"Module"(MavenPublication::class) {
from(project.components["java"])
artifactId = "jclasslib-${project.name}"
artifact(sourcesJar)
pom {
licenses {
license {
name.set("GPL Version 2.0")
url.set("https://www.gnu.org/licenses/gpl-2.0.html")
}
}
developers {
developer {
name.set("Ingo Kegel")
url.set("https://github.com/ingokegel/jclasslib")
organization.set("ej-technologies GmbH")
organizationUrl.set("https://www.ej-technologies.com")
}
}
}
}
}
}
configure<BintrayExtension> {
if (bintrayUser != null && bintrayApiKey != null) {
user = bintrayUser
key = bintrayApiKey
pkg(closureOf<BintrayExtension.PackageConfig> {
repo = "maven"
name = "jclasslib"
setLicenses("GPL-2.0")
})
dryRun = project.hasProperty("dryRun")
publish = true
override = project.hasProperty("override")
}
setPublications("Module")
}
}
@@ -44,11 +44,5 @@ tasks {
"dist" {
dependsOn(copyDist)
}
publications {
"Module"(MavenPublication::class) {
artifactId = "jclasslib-browser"
}
}
}
@@ -50,7 +50,6 @@ tasks {
publications {
"Module"(MavenPublication::class) {
artifactId = "jclasslib-data"
artifact(mapOf("source" to javadocJar, "classifier" to "javadoc"))
}
}

0 comments on commit 88fb187

Please sign in to comment.