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.component1
|
||||||
import kotlin.collections.component2
|
import kotlin.collections.component2
|
||||||
|
|
||||||
|
@Suppress("unused")
|
||||||
class KSciencePublishingExtension(val project: Project) {
|
class KSciencePublishingExtension(val project: Project) {
|
||||||
var vcs: String? by project.extra
|
var vcs: String? by project.extra
|
||||||
|
|
||||||
@ -126,12 +127,8 @@ open class KScienceProjectPlugin : Plugin<Project> {
|
|||||||
appendln("<hr/>")
|
appendln("<hr/>")
|
||||||
}
|
}
|
||||||
|
|
||||||
val rootReadmeProperties: Map<String, Any?> = mapOf(
|
val rootReadmeProperties: Map<String, Any?> =
|
||||||
"name" to project.name,
|
rootReadmeExtension.properties + ("modules" to modulesString)
|
||||||
"group" to project.group,
|
|
||||||
"version" to project.version,
|
|
||||||
"modules" to modulesString
|
|
||||||
)
|
|
||||||
|
|
||||||
readmeFile.writeText(
|
readmeFile.writeText(
|
||||||
SimpleTemplateEngine().createTemplate(rootReadmeExtension.readmeTemplate)
|
SimpleTemplateEngine().createTemplate(rootReadmeExtension.readmeTemplate)
|
||||||
@ -155,7 +152,7 @@ open class KScienceProjectPlugin : Plugin<Project> {
|
|||||||
dependsOn(generateReadme)
|
dependsOn(generateReadme)
|
||||||
|
|
||||||
val publicationPlatform = project.findProperty("ci.publication.platform") as? String
|
val publicationPlatform = project.findProperty("ci.publication.platform") as? String
|
||||||
val publicationName = if(publicationPlatform == null){
|
val publicationName = if (publicationPlatform == null) {
|
||||||
"AllPublications"
|
"AllPublications"
|
||||||
} else {
|
} else {
|
||||||
publicationPlatform.capitalize() + "Publication"
|
publicationPlatform.capitalize() + "Publication"
|
||||||
|
@ -15,16 +15,11 @@ private fun Project.isSnapshot() = version.toString().contains("dev") || version
|
|||||||
|
|
||||||
open class KSciencePublishingPlugin : Plugin<Project> {
|
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) {
|
if (plugins.findPlugin("maven-publish") == null) {
|
||||||
plugins.apply("maven-publish")
|
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> {
|
configure<PublishingExtension> {
|
||||||
plugins.withId("org.jetbrains.kotlin.js") {
|
plugins.withId("org.jetbrains.kotlin.js") {
|
||||||
val kotlin = extensions.findByType<KotlinJsProjectExtension>()!!
|
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) {
|
val dokkaJar: Jar by tasks.creating(Jar::class) {
|
||||||
group = "documentation"
|
group = "documentation"
|
||||||
archiveClassifier.set("javadoc")
|
archiveClassifier.set("javadoc")
|
||||||
@ -205,4 +210,5 @@ open class KSciencePublishingPlugin : Plugin<Project> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user