Skip to content

Commit

Permalink
Fix version is checked when publishing to maven local test repo
Browse files Browse the repository at this point in the history
  • Loading branch information
JavierSegoviaCordoba committed May 7, 2023
1 parent d75e47d commit 408bb46
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@

### Fixed

- version is checked when publishing to maven local test repo

### Updated

## [0.5.0-alpha.15] - 2023-05-07
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -119,9 +119,16 @@ private fun HubdleConfigurableExtension.configurePublishOnlySemver() =
tasks.maybeRegisterLazily("checkIsSemver") { task ->
task.enabled = isTagPrefixProject
task.doLast {
val publishNonSemver =
val allTaskNames: List<String> = gradle.taskGraph.allTasks.map { it.name }
val hasPublishToMavenLocalTest: Boolean =
allTaskNames.any { name -> name == "publishToMavenLocalTest" }
val publishNonSemver: Boolean =
getBooleanProperty(Publishing.nonSemver).orElse(false).get()
check(isSemver || publishNonSemver) {
println("isSemver: $isSemver")
println("hasPublishToMavenLocalTest: $hasPublishToMavenLocalTest")
println("publishNonSemver: $publishNonSemver")
val isPublishException: Boolean = publishNonSemver || hasPublishToMavenLocalTest
check(isSemver || isPublishException) {
// TODO: inject `$version` instead of getting it from the `project`
"""|Only semantic versions can be published (current: $version)
|Use `"-Ppublishing.nonSemver=true"` to force the publication
Expand Down

0 comments on commit 408bb46

Please sign in to comment.