Fixed deploy to bintray and dokka configuration

This commit is contained in:
Alexander Nozik 2019-11-01 22:57:53 +03:00
parent 1f03951cff
commit af1e79ddba
3 changed files with 46 additions and 38 deletions

View File

@ -17,7 +17,6 @@ open class ScientifikJVMPlugin : Plugin<Project> {
with(project) {
plugins.apply("org.jetbrains.kotlin.jvm")
plugins.apply("maven-publish")
repositories.applyRepos()
@ -49,38 +48,43 @@ open class ScientifikJVMPlugin : Plugin<Project> {
from(sourceSet.kotlin.srcDirs.first())
}
configure<PublishingExtension> {
publications {
register("jvm", MavenPublication::class) {
from(components["java"])
artifact(sourcesJar.get())
pluginManager.withPlugin("maven-publish") {
configure<PublishingExtension> {
publications {
register("jvm", MavenPublication::class) {
from(components["java"])
artifact(sourcesJar.get())
}
}
}
pluginManager.withPlugin("org.jetbrains.dokka") {
val dokka by tasks.getting(DokkaTask::class) {
outputFormat = "html"
outputDirectory = "$buildDir/javadoc"
}
val kdocJar by tasks.registering(Jar::class) {
group = JavaBasePlugin.DOCUMENTATION_GROUP
dependsOn(dokka)
archiveClassifier.set("javadoc")
from("$buildDir/javadoc")
}
configure<PublishingExtension> {
publications {
getByName("jvm") {
this as MavenPublication
artifact(kdocJar.get())
}
}
}
}
}
}
pluginManager.withPlugin("org.jetbrains.dokka") {
val dokka by tasks.getting(DokkaTask::class) {
outputFormat = "html"
outputDirectory = "$buildDir/javadoc"
}
val kdocJar by tasks.registering(Jar::class) {
group = JavaBasePlugin.DOCUMENTATION_GROUP
dependsOn(dokka)
archiveClassifier.set("javadoc")
from("$buildDir/javadoc")
}
configure<PublishingExtension> {
publications {
getByName("jvm") {
this as MavenPublication
artifact(kdocJar.get())
}
}
}
}
}

View File

@ -82,7 +82,7 @@ open class ScientifikMPPlugin : Plugin<Project> {
val dokka by tasks.getting(DokkaTask::class) {
outputFormat = "html"
outputDirectory = "$buildDir/javadoc"
multiplatform{
multiplatform {
}
}
@ -94,13 +94,15 @@ open class ScientifikMPPlugin : Plugin<Project> {
from("$buildDir/javadoc")
}
configure<PublishingExtension> {
pluginManager.withPlugin("maven-publish") {
configure<PublishingExtension> {
targets.all {
val publication = publications.findByName(name) as MavenPublication
targets.all {
val publication = publications.findByName(name) as MavenPublication
// Patch publications with fake javadoc
publication.artifact(kdocJar.get())
// Patch publications with fake javadoc
publication.artifact(kdocJar.get())
}
}
}
}

View File

@ -120,7 +120,7 @@ open class ScientifikPublishPlugin : Plugin<Project> {
if (bintrayRepo == null) {
project.logger.warn("[${project.name}] Bintray repository not defined")
} else {
project.logger.info("Adding bintray publishing to project [${project.name}]")
project.configure<PublishingExtension> {
repositories {
maven("https://bintray.com/mipt-npm/$bintrayRepo")
@ -143,14 +143,16 @@ open class ScientifikPublishPlugin : Plugin<Project> {
setLicenses("Apache-2.0")
vcsUrl = vcs
version.apply {
name = project.version.toString()
vcsTag = project.version.toString()
released = java.util.Date().toString()
this.name = project.version.toString()
this.vcsTag = project.version.toString()
this.released = java.util.Date().toString()
}
}
//workaround bintray bug
setPublications(*project.extensions.findByType<PublishingExtension>()!!.publications.names.toTypedArray())
afterEvaluate {
setPublications(*project.extensions.findByType<PublishingExtension>()!!.publications.names.toTypedArray())
}
}
}
}