Skip to content

Commit 526faf3

Browse files
committed
separate release tasks
1 parent 69676b8 commit 526faf3

File tree

4 files changed

+43
-40
lines changed

4 files changed

+43
-40
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
99
### Added
1010

1111
### Changed
12+
- Separate release tasks for each target
1213

1314
### Deprecated
1415

gradle/libs.versions.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
[versions]
2-
tools = "0.11.1-kotlin-1.6.10"
2+
tools = "0.11.2-kotlin-1.6.10"
33
kotlin = "1.6.10"
44
atomicfu = "0.17.1"
55
binary-compatibility-validator = "0.8.0"
@@ -18,7 +18,7 @@ kotlinx-serialization = "1.3.2"
1818
ktor = "1.6.7"
1919
xmlutil = "0.84.0"
2020
yamlkt = "0.10.2"
21-
jsBom = "0.0.1-pre.290-kotlin-1.6.10"
21+
jsBom = "0.0.1-pre.313-kotlin-1.6.10"
2222
junit = "5.8.2"
2323

2424
[libraries]

src/main/kotlin/ru/mipt/npm/gradle/KScienceProjectPlugin.kt

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,6 @@ import kotlinx.validation.ApiValidationExtension
44
import kotlinx.validation.BinaryCompatibilityValidatorPlugin
55
import org.gradle.api.Plugin
66
import org.gradle.api.Project
7-
import org.gradle.api.plugins.BasePluginExtension
8-
import org.gradle.api.publish.maven.tasks.PublishToMavenLocal
97
import org.gradle.api.publish.maven.tasks.PublishToMavenRepository
108
import org.gradle.kotlin.dsl.*
119
import org.jetbrains.changelog.ChangelogPlugin
@@ -173,6 +171,11 @@ public open class KScienceProjectPlugin : Plugin<Project> {
173171
}
174172
}
175173

174+
val releaseAll by tasks.creating {
175+
group = RELEASE_GROUP
176+
description = "Publish development or production release based on version suffix"
177+
}
178+
176179
allprojects {
177180
afterEvaluate {
178181
ksciencePublish.repositoryNames.forEach { repositoryName ->
@@ -185,12 +188,14 @@ public open class KScienceProjectPlugin : Plugin<Project> {
185188
it.name.removePrefix("publish").removeSuffix("To${repositoryNameCapitalized}Repository")
186189
}"
187190

188-
val releaseTask = tasks.findByName(theName) ?: tasks.create(theName) {
191+
val targetReleaseTask = tasks.findByName(theName) ?: tasks.create(theName) {
189192
group = RELEASE_GROUP
190-
description = "Publish development or production release based on version suffix"
193+
description = "Publish platform release artifact"
191194
}
192195

193-
releaseTask.dependsOn(it)
196+
releaseAll.dependsOn(targetReleaseTask)
197+
198+
targetReleaseTask.dependsOn(it)
194199
}
195200
}
196201
}

src/main/kotlin/ru/mipt/npm/gradle/internal/publishing.kt

Lines changed: 30 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -31,15 +31,14 @@ internal fun Project.setupPublication(mavenPomConfiguration: MavenPom.() -> Unit
3131
from(it.kotlin)
3232
}
3333
}
34-
afterEvaluate {
35-
publications.create<MavenPublication>("js") {
36-
kotlin.js().components.forEach {
37-
from(it)
38-
}
39-
40-
artifact(sourcesJar)
34+
publications.create<MavenPublication>("js") {
35+
kotlin.js().components.forEach {
36+
from(it)
4137
}
38+
39+
artifact(sourcesJar)
4240
}
41+
4342
}
4443

4544
plugins.withId("org.jetbrains.kotlin.jvm") {
@@ -68,37 +67,35 @@ internal fun Project.setupPublication(mavenPomConfiguration: MavenPom.() -> Unit
6867
}
6968

7069
// Process each publication we have in this project
71-
afterEvaluate {
72-
publications.withType<MavenPublication> {
73-
artifact(dokkaJar)
74-
75-
pom {
76-
name.set(project.name)
77-
description.set(project.description ?: project.name)
78-
79-
licenses {
80-
license {
81-
name.set("The Apache Software License, Version 2.0")
82-
url.set("https://www.apache.org/licenses/LICENSE-2.0.txt")
83-
distribution.set("repo")
84-
}
85-
}
86-
87-
developers {
88-
developer {
89-
id.set("MIPT-NPM")
90-
name.set("MIPT nuclear physics methods laboratory")
91-
organization.set("MIPT")
92-
organizationUrl.set("https://npm.mipt.ru")
93-
}
70+
publications.withType<MavenPublication> {
71+
artifact(dokkaJar)
72+
73+
pom {
74+
name.set(project.name)
75+
description.set(project.description ?: project.name)
76+
77+
licenses {
78+
license {
79+
name.set("The Apache Software License, Version 2.0")
80+
url.set("https://www.apache.org/licenses/LICENSE-2.0.txt")
81+
distribution.set("repo")
9482
}
83+
}
9584

96-
scm {
97-
tag.set(project.version.toString())
85+
developers {
86+
developer {
87+
id.set("MIPT-NPM")
88+
name.set("MIPT nuclear physics methods laboratory")
89+
organization.set("MIPT")
90+
organizationUrl.set("https://npm.mipt.ru")
9891
}
92+
}
9993

100-
mavenPomConfiguration()
94+
scm {
95+
tag.set(project.version.toString())
10196
}
97+
98+
mavenPomConfiguration()
10299
}
103100
}
104101
}

0 commit comments

Comments
 (0)