Move maven-publish to configuration phase
This commit is contained in:
parent
a7f4c541f4
commit
4c656a3f61
@ -11,6 +11,7 @@ import org.jetbrains.dokka.gradle.DokkaTask
|
||||
import kotlin.collections.component1
|
||||
import kotlin.collections.component2
|
||||
|
||||
@Suppress("unused")
|
||||
class KSciencePublishingExtension(val project: Project) {
|
||||
var vcs: String? by project.extra
|
||||
|
||||
@ -126,12 +127,8 @@ open class KScienceProjectPlugin : Plugin<Project> {
|
||||
appendln("<hr/>")
|
||||
}
|
||||
|
||||
val rootReadmeProperties: Map<String, Any?> = mapOf(
|
||||
"name" to project.name,
|
||||
"group" to project.group,
|
||||
"version" to project.version,
|
||||
"modules" to modulesString
|
||||
)
|
||||
val rootReadmeProperties: Map<String, Any?> =
|
||||
rootReadmeExtension.properties + ("modules" to modulesString)
|
||||
|
||||
readmeFile.writeText(
|
||||
SimpleTemplateEngine().createTemplate(rootReadmeExtension.readmeTemplate)
|
||||
|
@ -15,16 +15,11 @@ private fun Project.isSnapshot() = version.toString().contains("dev") || version
|
||||
|
||||
open class KSciencePublishingPlugin : Plugin<Project> {
|
||||
|
||||
override fun apply(project: Project): Unit = project.afterEvaluate {
|
||||
override fun apply(project: Project): Unit {
|
||||
project.run {
|
||||
if (plugins.findPlugin("maven-publish") == null) {
|
||||
plugins.apply("maven-publish")
|
||||
}
|
||||
|
||||
val githubOrg: String = project.findProperty("githubOrg") as? String ?: "mipt-npm"
|
||||
val githubProject: String? by project
|
||||
val vcs = findProperty("vcs") as? String
|
||||
?: githubProject?.let { "https://github.com/$githubOrg/$it" }
|
||||
|
||||
configure<PublishingExtension> {
|
||||
plugins.withId("org.jetbrains.kotlin.js") {
|
||||
val kotlin = extensions.findByType<KotlinJsProjectExtension>()!!
|
||||
@ -57,7 +52,17 @@ open class KSciencePublishingPlugin : Plugin<Project> {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
project.afterEvaluate {
|
||||
|
||||
val githubOrg: String = project.findProperty("githubOrg") as? String ?: "mipt-npm"
|
||||
val githubProject: String? by project
|
||||
val vcs = findProperty("vcs") as? String
|
||||
?: githubProject?.let { "https://github.com/$githubOrg/$it" }
|
||||
|
||||
configure<PublishingExtension> {
|
||||
val dokkaJar: Jar by tasks.creating(Jar::class) {
|
||||
group = "documentation"
|
||||
archiveClassifier.set("javadoc")
|
||||
@ -206,3 +211,4 @@ open class KSciencePublishingPlugin : Plugin<Project> {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user