1-
21buildscript {
32 ext. bouncycastleVersion = ' 1.54'
43 ext. jacksonVersion = ' 2.8.5'
@@ -28,6 +27,7 @@ buildscript {
2827
2928plugins {
3029 id " com.jfrog.bintray" version " 1.7.3"
30+ id " net.researchgate.release" version " 2.7.0"
3131}
3232
3333apply plugin : ' java'
@@ -44,9 +44,6 @@ allprojects {
4444 sourceCompatibility = 1.8
4545 targetCompatibility = 1.8
4646
47- group ' org.web3j'
48- version ' 3.5.0'
49-
5047 apply plugin : ' java'
5148 apply plugin : ' jacoco'
5249 apply plugin : ' checkstyle'
@@ -92,11 +89,11 @@ subprojects {
9289
9390 dependencies {
9491 testCompile " junit:junit:$junitVersion " ,
95- " org.mockito:mockito-core:$mockitoVersion "
92+ " org.mockito:mockito-core:$mockitoVersion "
9693 }
9794}
9895
99- configure(subprojects. findAll {it. name != ' integration-tests' }) {
96+ configure(subprojects. findAll { it. name != ' integration-tests' }) {
10097 // Required for Maven Nexus repository
10198 apply plugin : ' maven'
10299 apply plugin : ' signing'
@@ -127,6 +124,9 @@ configure(subprojects.findAll {it.name != 'integration-tests'}) {
127124 ext {
128125 ossrhUsername = project. hasProperty(' ossrhUsername' ) ? project. property(' ossrhUsername' ) : ' '
129126 ossrhPassword = project. hasProperty(' ossrhPassword' ) ? project. property(' ossrhPassword' ) : ' '
127+ bintrayUser = project. hasProperty(' bintrayUser' ) ? project. property(' bintrayUser' ) : System . getenv(' BINTRAY_USER' )
128+ bintrayKey = project. hasProperty(' bintrayApiKey' ) ? project. property(' bintrayApiKey' ) : System . getenv(' BINTRAY_API_KEY' )
129+ isSnapshotVersion = project. version. endsWith(" -SNAPSHOT" )
130130 }
131131
132132 publishing {
@@ -150,7 +150,12 @@ configure(subprojects.findAll {it.name != 'integration-tests'}) {
150150 mavenDeployer {
151151 beforeDeployment { MavenDeployment deployment -> signing. signPom(deployment) }
152152
153- repository(url : ' https://oss.sonatype.org/service/local/staging/deploy/maven2/' ) {
153+ onlyIf {
154+ ossrhUsername != ' ' && ossrhPassword != ' '
155+ }
156+
157+ String repoUrl = isSnapshotVersion ? " http://oss.sonatype.org/content/repositories/snapshots/" : " https://oss.sonatype.org/service/local/staging/deploy/maven2/"
158+ repository(url : repoUrl) {
154159 authentication(
155160 userName : ossrhUsername,
156161 password : ossrhPassword
@@ -193,8 +198,8 @@ configure(subprojects.findAll {it.name != 'integration-tests'}) {
193198 }
194199
195200 bintray {
196- user = project . hasProperty( ' bintrayUser' ) ? project . property( ' bintrayUser ' ) : System . getenv( ' BINTRAY_USER ' )
197- key = project . hasProperty( ' bintrayApiKey ' ) ? project . property( ' bintrayApiKey ' ) : System . getenv( ' BINTRAY_API_KEY ' )
201+ user = bintrayUser
202+ key = bintrayKey
198203 publications = [' mavenJava' ]
199204 publish = true
200205 pkg {
@@ -214,19 +219,26 @@ configure(subprojects.findAll {it.name != 'integration-tests'}) {
214219 // TODO run clean & closeAndPromoteRepository once
215220 dependsOn ' build'
216221 dependsOn ' uploadArchives'
217- dependsOn ' bintrayUpload'
218222
223+ if (! isSnapshotVersion && bintrayUser != ' ' && bintrayKey != ' ' ) {
224+ dependsOn ' bintrayUpload'
225+ tasks. findByName(' bintrayUpload' ). mustRunAfter ' build'
226+ }
219227 tasks. findByName(' uploadArchives' ). mustRunAfter ' build'
220- tasks. findByName(' bintrayUpload' ). mustRunAfter ' build'
221228 }
222229}
223230
231+ release {
232+ tagTemplate = ' v${version}'
233+ failOnCommitNeeded = true
234+ }
235+
224236
225237task jacocoRootTestReport (type : org.gradle.testing.jacoco.tasks.JacocoReport ) {
226238 dependsOn = subprojects. test
227239 additionalSourceDirs = files(subprojects. sourceSets. main. allSource. srcDirs)
228240 sourceDirectories = files(subprojects. sourceSets. main. allSource. srcDirs)
229- classDirectories = files(subprojects. sourceSets. main. output)
241+ classDirectories = files(subprojects. sourceSets. main. output)
230242 executionData = files(subprojects. jacocoTestReport. executionData)
231243 reports {
232244 xml. enabled = true
0 commit comments