jmongard / Git.SemVersioning.Gradle

Gradle plugin for automatically versioning a project using semantic versioning and conventional commits with change log support based on git commit messages.
https://plugins.gradle.org/plugin/com.github.jmongard.git-semver-plugin
Apache License 2.0
39 stars 4 forks source link

noAutoBumb #9

Closed driftertest closed 3 years ago

driftertest commented 3 years ago

Hi, I have some questions about the noAutoBumb section. When I create commits that don't look like "conventional commits" (like "test", "observation", etc.), I expect the version to stay the same. But for some reason the "-SNAPSHOT" is lost. Example:

[root@5426297443a8 app]# git commit --allow-empty -m "fix: test12"
[dev 1721987] fix: test12
[root@5426297443a8 app]# git log -n 3
commit 17219872c6032dc44ef4ca6feeacc6e6bf46e39d
Author: Your Name <you@example.com>
Date:   Wed Oct 13 16:25:56 2021 +0300

    fix: test12

commit c8f19559ee2d7ab9b1a4dcdadf0cc55903ac9f8a
Author: Your Name <you@example.com>
Date:   Wed Oct 13 16:18:38 2021 +0300

    test11

commit f710c53feb892ca0881b41a04a18162c3c9a9460
Author: Your Name <you@example.com>
Date:   Wed Oct 13 16:10:00 2021 +0300

    fix: test10
[root@5426297443a8 app]# ./gradlew printversion

> Configure project :
'lombok.addLombokGeneratedAnnotation = true' is not configured for '/app/src/main/java' of the main source-set
'lombok.addLombokGeneratedAnnotation = true' is not configured for '/app/src/test/java' of the test source-set

> Task :printVersion
--------------------
Version: 0.0.11-SNAPSHOT+013.sha.1721987

BUILD SUCCESSFUL in 1s
1 actionable task: 1 executed
[root@5426297443a8 app]# git commit --allow-empty -m "test13"
[dev e6a8f6d] test13
[root@5426297443a8 app]# ./gradlew printversion

> Configure project :
'lombok.addLombokGeneratedAnnotation = true' is not configured for '/app/src/main/java' of the main source-set
'lombok.addLombokGeneratedAnnotation = true' is not configured for '/app/src/test/java' of the test source-set

> Task :printVersion
--------------------
Version: 0.0.11+014.sha.e6a8f6d

BUILD SUCCESSFUL in 2s
1 actionable task: 1 executed
[root@5426297443a8 app]# git log -n 3
commit e6a8f6dad9bb672d467ebfd3a13814c01a099c95
Author: Your Name <you@example.com>
Date:   Wed Oct 13 16:26:17 2021 +0300

    test13

commit 17219872c6032dc44ef4ca6feeacc6e6bf46e39d
Author: Your Name <you@example.com>
Date:   Wed Oct 13 16:25:56 2021 +0300

    fix: test12

commit c8f19559ee2d7ab9b1a4dcdadf0cc55903ac9f8a
Author: Your Name <you@example.com>
Date:   Wed Oct 13 16:18:38 2021 +0300

    test11
[root@5426297443a8 app]#

After second commit i expect 0.0.11-SNAPSHOT+014.sha.e6a8f6d

gradlew config:

semver {
    releaseTagNameFormat = "v%s"
    noDirtyCheck = true
    groupVersionIncrements = false
    noAutoBumb = true
}
jmongard commented 3 years ago

Hi,

Yes. I looks you are right. The plugin did not remember it had previously increased the version when using the groupVersionIncrements = false in combination with noAutoBumb = true option.

I have fixed this in version 0.4.1 of the plugin.

driftertest commented 3 years ago

Thx, i tested new version and saw that it fixed. But i have new bug :)

[root@cb14cf6cf36a app]# ./gradlew printversion

> Configure project :
Ignored pre-release with lower version than the current version: 0.0.5-SNAPSHOT+sha.6a9848f < 0.0.5+003.sha.6a9848f
'lombok.addLombokGeneratedAnnotation = true' is not configured for '/app/src/main/java' of the main source-set
'lombok.addLombokGeneratedAnnotation = true' is not configured for '/app/src/test/java' of the test source-set

> Task :printVersion
--------------------
Version: 0.0.5-SNAPSHOT+003.sha.6a9848f

BUILD SUCCESSFUL in 2s
1 actionable task: 1 executed
[root@cb14cf6cf36a app]# git tag
v0.0.1-SNAPSHOT
v0.0.2
v0.0.2-SNAPSHOT
v0.0.3
v0.0.4
v0.0.5-SNAPSHOT
[root@cb14cf6cf36a app]# git log -n 2
commit 6a9848f62ac15b653e2a5bc2bb7383f65fb94711
Merge: 38ddd98 6073b2e
Author: 
Date:   Thu Oct 14 09:16:54 2021 +0000

    Merge branch 'test' into 'dev'

    fix: update semver plugin

    See merge request !19

commit 6073b2e54a6d011b858c7b3ba2cfe664891f
Author: 
Date:   Thu Oct 14 09:13:40 2021 +0000

    fix: update semver plugin
[root@cb14cf6cf36a app]# ./gradlew releaseVersion --preRelease=- --message 'Release tag'

> Configure project :
Ignored pre-release with lower version than the current version: 0.0.5-SNAPSHOT+sha.6a9848f < 0.0.5+003.sha.6a9848f
'lombok.addLombokGeneratedAnnotation = true' is not configured for '/app/src/main/java' of the main source-set
'lombok.addLombokGeneratedAnnotation = true' is not configured for '/app/src/test/java' of the test source-set

> Task :releaseVersion
Ignored pre-release with lower version than the current version: 0.0.5-SNAPSHOT+sha.6a9848f < 0.0.5+003.sha.6a9848f

BUILD SUCCESSFUL in 2s
1 actionable task: 1 executed
[root@cb14cf6cf36a app]# ./gradlew printversion

> Configure project :
'lombok.addLombokGeneratedAnnotation = true' is not configured for '/app/src/main/java' of the main source-set
'lombok.addLombokGeneratedAnnotation = true' is not configured for '/app/src/test/java' of the test source-set

> Task :printVersion
--------------------
Version: 0.0.6+sha.e0018df

BUILD SUCCESSFUL in 2s
1 actionable task: 1 executed
[root@cb14cf6cf36a app]# git log -n 2
commit 872c9ddcd2276babd83bfa6b4da2737d69525866
Author: root <root@0773b2620c63>
Date:   Thu Oct 14 12:34:38 2021 +0300

    release: v0.0.6

    Release tag

commit 6a9848f62ac15b653e2a5bc2bb7383f65fb94711
Merge: 38ddd98 6073b2e
Author: 
Date:   Thu Oct 14 09:16:54 2021 +0000

    Merge branch 'test' into 'dev'

    fix: update semver plugin

    See merge request !19

I expect 0.0.5+sha.e0018df, but saw 0.0.6+sha.e0018df

jmongard commented 3 years ago

Hi, I'm not completely sure about your git commit tree. I have made adjustments to how semantic versions is compared to each other as I suspect that caused the issue.

(Fix in version 0.4.2)

driftertest commented 3 years ago

thx, i wiil try.