ajoberstar / reckon

Infer a project's version from your Git repository.
Apache License 2.0
187 stars 28 forks source link

[QUESTION] Increment a patch component #61

Closed pzbitskiy closed 6 years ago

pzbitskiy commented 6 years ago

Hello Andrew, I understand the plugin makes live easier by checking branches for assigned tags/versions. But what I'm trying to achieve - get the only patch component increased depending on a distance from a prev tag. i.e git describe gives me

$ git describe
v0.1.0-3-g2acd488

and ./gradlew jar (of course)

Reckoned version: 0.1.1-SNAPSHOT

So is it possible to get somehow 0.1.3-SNAPSHOT generated? Wonder if I overlooked something in configuration.

Thanks!

ajoberstar commented 6 years ago

This is not supported by reckon, which is meant to comply with SemVer. Using the patch component for a commit count is a different use case.

Patch version Z (x.y.Z | x > 0) MUST be incremented if only backwards compatible bug fixes are introduced. A bug fix is defined as an internal change that fixes incorrect behavior.

Let me know if you think I misunderstood what you were asking.

pzbitskiy commented 6 years ago

Yes, that is not SemVer compliant but reckon does not support commit distance outputting in a format like 1.0.0-1, 1.0.0-2,.. that is compliant to SemVer, so I guessed I can still use it but utilize a patch version component. Thank you for explanation.

ajoberstar commented 6 years ago

No problem. The predecessor to reckon (gradle-git) had more configurability, but it made it harder to have consistent semantics when so many things can be changed (e.g. sorting that is consistent across SemVer and Gradle).

If the output of git describe is acceptable to you, you could stick to just using grgit and leverage the grgit.describe() method.

pzbitskiy commented 6 years ago

Done with grgit, works like a charm for me!