Skip to content

Commit

Permalink
Fix handling of publishing for new tags
Browse files Browse the repository at this point in the history
  • Loading branch information
serpro69 committed Mar 29, 2024
1 parent f834c70 commit 007e4dd
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 14 deletions.
17 changes: 11 additions & 6 deletions bom/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,17 +1,22 @@
import io.github.serpro69.semverkt.gradle.plugin.tasks.TagTask

plugins {
`java-platform`
`maven-publish`
signing
}

val bom = project
val isSnapshot by lazy {
provider {
version.toString().startsWith("0.0.0")
|| version.toString().endsWith("SNAPSHOT")
}
val isSnapshot = provider {
version.toString().startsWith("0.0.0")
|| version.toString().endsWith("SNAPSHOT")
}
val newTag = provider {
val tag = project.tasks.getByName("tag", TagTask::class)
/* ':bom' shares the tag with 'root', ':cli-bot' and ':core' modules,
and hence the tag might already exist and didWork will return false for ':bom' */
tag.didWork || tag.tagExists
}
val newTag by lazy { provider { project.tasks.getByName("tag").didWork } }

// Exclude subprojects that will never be published so that when configuring this project
// we don't force their configuration and do unnecessary work
Expand Down
2 changes: 1 addition & 1 deletion buildSrc/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -18,5 +18,5 @@ dependencies {
// use snakeyaml instead of jackson-dataformat-yaml to properly handle yaml anchors and write them as actual values to json
implementation("org.yaml:snakeyaml:2.2")
// NB! remember to set same version in settings.gradle.kts:13
implementation("io.github.serpro69:semantic-versioning:0.12.0")
implementation("io.github.serpro69:semantic-versioning:0.13.0")
}
17 changes: 11 additions & 6 deletions buildSrc/src/main/kotlin/faker-lib-conventions.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import com.github.jengelman.gradle.plugins.shadow.ShadowExtension
import com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar
import io.github.serpro69.semverkt.gradle.plugin.tasks.TagTask
import org.jetbrains.dokka.gradle.DokkaTask
import java.util.*

Expand All @@ -21,13 +22,17 @@ plugins {
private val fullName: String =
if (project.name == "core") rootProject.name else "${rootProject.name}-${project.name}"

val isSnapshot by lazy {
provider {
version.toString().startsWith("0.0.0")
|| version.toString().endsWith("SNAPSHOT")
}
val isSnapshot = provider {
version.toString().startsWith("0.0.0")
|| version.toString().endsWith("SNAPSHOT")
}
val newTag = provider {
val tag = project.tasks.getByName("tag", TagTask::class)
/* all fakers have their own tags, so checking if tag.didWork is enough for them,
':core' shares the tag with 'root', ':bom' and ':cli-bot' modules,
and hence the tag might already exist and didWork will return false for ':core' */
if (project.name != "core") tag.didWork else tag.didWork || tag.tagExists
}
val newTag by lazy { provider { project.tasks.getByName("tag").didWork } }

configurations {
create("integrationImplementation") { extendsFrom(configurations.getByName("testImplementation")) }
Expand Down
2 changes: 1 addition & 1 deletion settings.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ pluginManagement {

plugins {
// NB! remember to set same version in buildSrc/build.gradle.kts:20
id("io.github.serpro69.semantic-versioning") version "0.12.0"
id("io.github.serpro69.semantic-versioning") version "0.13.0"
}

rootProject.name = "kotlin-faker"
Expand Down

0 comments on commit 007e4dd

Please sign in to comment.