@@ -31,29 +31,52 @@ def publishing_task(libraryArtifactId, packageName) {
3131 rename(' classes.jar' , packageName + ' .jar' )
3232 }
3333
34+ task androidJavadocs(type : Javadoc ) {
35+ failOnError false
36+ source = android. sourceSets. main. java. sourceFiles
37+ classpath + = project. files(android. getBootClasspath(). join(File . pathSeparator))
38+ classpath + = configurations. compile
39+ }
40+
41+ task androidJavadocsJar(type : Jar , dependsOn : androidJavadocs) {
42+ classifier = ' javadoc'
43+ from androidJavadocs. destinationDir
44+ }
45+
46+ task androidSourcesJar(type : Jar ) {
47+ classifier = ' sources'
48+ from android. sourceSets. main. java. srcDirs
49+ }
50+
3451 publishing {
3552 publications {
3653 aar(MavenPublication ) {
3754 groupId LEANPLUM_GROUP_ID
3855 version LEANPLUM_SDK_VERSION
3956 artifactId libraryArtifactId
57+
4058 artifact(" $buildDir /outputs/aar/" + packageName + " .aar" )
59+ artifact androidJavadocsJar
60+ artifact androidSourcesJar
4161
4262 // The publication doesn't know about our dependencies,
4363 // so we have to manually add them to the pom.
4464
45- pomWithXml(pom, ' aar' )
65+ pomWithXml(pom, ' aar' , libraryArtifactId )
4666 }
67+
4768 jar(MavenPublication ) {
4869 groupId LEANPLUM_GROUP_ID
4970 version LEANPLUM_SDK_VERSION
5071 artifactId libraryArtifactId
5172
5273 artifact(" $buildDir /outputs/jar/" + packageName + " .jar" )
74+ artifact androidJavadocsJar
75+ artifact androidSourcesJar
5376
5477 // The publication doesn't know about our dependencies,
5578 // so we have to manually add them to the pom.
56- pomWithXml(pom, ' jar' )
79+ pomWithXml(pom, ' jar' , libraryArtifactId )
5780 }
5881 }
5982 }
@@ -76,14 +99,35 @@ def publishing_task(libraryArtifactId, packageName) {
7699 }
77100 }
78101 }
102+
103+
104+ bintray {
105+ user = System . getenv(' BINTRAY_USER' )
106+ key = System . getenv(' BINTRAY_API_KEY' )
107+ publications = [' aar' , ' jar' ]
108+ pkg {
109+ repo = ' maven'
110+ name = libraryArtifactId
111+ userOrg = ' leanplum'
112+ licenses = [' Apache-2.0' ]
113+ vcsUrl = ' https://github.com/Leanplum/Leanplum-Android-SDK.git'
114+ version {
115+ name = LEANPLUM_SDK_VERSION
116+ released = new Date ()
117+ vcsTag = LEANPLUM_SDK_VERSION
118+ }
119+ publish = true
120+ }
121+ }
79122}
80123
81- def pomWithXml (pom , libraryType ) {
124+ def pomWithXml (pom , libraryType , libraryArtifactId ) {
82125 pom. withXml {
126+ def root = asNode()
83127 if (' jar' == libraryType){
84- asNode() . appendNode(' packaging' , ' aar' ) // Default to aar packaging.
128+ root . appendNode(' packaging' , ' aar' ) // Default to aar packaging.
85129 }
86- def dependenciesNode = asNode() . appendNode(' dependencies' )
130+ def dependenciesNode = root . appendNode(' dependencies' )
87131 // Iterate over the compile dependencies (we don't want the test ones),
88132 // adding a <dependency> node for each.
89133 configurations. api. allDependencies. each {
@@ -92,6 +136,19 @@ def pomWithXml(pom, libraryType) {
92136 configurations. releaseApi. allDependencies. each {
93137 pomConfig(it, dependenciesNode)
94138 }
139+ root. appendNode(' description' , ' The Leanplum SDK messaging platform' )
140+ root. appendNode(' name' , libraryArtifactId)
141+ root. appendNode(' url' , ' https://github.com/Leanplum/Leanplum-Android-SDK' )
142+ def scmNode = root. appendNode(' scm' )
143+ scmNode. appendNode(' url' , ' https://github.com/Leanplum/Leanplum-Android-SDK' )
144+ def developersNode = root. appendNode(' developers' )
145+ def developerNode = developersNode. appendNode(' developer' )
146+ developerNode. appendNode(' name' , ' Leanplum' )
147+ def licensesNode = root. appendNode(' licenses' )
148+ def licenseNode = licensesNode. appendNode(' license' )
149+ licenseNode. appendNode(' name' , ' The Apache Software License, Version 2.0' )
150+ licenseNode. appendNode(' url' , ' http://www.apache.org/licenses/LICENSE-2.0.txt' )
151+ licenseNode. appendNode(' distribution' , ' repo' )
95152 }
96153}
97154
0 commit comments