separate release tasks

This commit is contained in:
Alexander Nozik 2022-03-08 23:22:03 +03:00
parent 69676b8521
commit 526faf33eb
No known key found for this signature in database
GPG Key ID: F7FCF2DD25C71357
4 changed files with 44 additions and 41 deletions

View File

@ -9,6 +9,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Added ### Added
### Changed ### Changed
- Separate release tasks for each target
### Deprecated ### Deprecated

View File

@ -1,5 +1,5 @@
[versions] [versions]
tools = "0.11.1-kotlin-1.6.10" tools = "0.11.2-kotlin-1.6.10"
kotlin = "1.6.10" kotlin = "1.6.10"
atomicfu = "0.17.1" atomicfu = "0.17.1"
binary-compatibility-validator = "0.8.0" binary-compatibility-validator = "0.8.0"
@ -18,7 +18,7 @@ kotlinx-serialization = "1.3.2"
ktor = "1.6.7" ktor = "1.6.7"
xmlutil = "0.84.0" xmlutil = "0.84.0"
yamlkt = "0.10.2" yamlkt = "0.10.2"
jsBom = "0.0.1-pre.290-kotlin-1.6.10" jsBom = "0.0.1-pre.313-kotlin-1.6.10"
junit = "5.8.2" junit = "5.8.2"
[libraries] [libraries]

View File

@ -4,8 +4,6 @@ import kotlinx.validation.ApiValidationExtension
import kotlinx.validation.BinaryCompatibilityValidatorPlugin import kotlinx.validation.BinaryCompatibilityValidatorPlugin
import org.gradle.api.Plugin import org.gradle.api.Plugin
import org.gradle.api.Project import org.gradle.api.Project
import org.gradle.api.plugins.BasePluginExtension
import org.gradle.api.publish.maven.tasks.PublishToMavenLocal
import org.gradle.api.publish.maven.tasks.PublishToMavenRepository import org.gradle.api.publish.maven.tasks.PublishToMavenRepository
import org.gradle.kotlin.dsl.* import org.gradle.kotlin.dsl.*
import org.jetbrains.changelog.ChangelogPlugin import org.jetbrains.changelog.ChangelogPlugin
@ -173,6 +171,11 @@ public open class KScienceProjectPlugin : Plugin<Project> {
} }
} }
val releaseAll by tasks.creating {
group = RELEASE_GROUP
description = "Publish development or production release based on version suffix"
}
allprojects { allprojects {
afterEvaluate { afterEvaluate {
ksciencePublish.repositoryNames.forEach { repositoryName -> ksciencePublish.repositoryNames.forEach { repositoryName ->
@ -185,12 +188,14 @@ public open class KScienceProjectPlugin : Plugin<Project> {
it.name.removePrefix("publish").removeSuffix("To${repositoryNameCapitalized}Repository") it.name.removePrefix("publish").removeSuffix("To${repositoryNameCapitalized}Repository")
}" }"
val releaseTask = tasks.findByName(theName) ?: tasks.create(theName) { val targetReleaseTask = tasks.findByName(theName) ?: tasks.create(theName) {
group = RELEASE_GROUP group = RELEASE_GROUP
description = "Publish development or production release based on version suffix" description = "Publish platform release artifact"
} }
releaseTask.dependsOn(it) releaseAll.dependsOn(targetReleaseTask)
targetReleaseTask.dependsOn(it)
} }
} }
} }

View File

@ -31,15 +31,14 @@ internal fun Project.setupPublication(mavenPomConfiguration: MavenPom.() -> Unit
from(it.kotlin) from(it.kotlin)
} }
} }
afterEvaluate { publications.create<MavenPublication>("js") {
publications.create<MavenPublication>("js") { kotlin.js().components.forEach {
kotlin.js().components.forEach { from(it)
from(it)
}
artifact(sourcesJar)
} }
artifact(sourcesJar)
} }
} }
plugins.withId("org.jetbrains.kotlin.jvm") { plugins.withId("org.jetbrains.kotlin.jvm") {
@ -68,37 +67,35 @@ internal fun Project.setupPublication(mavenPomConfiguration: MavenPom.() -> Unit
} }
// Process each publication we have in this project // Process each publication we have in this project
afterEvaluate { publications.withType<MavenPublication> {
publications.withType<MavenPublication> { artifact(dokkaJar)
artifact(dokkaJar)
pom { pom {
name.set(project.name) name.set(project.name)
description.set(project.description ?: project.name) description.set(project.description ?: project.name)
licenses { licenses {
license { license {
name.set("The Apache Software License, Version 2.0") name.set("The Apache Software License, Version 2.0")
url.set("https://www.apache.org/licenses/LICENSE-2.0.txt") url.set("https://www.apache.org/licenses/LICENSE-2.0.txt")
distribution.set("repo") distribution.set("repo")
}
} }
developers {
developer {
id.set("MIPT-NPM")
name.set("MIPT nuclear physics methods laboratory")
organization.set("MIPT")
organizationUrl.set("https://npm.mipt.ru")
}
}
scm {
tag.set(project.version.toString())
}
mavenPomConfiguration()
} }
developers {
developer {
id.set("MIPT-NPM")
name.set("MIPT nuclear physics methods laboratory")
organization.set("MIPT")
organizationUrl.set("https://npm.mipt.ru")
}
}
scm {
tag.set(project.version.toString())
}
mavenPomConfiguration()
} }
} }
} }