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) { with(project) {
plugins.apply("org.jetbrains.kotlin.jvm") plugins.apply("org.jetbrains.kotlin.jvm")
plugins.apply("maven-publish")
repositories.applyRepos() repositories.applyRepos()
@ -49,38 +48,43 @@ open class ScientifikJVMPlugin : Plugin<Project> {
from(sourceSet.kotlin.srcDirs.first()) from(sourceSet.kotlin.srcDirs.first())
} }
configure<PublishingExtension> { pluginManager.withPlugin("maven-publish") {
publications {
register("jvm", MavenPublication::class) { configure<PublishingExtension> {
from(components["java"]) publications {
artifact(sourcesJar.get()) 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) { val dokka by tasks.getting(DokkaTask::class) {
outputFormat = "html" outputFormat = "html"
outputDirectory = "$buildDir/javadoc" outputDirectory = "$buildDir/javadoc"
multiplatform{ multiplatform {
} }
} }
@ -94,13 +94,15 @@ open class ScientifikMPPlugin : Plugin<Project> {
from("$buildDir/javadoc") from("$buildDir/javadoc")
} }
configure<PublishingExtension> { pluginManager.withPlugin("maven-publish") {
configure<PublishingExtension> {
targets.all { targets.all {
val publication = publications.findByName(name) as MavenPublication val publication = publications.findByName(name) as MavenPublication
// Patch publications with fake javadoc // Patch publications with fake javadoc
publication.artifact(kdocJar.get()) publication.artifact(kdocJar.get())
}
} }
} }
} }

View File

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