11buildscript {
22 repositories { jcenter() }
33 repositories { mavenCentral() }
4- dependencies { classpath ' com.netflix.nebula:gradle-rxjava-project-plugin:3.+' }
4+ classpath " com.jfrog.bintray.gradle:gradle-bintray-plugin:1.7.3"
5+ classpath " org.jfrog.buildinfo:build-info-extractor-gradle:4.5.2"
56}
67
7- apply plugin : ' java'
88
99group = ' io.reactivex.rxjava2'
1010
11+ version = project. properties[" release.version" ]
12+
13+ def releaseTag = System . getenv(" TRAVIS_TAG" );
14+ if (releaseTag != null && ! releaseTag. isEmpty()) {
15+ if (releaseTag. startsWith(" v" )) {
16+ releaseTag = releaseTag. substring(1 );
17+ }
18+ version = releaseTag;
19+ project. properties. put(" release.version" , releaseTag);
20+
21+ println (" Releasing with version " + version);
22+ }
23+
24+ apply plugin : ' java'
25+ apply plugin : " com.jfrog.bintray"
26+ apply plugin : " com.jfrog.artifactory"
1127
1228def currentOS = org.gradle.internal.os.OperatingSystem . current()
1329def platform
@@ -30,3 +46,124 @@ dependencies {
3046 testCompile ' org.mockito:mockito-core:1.8.5'
3147}
3248
49+
50+
51+ apply plugin : " maven-publish"
52+
53+ install {
54+ repositories. mavenInstaller. pom. project {
55+ name " RxJava"
56+ description " Reactive Extensions for Java"
57+ url " https://github.com/ReactiveX/RxJava"
58+ licenses {
59+ license {
60+ name " The Apache Software License, Version 2.0"
61+ url " http://www.apache.org/licenses/LICENSE-2.0.txt"
62+ distribution " repo"
63+ }
64+ }
65+ developers {
66+ developer {
67+ id " akarnokd"
68+ name " David Karnok"
69+ email " akarnokd@gmail.com"
70+ }
71+ }
72+ scm {
73+ connection " scm:git:git@github.com:ReactiveX/RxJava.git"
74+ url " scm:git:git@github.com:ReactiveX/RxJava.git"
75+ developerConnection " scm:git:git@github.com:ReactiveX/RxJava.git"
76+ }
77+ issueManagement {
78+ system " github"
79+ url " https://github.com/ReactiveX/RxJava/issues"
80+ }
81+ }
82+ }
83+
84+ publishing {
85+ publications {
86+ mavenJava(MavenPublication ) {
87+ from components. java
88+ artifact (sourcesJar) {
89+ classifier = " sources"
90+ }
91+ }
92+ }
93+ }
94+
95+ // Reactive-Streams as compile dependency
96+ publishing. publications. all {
97+ pom. withXml {
98+ asNode(). dependencies. " *" . findAll() {
99+ it. scope. text() == " runtime" && project. configurations. compile. allDependencies. find { dep ->
100+ dep. name == it. artifactId. text()
101+ }
102+ }. each { it. scope* . value = " compile" }
103+ }
104+ }
105+
106+
107+
108+ if (rootProject. hasProperty(" releaseMode" )) {
109+
110+ if (" branch" . equals(rootProject. releaseMode)) {
111+ // From https://github.com/ReactiveX/RxAndroid/blob/2.x/rxandroid/build.gradle#L94
112+
113+ println (" ReleaseMode: " + rootProject. releaseMode);
114+ artifactory {
115+ contextUrl = " https://oss.jfrog.org"
116+
117+ publish {
118+ repository {
119+ repoKey = " oss-snapshot-local"
120+
121+ username = rootProject. bintrayUser
122+ password = rootProject. bintrayKey
123+ }
124+
125+ defaults {
126+ publishConfigs(" archives" )
127+ }
128+ }
129+ }
130+
131+ build. finalizedBy(artifactoryPublish)
132+ }
133+
134+ if (" full" . equals(rootProject. releaseMode)) {
135+ // based on https://github.com/bintray/gradle-bintray-plugin
136+ def rver = version;
137+
138+ println (" ReleaseMode: " + rootProject. releaseMode + " version " + rver);
139+
140+ bintray {
141+ user = rootProject. bintrayUser
142+ key = rootProject. bintrayKey
143+ configurations = [" archives" ]
144+ publish = true
145+ pkg {
146+ repo = " RxJava"
147+ name = " RxJava"
148+ userOrg = " reactivex"
149+ labels = [" rxjava" , " reactivex" ]
150+ licenses = [" Apache-2.0" ]
151+ vcsUrl = " https://github.com/ReactiveX/RxJava.git"
152+ version {
153+ name = rver
154+ gpg {
155+ sign = true
156+ }
157+ mavenCentralSync {
158+ sync = true
159+ user = rootProject. sonatypeUsername
160+ password = rootProject. sonatypePassword
161+ close = " 1"
162+ }
163+ }
164+ }
165+ }
166+
167+ build. finalizedBy(bintrayUpload)
168+ }
169+ }
0 commit comments