passsy / gradle-GitVersioner

generates a project version for the given git project to distinguish between builds
Apache License 2.0
81 stars 22 forks source link

Ignores the configurations #23

Closed joeEulerity closed 6 years ago

joeEulerity commented 6 years ago

As per your sample code, I have the following pasted at the top of my build.gradle

ext.gitVersioner = [
        defaultBranch           : "develop",  // default "master"
        stableBranches          : ["master", "someOtherBranch"], // default [], the feature branch postfix (-dm4(6)) will not be appended on stable branches, all commits are included into the version number calculation
        yearFactor              : 1200,       // default "1000", increasing every 8.57h
        snapshotEnabled         : false,      // default false, the "-SNAPSHOT" postfix
        localChangesCountEnabled: false,       // default false, the (<commitCount>) before -SNAPSHOT
        shortName: { gitVersion ->            // optional closure to build a short name
            // allows you to add your own short name logic
            // All properties from gitVersion are available
            // can be used for CI `System.getenv("BUILD_NUMBER")`

            // i.e. use short sha1
            return gitVersion.commit.subSequence(0, 7)
        }
]
// import the script which runs the version generation
apply from: 'https://raw.githubusercontent.com/passsy/gradle-GitVersioner/master/git-versioner.gradle'
println("versionName: $gitVersionName")

The version name that it prints out when running a gradle sync: versionName: 433(3)-SNAPSHOT

You'll note that the changesCount and SNAPSHOT flag are enabled, even though they are set to false in the configuration. Please help!

joeEulerity commented 6 years ago

I fixed this by defining the configs thusly:

rootProject.ext.gitVersioner = [
        defaultBranch           : "develop",  // default "master"
        ....
]