Skip to content

Commit 5f49e23

Browse files
authored
Update config to enable Bintray uploads (#51)
Shared POM config between Bintray and Sonatype
1 parent 29211d8 commit 5f49e23

File tree

2 files changed

+111
-27
lines changed

2 files changed

+111
-27
lines changed

ParseLiveQuery/build.gradle

+107-27
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,13 @@ apply plugin: 'com.github.kt3k.coveralls'
66
group = 'com.parse'
77
version = '1.0.3'
88

9+
ext {
10+
projDescription = 'A library that gives you access to the powerful Parse cloud platform from your Android app.'
11+
artifact = 'parse-livequery-android'
12+
projName = 'Parse-LiveQuery-Android'
13+
gitLink = 'https://github.com/parse-community/ParseLiveQuery-Android'
14+
}
15+
916
buildscript {
1017
repositories {
1118
jcenter()
@@ -107,6 +114,29 @@ def isSnapshot = version.endsWith('-SNAPSHOT')
107114
def ossrhUsername = hasProperty('NEXUS_USERNAME') ? NEXUS_USERNAME : System.getenv('CI_NEXUS_USERNAME')
108115
def ossrhPassword = hasProperty('NEXUS_PASSWORD') ? NEXUS_PASSWORD : System.getenv('CI_NEXUS_PASSWORD')
109116

117+
def pomConfig = {
118+
scm {
119+
connection 'scm:[email protected]:parse-community/ParseLiveQuery-Android.git'
120+
developerConnection 'scm:[email protected]:parse-community/ParseLiveQuery-Android.git'
121+
url gitLink
122+
}
123+
124+
licenses {
125+
license {
126+
name 'BSD License'
127+
url 'https://github.com/parse-community/ParseLiveQuery-Android/blob/master/LICENSE'
128+
distribution 'repo'
129+
}
130+
}
131+
132+
developers {
133+
developer {
134+
id 'parse'
135+
name 'Parse'
136+
}
137+
}
138+
}
139+
110140
uploadArchives {
111141
repositories.mavenDeployer {
112142
beforeDeployment { MavenDeployment deployment -> signing.signPom(deployment) }
@@ -119,34 +149,15 @@ uploadArchives {
119149
authentication(userName: ossrhUsername, password: ossrhPassword)
120150
}
121151

122-
pom.project {
123-
name 'Parse-LiveQuery-Android'
124-
artifactId = 'parse-livequery-android'
125-
packaging 'aar'
126-
description 'A library that gives you access to the powerful Parse cloud platform from your Android app.'
127-
url 'https://github.com/ParsePlatform/ParseLiveQuery-Android'
128-
129-
scm {
130-
connection 'scm:[email protected]:ParsePlatform/ParseLiveQuery-Android.git'
131-
developerConnection 'scm:[email protected]:ParsePlatform/ParseLiveQuery-Android.git'
132-
url 'https://github.com/ParsePlatform/ParseLiveQuery-Android'
133-
}
134-
135-
licenses {
136-
license {
137-
name 'BSD License'
138-
url 'https://github.com/ParsePlatform/ParseLiveQuery-Android/blob/master/LICENSE'
139-
distribution 'repo'
140-
}
141-
}
142-
143-
developers {
144-
developer {
145-
id 'parse'
146-
name 'Parse'
147-
}
148-
}
152+
def basePom = {
153+
name projName
154+
artifactId artifact
155+
packaging 'aar'
156+
description projDescription
157+
url gitLink
149158
}
159+
160+
pom.project basePom << pomConfig
150161
}
151162
}
152163

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

209220
//endregion
221+
222+
// Requires apply plugin: 'com.jfrog.bintray'
223+
224+
apply plugin: 'com.jfrog.bintray'
225+
226+
bintray {
227+
user = System.getenv('BINTRAY_USER')
228+
key = System.getenv('BINTRAY_API_KEY')
229+
230+
publications = ["MyPublication"]
231+
232+
publish = true
233+
pkg {
234+
repo = 'maven'
235+
name = 'parse-livequery-android'
236+
userOrg = 'parse'
237+
licenses = ['BSD License']
238+
vcsUrl = gitLink
239+
version {
240+
name = project.version
241+
desc = projDescription
242+
released = new Date()
243+
vcsTag = project.version
244+
245+
// Sonatype username/passwrod must be set for this operation to happen
246+
mavenCentralSync {
247+
sync = true
248+
user = ossrhUsername
249+
password = ossrhPassword
250+
close = '1' // release automatically
251+
}
252+
}
253+
}
254+
}
255+
256+
// Create the publication with the pom configuration:
257+
apply plugin: 'maven-publish'
258+
259+
publishing {
260+
publications {
261+
MyPublication(MavenPublication) {
262+
groupId group
263+
artifactId artifact
264+
artifacts = [androidSourcesJar, bundleRelease]
265+
version version
266+
pom.withXml {
267+
def root = asNode()
268+
root.appendNode('description', projDescription)
269+
root.appendNode('name', projName)
270+
root.appendNode('url', gitLink)
271+
root.children().last() + pomConfig
272+
273+
// maven-publish workaround to include dependencies
274+
def dependenciesNode = asNode().appendNode('dependencies')
275+
276+
//Iterate over the compile dependencies (we don't want the test ones), adding a <dependency> node for each
277+
configurations.compile.allDependencies.each {
278+
def dependencyNode = dependenciesNode.appendNode('dependency')
279+
dependencyNode.appendNode('groupId', it.group)
280+
dependencyNode.appendNode('artifactId', it.name)
281+
dependencyNode.appendNode('version', it.version)
282+
}
283+
284+
}
285+
}
286+
}
287+
}
288+
289+
// End of Bintray plugin

build.gradle

+4
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,10 @@ buildscript {
88
}
99
}
1010

11+
plugins {
12+
id "com.jfrog.bintray" version "1.7.3"
13+
}
14+
1115
allprojects {
1216
repositories {
1317
jcenter()

0 commit comments

Comments
 (0)