vivin / gradle-semantic-build-versioning

Gradle plugin to generate version-numbers and tags using semantic versioning
MIT License
85 stars 32 forks source link

Using the plugin #79

Closed darlenya closed 7 years ago

darlenya commented 7 years ago

Hi Vivin,

it seams that your plugin does exactly what I need. But I did not make it work. Are there any examples which shows how to configure your plugin in the right way?

I called the task printVersion to see what version the next tag my have. But the value I got is not what I have expected.

Thank you

vivin commented 7 years ago

What did you get back, and what were you expecting? The README tells you how to set up the plugin. The basic setup is very simple: the plugin must be applied in settings.gradle and you need at the very least, an empty semantic-build-versioning.gradle file in the project's root directory (on the same level as your build.gradle).

darlenya commented 7 years ago

Hi Vivin,

thanks for the fast answer.

I have created a semantic-build-versioning.gradle and added there startingVersion = '1.0.0' then I added the autoBump example from your readme.

I have created a tag in GIT with the version 1.3.2.

Then I made a change and commit it with a commit message containing: [bump-minor] in an extra line.

When I call the gradle task printVersion I get 1.0.2.

vivin commented 7 years ago

Is the tag on an a previous commit? Just to confirm, you created a tag 1.3.2 and when you print the version, you get 1.0.2?

Did you make any commits after you created the tag?

darlenya commented 7 years ago

Yes, have tagged an already existing commit manually. Then I create a new commit without any meaningful commit message. Then I call printVersion and I got 1.0.2. Then I create a change with a commit message with the string '[bump-minor]' in a separate line. But still got 1.0.2 when calling the task printVersion.

vivin commented 7 years ago

It's strange that it prints 1.0.2 first of all when you have a prior tag called 1.3.2. What's the output of git tag?

darlenya commented 7 years ago

Hi, the command 'git tag' returns: '1.3.2'

vivin commented 7 years ago

@darlenya I cannot verify this behavior. I created a sample project (where startingVersion is 1.0.0) and made a few commits. printVersion showed 1.0.0-SNAPSHOT. I then added an annotated tag for 1.3.2; printVersion showed 1.3.2. I made a commit without the autobump message; printVersion showed 1.3.3-SNAPSHOT. I then added a commit with the message [bump-minor] on its own line; printVersion now shows 1.4.0-SNAPSHOT as expected.

settings.gradle is as follows:

buildscript {
    repositories {
        maven {
            url 'https://plugins.gradle.org/m2/'
        }
    }
    dependencies {
        classpath 'gradle.plugin.net.vivin:gradle-semantic-build-versioning:4.0.0'
    }
}

apply plugin: 'net.vivin.gradle-semantic-build-versioning'
rootProject.name = "test-project"

and semantic-build-versioning.gradle is as follows:

startingVersion = "1.0.0"

autobump {
    majorPattern = ~/(?m)^\[bump-major\]$/                   
    minorPattern = ~/(?m)^\[bump-minor\]$/                   
    patchPattern = ~/(?m)^\[bump-patch\]$/                   
    newPreReleasePattern = ~/(?m)^\[make-new-pre-release\]$/ 
    promoteToReleasePattern = ~/(?m)^\[promote-to-release\]$/
}

My commits are as follows:

commit fc2733d62842e3fff1aa8e1de0b4c02d347b5063
Author: Vivin Paliath <xxx@gmail.com>
Date:   Wed Aug 2 07:47:57 2017 -0700

    This is a test

    [bump-minor]

commit 42ab76c8e53325d54cb34c62a812c054ef48d084
Author: Vivin Paliath <xxx@gmail.com>
Date:   Wed Aug 2 07:47:13 2017 -0700

    gradle

commit 501911a8ba4509915553e19578230a7d937477db
Author: Vivin Paliath <xxx@gmail.com>
Date:   Wed Aug 2 07:46:13 2017 -0700

    test

commit cd6dcf7aa37e5f1bce5f817a04e454e0988a7826
Author: Vivin Paliath <xxx@gmail.com>
Date:   Wed Aug 2 07:45:53 2017 -0700

    Initial commit

Here is the 1.3.2 tag (via git show-ref --tags -d):

5fbc576142826bea209948b4281a2e0dfe531f13 refs/tags/1.3.2
42ab76c8e53325d54cb34c62a812c054ef48d084 refs/tags/1.3.2^{}

Can you post your settings, or do you have a test project I can clone to verify the behavior?

darlenya commented 7 years ago

Hi Vivin,

first I would like to thank for your help. I will set up a complete new project to test wich will be available at the internet. Then I send you the link.

Mit freundlichen Grüßen

Torsten Link

Tel.: +49 173 9111194 Fax: +49 6181 258108 mail: torstenlink@gmx.de

On 2. Aug 2017, at 16:43, Vivin Paliath notifications@github.com wrote:

@darlenya https://github.com/darlenya Do you have a sample project that I can clone to verify this?

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/vivin/gradle-semantic-build-versioning/issues/79#issuecomment-319694112, or mute the thread https://github.com/notifications/unsubscribe-auth/ANVufvKtdbt12NwK761Po5NmRTVujYrpks5sUIsUgaJpZM4OpxJz.

darlenya commented 7 years ago

I have created a new project and redo what I have done before and now it is working as expected. When I find out what the problem cause is will report it.

So thanks again for your time.