Configurable updater fix

This commit is contained in:
Alexander Nozik 2019-05-10 19:53:54 +03:00
parent 1344471f40
commit fdd5b11370
2 changed files with 25 additions and 24 deletions

View File

@ -1,15 +1,15 @@
import org.jetbrains.dokka.gradle.DokkaTask
import org.jetbrains.kotlin.gradle.dsl.KotlinJvmProjectExtension
import org.jetbrains.kotlin.gradle.dsl.KotlinMultiplatformExtension
import org.jetbrains.kotlin.gradle.plugin.KotlinPlatformJvmPlugin
import org.jetbrains.kotlin.gradle.plugin.mpp.KotlinMultiplatformPlugin
plugins {
id("org.jetbrains.dokka")
`maven-publish`
}
plugins.withType(KotlinMultiplatformPlugin::class){
configure<KotlinMultiplatformExtension>{
afterEvaluate {
extensions.findByType<KotlinMultiplatformExtension>()?.apply{
val dokka by tasks.getting(DokkaTask::class) {
outputFormat = "html"
outputDirectory = "$buildDir/javadoc"
@ -33,42 +33,43 @@ plugins.withType(KotlinMultiplatformPlugin::class){
}
}
val javadocJar by tasks.registering(Jar::class) {
val kdocJar by tasks.registering(Jar::class) {
group = JavaBasePlugin.DOCUMENTATION_GROUP
dependsOn(dokka)
archiveClassifier.set("javadoc")
from("$buildDir/javadoc")
}
configure<PublishingExtension>{
configure<PublishingExtension> {
targets.all {
val publication = publications.findByName(name) as MavenPublication
// Patch publications with fake javadoc
publication.artifact(javadocJar.get())
publication.artifact(kdocJar.get())
}
}
}
}
plugins.withType(KotlinPlatformJvmPlugin::class){
val dokka by tasks.getting(DokkaTask::class) {
outputFormat = "html"
outputDirectory = "$buildDir/javadoc"
jdkVersion = 8
}
val javadocJar by tasks.registering(Jar::class) {
group = JavaBasePlugin.DOCUMENTATION_GROUP
dependsOn(dokka)
archiveClassifier.set("javadoc")
from("$buildDir/javadoc")
}
extensions.findByType<KotlinJvmProjectExtension>()?.apply{
val dokka by tasks.getting(DokkaTask::class) {
outputFormat = "html"
outputDirectory = "$buildDir/javadoc"
jdkVersion = 8
}
configure<PublishingExtension>{
publications.filterIsInstance<MavenPublication>().forEach {publication ->
publication.artifact(javadocJar.get())
val kdocJar by tasks.registering(Jar::class) {
group = JavaBasePlugin.DOCUMENTATION_GROUP
dependsOn(dokka)
archiveClassifier.set("javadoc")
from("$buildDir/javadoc")
}
configure<PublishingExtension> {
publications.filterIsInstance<MavenPublication>().forEach { publication ->
publication.artifact(kdocJar.get())
}
}
}
}

View File

@ -41,6 +41,6 @@ interface Configurable {
fun <T : Configurable> T.configure(meta: Meta): T = this.apply { config.update(meta) }
fun <T : Configurable> T.configure(action: Config.() -> Unit): T = this.apply { config.apply(action) }
fun <T : Configurable> T.configure(action: MetaBuilder.() -> Unit): T = configure(buildMeta(action))
open class SimpleConfigurable(override val config: Config) : Configurable