Skip to content

Commit

Permalink
Update config to enable Bintray uploads (#51)
Browse files Browse the repository at this point in the history
Shared POM config between Bintray and Sonatype
  • Loading branch information
rogerhu authored May 4, 2017
1 parent 29211d8 commit 5f49e23
Show file tree
Hide file tree
Showing 2 changed files with 111 additions and 27 deletions.
134 changes: 107 additions & 27 deletions ParseLiveQuery/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,13 @@ apply plugin: 'com.github.kt3k.coveralls'
group = 'com.parse'
version = '1.0.3'

ext {
projDescription = 'A library that gives you access to the powerful Parse cloud platform from your Android app.'
artifact = 'parse-livequery-android'
projName = 'Parse-LiveQuery-Android'
gitLink = 'https://github.com/parse-community/ParseLiveQuery-Android'
}

buildscript {
repositories {
jcenter()
Expand Down Expand Up @@ -107,6 +114,29 @@ def isSnapshot = version.endsWith('-SNAPSHOT')
def ossrhUsername = hasProperty('NEXUS_USERNAME') ? NEXUS_USERNAME : System.getenv('CI_NEXUS_USERNAME')
def ossrhPassword = hasProperty('NEXUS_PASSWORD') ? NEXUS_PASSWORD : System.getenv('CI_NEXUS_PASSWORD')

def pomConfig = {
scm {
connection 'scm:[email protected]:parse-community/ParseLiveQuery-Android.git'
developerConnection 'scm:[email protected]:parse-community/ParseLiveQuery-Android.git'
url gitLink
}

licenses {
license {
name 'BSD License'
url 'https://github.com/parse-community/ParseLiveQuery-Android/blob/master/LICENSE'
distribution 'repo'
}
}

developers {
developer {
id 'parse'
name 'Parse'
}
}
}

uploadArchives {
repositories.mavenDeployer {
beforeDeployment { MavenDeployment deployment -> signing.signPom(deployment) }
Expand All @@ -119,34 +149,15 @@ uploadArchives {
authentication(userName: ossrhUsername, password: ossrhPassword)
}

pom.project {
name 'Parse-LiveQuery-Android'
artifactId = 'parse-livequery-android'
packaging 'aar'
description 'A library that gives you access to the powerful Parse cloud platform from your Android app.'
url 'https://github.com/ParsePlatform/ParseLiveQuery-Android'

scm {
connection 'scm:[email protected]:ParsePlatform/ParseLiveQuery-Android.git'
developerConnection 'scm:[email protected]:ParsePlatform/ParseLiveQuery-Android.git'
url 'https://github.com/ParsePlatform/ParseLiveQuery-Android'
}

licenses {
license {
name 'BSD License'
url 'https://github.com/ParsePlatform/ParseLiveQuery-Android/blob/master/LICENSE'
distribution 'repo'
}
}

developers {
developer {
id 'parse'
name 'Parse'
}
}
def basePom = {
name projName
artifactId artifact
packaging 'aar'
description projDescription
url gitLink
}

pom.project basePom << pomConfig
}
}

Expand Down Expand Up @@ -207,3 +218,72 @@ task jacocoTestReport(type: JacocoReport, dependsOn: "testDebugUnitTest") {
coveralls.jacocoReportPath = "${buildDir}/reports/jacoco/jacocoTestReport/jacocoTestReport.xml"

//endregion

// Requires apply plugin: 'com.jfrog.bintray'

apply plugin: 'com.jfrog.bintray'

bintray {
user = System.getenv('BINTRAY_USER')
key = System.getenv('BINTRAY_API_KEY')

publications = ["MyPublication"]

publish = true
pkg {
repo = 'maven'
name = 'parse-livequery-android'
userOrg = 'parse'
licenses = ['BSD License']
vcsUrl = gitLink
version {
name = project.version
desc = projDescription
released = new Date()
vcsTag = project.version

// Sonatype username/passwrod must be set for this operation to happen
mavenCentralSync {
sync = true
user = ossrhUsername
password = ossrhPassword
close = '1' // release automatically
}
}
}
}

// Create the publication with the pom configuration:
apply plugin: 'maven-publish'

publishing {
publications {
MyPublication(MavenPublication) {
groupId group
artifactId artifact
artifacts = [androidSourcesJar, bundleRelease]
version version
pom.withXml {
def root = asNode()
root.appendNode('description', projDescription)
root.appendNode('name', projName)
root.appendNode('url', gitLink)
root.children().last() + pomConfig

// maven-publish workaround to include dependencies
def dependenciesNode = asNode().appendNode('dependencies')

//Iterate over the compile dependencies (we don't want the test ones), adding a <dependency> node for each
configurations.compile.allDependencies.each {
def dependencyNode = dependenciesNode.appendNode('dependency')
dependencyNode.appendNode('groupId', it.group)
dependencyNode.appendNode('artifactId', it.name)
dependencyNode.appendNode('version', it.version)
}

}
}
}
}

// End of Bintray plugin
4 changes: 4 additions & 0 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,10 @@ buildscript {
}
}

plugins {
id "com.jfrog.bintray" version "1.7.3"
}

allprojects {
repositories {
jcenter()
Expand Down

0 comments on commit 5f49e23

Please sign in to comment.