Skip to content

Commit 75b7b7d

Browse files
committed
fix release bug added on 0.7.11
1 parent c031baf commit 75b7b7d

2 files changed

Lines changed: 33 additions & 24 deletions

File tree

scd4j/build.gradle

Lines changed: 31 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,11 @@ apply plugin: 'maven'
1111
group = 'com.datamaio'
1212
sourceCompatibility = 1.8
1313
targetCompatibility = 1.8
14-
version = buildVersion()
14+
version = buildVersionName()
15+
16+
println "***********************************"
17+
println "**** Building version '$version' ****"
18+
println "***********************************\n"
1519

1620
jar {
1721
manifest {
@@ -81,21 +85,13 @@ compileGroovy.doLast {
8185

8286
//--------- publish to bintray config -----------
8387

84-
gradle.taskGraph.whenReady { graph ->
85-
if (graph.hasTask(':bintrayUpload')) {
86-
version = buildVersion(1)
87-
println "************************************************"
88-
println "**** Publishing version '$version' to Bintray ****"
89-
println "************************************************"
90-
}
91-
}
92-
9388
bintray {
9489
user = project.hasProperty('bintray_user') ? bintray_user : ''
9590
key = project.hasProperty('bintray_api_key') ? bintray_api_key : ''
9691
configurations = ['archives']
9792
publish = true
9893
pkg {
94+
name = version
9995
repo = 'maven'
10096
name = 'SCD4J'
10197
desc = 'Simple Continuous Delivery for Java and Groovy Developers'
@@ -108,33 +104,46 @@ bintray {
108104
attributes= ['gradle-plugin': 'com.datamaio.scd4j:com.datamaio:scd4j']
109105

110106
version {
111-
desc = "Simple Continuous Delivery for Java and Groovy Developers - version $project.version"
107+
desc = "Simple Continuous Delivery for Java and Groovy Developers"
112108
released = new java.util.Date()
113109
attributes = ['gradle-plugin': 'com.datamaio.scd4j:com.datamaio:scd4j']
114110
}
115111
}
116112
}
117113

114+
bintrayUpload.doLast {
115+
println "\n************************************************"
116+
println "**** Published version '$version' to Bintray ****"
117+
println "************************************************"
118+
119+
incrementDeployNumber()
120+
}
121+
118122
//--------- Utility --------
119123

120-
def buildVersion(increment) {
124+
def buildVersionName() {
121125
def f = file('version.properties')
122126
if (f.canRead()) {
123-
def Properties props = new Properties()
124-
props.load(new FileInputStream(f))
125-
def deployNumber = props['DEPLOY_NUMBER'].toInteger()
126-
if(increment) {
127-
deployNumber++;
128-
props['DEPLOY_NUMBER'] = deployNumber.toString()
129-
props.store(f.newWriter(), null)
130-
}
131-
132-
return "${props['VERSION_NAME']}.${deployNumber}"
127+
def props = new Properties()
128+
props.load(new FileInputStream(f))
129+
return "${props['VERSION_NAME']}.${props['BINTRAY_DEPLOY_NUMBER']}"
133130
} else {
134131
throw new GradleException("Could not read version.properties!")
135132
}
136133
}
137134

135+
def incrementDeployNumber() {
136+
def f = file('version.properties')
137+
if (f.canWrite()) {
138+
def props = new Properties()
139+
props.load(new FileInputStream(f))
140+
props['BINTRAY_DEPLOY_NUMBER'] = "" + (props['BINTRAY_DEPLOY_NUMBER'].toInteger() + 1)
141+
props.store(f.newWriter(), null)
142+
} else {
143+
throw new GradleException("Could not write version.properties!")
144+
}
145+
}
146+
138147

139148
//--------- Create DEB and RPM packages --------
140149

scd4j/version.properties

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
#Sun May 15 17:30:23 BRT 2016
2-
DEPLOY_NUMBER=11
1+
#Sun May 15 18:27:59 BRT 2016
2+
BINTRAY_DEPLOY_NUMBER=13
33
VERSION_NAME=0.7

0 commit comments

Comments
 (0)