Versions update and revise release tasks

This commit is contained in:
Alexander Nozik 2021-03-03 19:54:59 +03:00
parent 8efae2ca4d
commit bef27d1f6a
4 changed files with 40 additions and 42 deletions

View File

@ -8,7 +8,7 @@ plugins {
} }
group = "ru.mipt.npm" group = "ru.mipt.npm"
version = "0.8.3" version = "0.8.4"
description = "Build tools for DataForge and kscience projects" description = "Build tools for DataForge and kscience projects"
@ -22,7 +22,7 @@ repositories {
} }
val kotlinVersion = "1.4.30" val kotlinVersion = "1.4.31"
java { java {
targetCompatibility = JavaVersion.VERSION_1_8 targetCompatibility = JavaVersion.VERSION_1_8

View File

@ -8,8 +8,6 @@ import org.gradle.kotlin.dsl.*
import org.jetbrains.changelog.ChangelogPlugin import org.jetbrains.changelog.ChangelogPlugin
import org.jetbrains.dokka.gradle.DokkaPlugin import org.jetbrains.dokka.gradle.DokkaPlugin
import org.jetbrains.dokka.gradle.DokkaTask import org.jetbrains.dokka.gradle.DokkaTask
import kotlin.collections.component1
import kotlin.collections.component2
@Suppress("unused") @Suppress("unused")
class KSciencePublishingExtension(val project: Project) { class KSciencePublishingExtension(val project: Project) {
@ -104,20 +102,24 @@ open class KScienceProjectPlugin : Plugin<Project> {
outputs.file(readmeFile) outputs.file(readmeFile)
doLast { doLast {
val projects = subprojects.associate { // val projects = subprojects.associate {
it.name to it.extensions.findByType<KScienceReadmeExtension>() // val normalizedPath = it.path.replaceFirst(":","").replace(":","/")
} // it.path.replace(":","/") to it.extensions.findByType<KScienceReadmeExtension>()
// }
if (rootReadmeExtension.readmeTemplate.exists()) { if (rootReadmeExtension.readmeTemplate.exists()) {
val modulesString = buildString { val modulesString = buildString {
projects.entries.forEach { (name, ext) -> subprojects.forEach { subproject->
val name = subproject.name
val path = subproject.path.replaceFirst(":","").replace(":","/")
val ext = subproject.extensions.findByType<KScienceReadmeExtension>()
appendln("<hr/>") appendln("<hr/>")
appendln("\n* ### [$name]($name)") appendln("\n* ### [$name]($path)")
if (ext != null) { if (ext != null) {
appendln("> ${ext.description}") appendln("> ${ext.description}")
appendln(">\n> **Maturity**: ${ext.maturity}") appendln(">\n> **Maturity**: ${ext.maturity}")
val featureString = ext.featuresString(itemPrefix = "> - ", pathPrefix = "$name/") val featureString = ext.featuresString(itemPrefix = "> - ", pathPrefix = "$path/")
if (featureString.isNotBlank()) { if (featureString.isNotBlank()) {
appendln(">\n> **Features:**") appendln(">\n> **Features:**")
appendln(featureString) appendln(featureString)
@ -145,28 +147,10 @@ open class KScienceProjectPlugin : Plugin<Project> {
val patchChangelog by tasks.getting val patchChangelog by tasks.getting
afterEvaluate {
val release by tasks.creating { val release by tasks.creating {
group = RELEASE_GROUP group = RELEASE_GROUP
description = "Publish development or production release based on version suffix" description = "Publish development or production release based on version suffix"
dependsOn(generateReadme) dependsOn(generateReadme)
val publicationPlatform = project.findProperty("ci.publication.platform") as? String
val publicationName = if (publicationPlatform == null) {
"AllPublications"
} else {
publicationPlatform.capitalize() + "Publication"
}
tasks.findByName("publish${publicationName}ToSonatypeRepository")?.let {
dependsOn(it)
}
tasks.findByName("publish${publicationName}ToBintrayRepository")?.let {
dependsOn(it)
}
tasks.findByName("publish${publicationName}ToSpaceRepository")?.let {
dependsOn(it)
}
}
} }
} }

View File

@ -60,6 +60,8 @@ open class KSciencePublishingPlugin : Plugin<Project> {
//configure publications after everything is set in the root project //configure publications after everything is set in the root project
project.rootProject.afterEvaluate { project.rootProject.afterEvaluate {
//root project release task
val release by tasks.getting
project.run { project.run {
val githubOrg: String = project.findProperty("githubOrg") as? String ?: "mipt-npm" val githubOrg: String = project.findProperty("githubOrg") as? String ?: "mipt-npm"
val githubProject: String? by project val githubProject: String? by project
@ -182,12 +184,8 @@ open class KSciencePublishingPlugin : Plugin<Project> {
project.findProperty("signingKey") as? String ?: System.getenv("signingKey") project.findProperty("signingKey") as? String ?: System.getenv("signingKey")
val signingKeyPassphrase: String? by project val signingKeyPassphrase: String? by project
if (sonatypePublish == "true" && sonatypeUser != null && sonatypePassword != null) { if (sonatypePublish == "true" && sonatypeUser != null && sonatypePassword != null && !isSnapshot()) {
val sonatypeRepo: String = if (isSnapshot()) { val sonatypeRepo: String = "https://oss.sonatype.org/service/local/staging/deploy/maven2"
"https://oss.sonatype.org/content/repositories/snapshots"
} else {
"https://oss.sonatype.org/service/local/staging/deploy/maven2"
}
if (plugins.findPlugin("signing") == null) { if (plugins.findPlugin("signing") == null) {
plugins.apply("signing") plugins.apply("signing")
@ -214,6 +212,22 @@ open class KSciencePublishingPlugin : Plugin<Project> {
} }
} }
} }
val publicationPlatform = project.findProperty("publication.platform") as? String
val publicationName = if (publicationPlatform == null) {
"AllPublications"
} else {
publicationPlatform.capitalize() + "Publication"
}
tasks.findByName("publish${publicationName}ToSonatypeRepository")?.let {
release.dependsOn(it)
}
tasks.findByName("publish${publicationName}ToSpaceRepository")?.let {
release.dependsOn(it)
}
} }
} }
} }

View File

@ -6,18 +6,18 @@ import org.gradle.api.JavaVersion
* Build constants * Build constants
*/ */
object KScienceVersions { object KScienceVersions {
const val kotlinVersion = "1.4.30" const val kotlinVersion = "1.4.31"
const val kotlinxNodeVersion = "0.0.7" const val kotlinxNodeVersion = "0.0.7"
const val coroutinesVersion = "1.4.2" const val coroutinesVersion = "1.4.3"
const val serializationVersion = "1.1.0" const val serializationVersion = "1.1.0"
const val atomicVersion = "0.15.1" const val atomicVersion = "0.15.1"
const val ktorVersion = "1.5.1" const val ktorVersion = "1.5.2"
const val htmlVersion = "0.7.2" const val htmlVersion = "0.7.2"
val JVM_TARGET = JavaVersion.VERSION_11 val JVM_TARGET = JavaVersion.VERSION_11
object Serialization{ object Serialization{
const val xmlVersion = "0.81.0" const val xmlVersion = "0.81.1"
const val bsonVersion = "0.4.4" const val bsonVersion = "0.4.4"
const val yamlKtVersion = "0.9.0" const val yamlKtVersion = "0.9.0"
} }