Moved deploy configuration to afterEvaluate

This commit is contained in:
Alexander Nozik 2019-07-07 14:23:10 +03:00
parent cd9bf6adc2
commit 404bcfd28a
2 changed files with 88 additions and 84 deletions

View File

@ -8,7 +8,7 @@ plugins {
} }
group = "scientifik" group = "scientifik"
version = "0.1.0" version = "0.1.1"
repositories { repositories {
gradlePluginPortal() gradlePluginPortal()

View File

@ -38,11 +38,14 @@ open class ScientifikPublishPlugin : Plugin<Project> {
project.plugins.apply("maven-publish") project.plugins.apply("maven-publish")
val extension = project.extensions.create<ScientifikExtension>("scientifik") val extension = project.extensions.create<ScientifikExtension>("scientifik")
project.afterEvaluate {
val bintrayRepo = project.bintrayRepo val bintrayRepo = project.bintrayRepo
val vcs = project.vcs val vcs = project.vcs
if (bintrayRepo == null || vcs == null) { if (bintrayRepo == null || vcs == null) {
project.logger.warn("[${project.name}] Missing deployment configuration. Skipping publish.") project.logger.warn("[${project.name}] Missing deployment configuration. Skipping publish.")
return@afterEvaluate
} }
project.configure<PublishingExtension> { project.configure<PublishingExtension> {
@ -85,7 +88,7 @@ open class ScientifikPublishPlugin : Plugin<Project> {
if (extension.kdoc) { if (extension.kdoc) {
project.plugins.apply("org.jetbrains.dokka") project.plugins.apply("org.jetbrains.dokka")
project.afterEvaluate {
extensions.findByType<KotlinMultiplatformExtension>()?.apply { extensions.findByType<KotlinMultiplatformExtension>()?.apply {
val dokka by tasks.getting(DokkaTask::class) { val dokka by tasks.getting(DokkaTask::class) {
outputFormat = "html" outputFormat = "html"
@ -165,7 +168,7 @@ open class ScientifikPublishPlugin : Plugin<Project> {
} }
} }
} }
}
} }
project.plugins.apply("com.jfrog.bintray") project.plugins.apply("com.jfrog.bintray")
@ -193,9 +196,9 @@ open class ScientifikPublishPlugin : Plugin<Project> {
} }
//workaround bintray bug //workaround bintray bug
project.afterEvaluate {
setPublications(*project.extensions.findByType<PublishingExtension>()!!.publications.names.toTypedArray()) setPublications(*project.extensions.findByType<PublishingExtension>()!!.publications.names.toTypedArray())
}
// project.tasks.figetByPath("bintrayUpload") { // project.tasks.figetByPath("bintrayUpload") {
// dependsOn(publishToMavenLocal) // dependsOn(publishToMavenLocal)
@ -231,3 +234,4 @@ open class ScientifikPublishPlugin : Plugin<Project> {
} }
} }
} }
}