Skip to content

Commit b5f4107

Browse files
committed
Merge pull request ReactiveX#204 from ReactiveX/dlew/release-versions
Switch `version` based on tasks called
2 parents 4595b00 + 4b5ddaa commit b5f4107

File tree

2 files changed

+13
-2
lines changed

2 files changed

+13
-2
lines changed

gradle.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
GROUP=io.reactivex
2-
VERSION_NAME=1.0-SNAPSHOT
2+
VERSION_NAME=1.0
33
POM_NAME=RxAndroid
44
POM_PACKAGING=aar
55
POM_DESCRIPTION=RxAndroid

rxandroid/build.gradle

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,18 @@ apply plugin: 'com.jfrog.bintray'
1515
apply plugin: 'com.jfrog.artifactory-upload'
1616

1717
group = GROUP
18-
version = VERSION_NAME
18+
19+
// Both the artifactory and bintray plugins depend on this singular
20+
// global `version` variable. As such, we need to configure it based
21+
// on which task we're running.
22+
//
23+
// The solution here is brittle; it just checks whether 'bintrayUpload'
24+
// was called for execution, otherwise it assumes SNAPSHOT. If we
25+
// were to wait until the task graph was built, we'd be too late
26+
// (the plugins would already have used `version`).
27+
boolean isReleaseBuild = gradle.startParameter.taskNames.contains('bintrayUpload')
28+
version = isReleaseBuild ? VERSION_NAME : "$VERSION_NAME-SNAPSHOT"
29+
logger.info("RxAndroid using version=$project.version")
1930

2031
android {
2132
compileSdkVersion rootProject.ext.compileSdkVersion

0 commit comments

Comments
 (0)