Permalink
Browse files

#720: improve the build script to publish snapshots

  • Loading branch information...
snazha-blkio committed Oct 3, 2018
1 parent fe8c359 commit c537000d633fa598fc396a32c4b5e5549646a9fb
Showing with 18 additions and 14 deletions.
  1. +0 −2 .gitignore
  2. +18 −12 build.gradle
@@ -19,8 +19,6 @@ hs_err_pid*
*/build/
*/out/
gradle.properties
# Ignore Gradle GUI config
gradle-app.setting
@@ -1,4 +1,3 @@
buildscript {
ext.bouncycastleVersion = '1.54'
ext.jacksonVersion = '2.8.5'
@@ -44,9 +43,6 @@ allprojects {
sourceCompatibility = 1.8
targetCompatibility = 1.8
group 'org.web3j'
version '3.6.0'
apply plugin: 'java'
apply plugin: 'jacoco'
apply plugin: 'checkstyle'
@@ -92,11 +88,11 @@ subprojects {
dependencies {
testCompile "junit:junit:$junitVersion",
"org.mockito:mockito-core:$mockitoVersion"
"org.mockito:mockito-core:$mockitoVersion"
}
}
configure(subprojects.findAll {it.name != 'integration-tests'}) {
configure(subprojects.findAll { it.name != 'integration-tests' }) {
// Required for Maven Nexus repository
apply plugin: 'maven'
apply plugin: 'signing'
@@ -127,6 +123,9 @@ configure(subprojects.findAll {it.name != 'integration-tests'}) {
ext {
ossrhUsername = project.hasProperty('ossrhUsername') ? project.property('ossrhUsername') : ''
ossrhPassword = project.hasProperty('ossrhPassword') ? project.property('ossrhPassword') : ''
bintrayUser = project.hasProperty('bintrayUser') ? project.property('bintrayUser') : System.getenv('BINTRAY_USER')
bintrayKey = project.hasProperty('bintrayApiKey') ? project.property('bintrayApiKey') : System.getenv('BINTRAY_API_KEY')
isSnapshotVersion = project.version.endsWith("-SNAPSHOT")
}
publishing {
@@ -150,7 +149,12 @@ configure(subprojects.findAll {it.name != 'integration-tests'}) {
mavenDeployer {
beforeDeployment { MavenDeployment deployment -> signing.signPom(deployment) }
repository(url: 'https://oss.sonatype.org/service/local/staging/deploy/maven2/') {
onlyIf {
ossrhUsername != '' && ossrhPassword != ''
}
String repoUrl = isSnapshotVersion ? "http://oss.sonatype.org/content/repositories/snapshots/" : "https://oss.sonatype.org/service/local/staging/deploy/maven2/"
repository(url: repoUrl) {
authentication(
userName: ossrhUsername,
password: ossrhPassword
@@ -193,8 +197,8 @@ configure(subprojects.findAll {it.name != 'integration-tests'}) {
}
bintray {
user = project.hasProperty('bintrayUser') ? project.property('bintrayUser') : System.getenv('BINTRAY_USER')
key = project.hasProperty('bintrayApiKey') ? project.property('bintrayApiKey') : System.getenv('BINTRAY_API_KEY')
user = bintrayUser
key = bintrayKey
publications = ['mavenJava']
publish = true
pkg {
@@ -214,10 +218,12 @@ configure(subprojects.findAll {it.name != 'integration-tests'}) {
//TODO run clean & closeAndPromoteRepository once
dependsOn 'build'
dependsOn 'uploadArchives'
dependsOn 'bintrayUpload'
if (!isSnapshotVersion && bintrayUser != '' && bintrayKey != '') {
dependsOn 'bintrayUpload'
tasks.findByName('bintrayUpload').mustRunAfter 'build'
}
tasks.findByName('uploadArchives').mustRunAfter 'build'
tasks.findByName('bintrayUpload').mustRunAfter 'build'
}
}
@@ -226,7 +232,7 @@ task jacocoRootTestReport(type: org.gradle.testing.jacoco.tasks.JacocoReport) {
dependsOn = subprojects.test
additionalSourceDirs = files(subprojects.sourceSets.main.allSource.srcDirs)
sourceDirectories = files(subprojects.sourceSets.main.allSource.srcDirs)
classDirectories = files(subprojects.sourceSets.main.output)
classDirectories = files(subprojects.sourceSets.main.output)
executionData = files(subprojects.jacocoTestReport.executionData)
reports {
xml.enabled = true

0 comments on commit c537000

Please sign in to comment.