JavierSegoviaCordoba / semver-gradle-plugin

Set projects versions based on git tags and following semantic versioning
https://semver-gradle-plugin.javiersc.com
Other
25 stars 3 forks source link

`isSnapshot`, `isRC` providers compare equality of project version string versus a `SpecialStage` constant #147

Closed bric3 closed 6 months ago

bric3 commented 6 months ago

Using the version providers introduced in JavierSegoviaCordoba/semver-gradle-plugin#93

I wonder if I'm using it right. Suppose the following task that emit the version 0.0.1-SNAPSHOT

./gradlew publish -Psemver.stage=snapshot

image

This call return false, because the comparison is performing an equality on the String representation of the version.

public val String.isSnapshot: Boolean
    get() = lowercase() == SpecialStage.snapshot

I was able to work around this with my own provider

val isSnapshot = providers.provider { GradleVersion(project.version.toString()).isSnapshot }

Gradle : 8.7 Semver : 0.5.0

JavierSegoviaCordoba commented 6 months ago

I will check, I think there is a lazy version too, but you need to cast the version.

Thank you for the report!

JavierSegoviaCordoba commented 6 months ago

Fixed here: https://github.com/JavierSegoviaCordoba/semver-gradle-plugin/commit/e733267ecb8f5fdfa02d1179d207cd175221c4fd

bric3 commented 6 months ago

Thanks