diff options
author | Simon Brandhof <simon.brandhof@sonarsource.com> | 2018-03-23 17:56:33 +0100 |
---|---|---|
committer | SonarTech <sonartech@sonarsource.com> | 2018-03-23 20:20:53 +0100 |
commit | 6b44584c0f1ecb30733493a0bf8f59120a6ed04b (patch) | |
tree | 99a5a9244f97ca48bdbbfdfd620f6085041f4a9c /build.gradle | |
parent | 97fa907f891466b4e622e500d6ef94cf4c7eea8f (diff) | |
download | sonarqube-6b44584c0f1ecb30733493a0bf8f59120a6ed04b.tar.gz sonarqube-6b44584c0f1ecb30733493a0bf8f59120a6ed04b.zip |
Fix project versioning
Diffstat (limited to 'build.gradle')
-rw-r--r-- | build.gradle | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/build.gradle b/build.gradle index 88bdc56d3ca..faffd260d16 100644 --- a/build.gradle +++ b/build.gradle @@ -28,10 +28,11 @@ allprojects { apply plugin: 'com.jfrog.artifactory' apply plugin: 'maven-publish' + ext.buildNumber = System.getProperty("buildNumber") // Replaces the version defined in sources, usually x.y-SNAPSHOT, by a version identifying the build. - def buildNumber = System.getProperty("buildNumber") - if (version.endsWith('-SNAPSHOT') && buildNumber != null) { - version = version.replace('-SNAPSHOT', ".0.$buildNumber") + if (version.endsWith('-SNAPSHOT') && ext.buildNumber != null) { + def versionSuffix = (version.toString().count('.') == 1 ? ".0.${ext.buildNumber}" : ".${ext.buildNumber}") + version = version.replace('-SNAPSHOT', versionSuffix) } ext { |