From 8e5fe74f5cfe8a2c8cc27e06e42bf439ab3eedda Mon Sep 17 00:00:00 2001 From: Benjamin Dweck Date: Wed, 2 Sep 2020 12:11:37 +0200 Subject: [PATCH] Updated build to detect that 'dirty' and 'non-master' branches are not releases --- build.gradle | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/build.gradle b/build.gradle index 087e19a..6748378 100644 --- a/build.gradle +++ b/build.gradle @@ -17,15 +17,20 @@ repositories { sourceCompatibility = 1.8 targetCompatibility = 1.8 -def isRelease = versionDetails().commitDistance == 0 - group 'io.rudefox' -version isRelease ? gitVersion.call() : gitVersion.call() + "-SNAPSHOT" application { mainClassName = 'io.rudefox.burrow.RudefoxBurrow' } +def isRelease = versionDetails().commitDistance == 0 && + versionDetails().isCleanTag && + versionDetails().branchName == 'master' + +version isRelease ? gitVersion.call() : gitVersion.call() + "-${versionDetails().branchName}-SNAPSHOT" + +println "${group}:${project.name}:${version}" + ' ' + (isRelease ? '(RELEASE)' : '(SNAPSHOT)') + run { standardInput = System.in }