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

Allow consumers to determine stable branches at build time using regex #22

Open atljeremy opened 6 years ago

atljeremy commented 6 years ago

Adds a call to a new configuration closure named isStableBranch to allow consumers of the script to determine if a branch is stable when running a build. This is helpful for stable branches that may be dynamic in some way and need to be checked via regex. An example would be release branches, something like release-v4.5.

Ex. implementation:

ext.gitVersioner = [
  isStableBranch: { branch ->
    switch(branch) {
       case 'master': return true
       case ~/release-[\w\W]*/: return true
       default: return false
    }
  }
]