Skip to content
This repository has been archived by the owner on Jul 1, 2022. It is now read-only.

Commit

Permalink
Added matcher for tag version.
Browse files Browse the repository at this point in the history
  • Loading branch information
jpkrohling committed Jun 26, 2017
1 parent 7e2aa5f commit 6c48997
Showing 1 changed file with 19 additions and 4 deletions.
23 changes: 19 additions & 4 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import java.util.regex.Pattern

plugins {
id "org.jruyi.thrift" version "0.3.1"
id "jacoco"
Expand All @@ -8,6 +10,9 @@ plugins {
id 'ru.vyarus.animalsniffer' version '1.3.0'
}

ext.developmentVersion = '0.21.0-SNAPSHOT'


ext.opentracingVersion = '0.30.0'
ext.guavaVersion = '18.0'
ext.apacheThriftVersion = '0.9.2'
Expand All @@ -31,7 +36,10 @@ allprojects {
apply plugin: 'jacoco'

group = 'com.uber.jaeger'
version = System.env.TRAVIS_TAG ? System.env.TRAVIS_TAG : '0.21.0-SNAPSHOT'
version = getVersionForBuild()

println version
println "-------------------"

repositories {
mavenCentral()
Expand Down Expand Up @@ -143,9 +151,7 @@ task codeCoverageReport(type: JacocoReport, group: 'Coverage reports') {
}

task printVersion {
doLast {
println project.version
}
println getVersionForBuild()
}

configure(subprojects.findAll {it.name != 'jaeger-thrift'}) {
Expand All @@ -154,3 +160,12 @@ configure(subprojects.findAll {it.name != 'jaeger-thrift'}) {
errorprone 'com.google.errorprone:error_prone_core:2.0.15'
}
}

def getVersionForBuild() {
String candidateVersion = System.env.TRAVIS_TAG
if (Pattern.compile("[v]?((\\d+)\\.(\\d+)\\.(\\d+))").matcher(candidateVersion).matches()) {
return candidateVersion
}

return ext.developmentVersion
}

0 comments on commit 6c48997

Please sign in to comment.