Skip to content

Commit 87ecbff

Browse files
rogerhuJawnnypoo
authored andcommitted
Simplify our dependency creation by using plugin (#804)
1 parent a848b04 commit 87ecbff

File tree

3 files changed

+11
-23
lines changed

3 files changed

+11
-23
lines changed

Parse/build.gradle

Lines changed: 8 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -217,7 +217,7 @@ bintray {
217217
user = System.getenv('BINTRAY_USER')
218218
key = System.getenv('BINTRAY_API_KEY')
219219

220-
publications = ["MyPublication"]
220+
publications = ["mavenAar"]
221221

222222
publish = true
223223
pkg {
@@ -244,35 +244,20 @@ bintray {
244244
}
245245

246246
// Create the publication with the pom configuration:
247-
apply plugin: 'maven-publish'
247+
apply plugin: 'digital.wup.android-maven-publish'
248+
248249
publishing {
249250
publications {
250-
MyPublication(MavenPublication) {
251+
mavenAar(MavenPublication) {
252+
from components.android
251253
groupId group
252254
// We have to specify it here because otherwise Bintray's plugin will assume the artifact's name is Parse
253255
artifactId artifact
254256
artifacts = [androidSourcesJar, javadocJarRelease, bundleRelease]
255257
version version
256-
pom.withXml {
257-
def root = asNode()
258-
root.appendNode('description', projDescription)
259-
root.appendNode('name', projName)
260-
root.appendNode('url', gitLink)
261-
root.children().last() + pomConfig
262-
263-
// maven-publish workaround to include dependencies
264-
def dependenciesNode = asNode().appendNode('dependencies')
265-
266-
//Iterate over the compile dependencies (we don't want the test ones), adding a <dependency> node for each
267-
configurations.implementation.allDependencies.each {
268-
def dependencyNode = dependenciesNode.appendNode('dependency')
269-
dependencyNode.appendNode('groupId', it.group)
270-
dependencyNode.appendNode('artifactId', it.name)
271-
dependencyNode.appendNode('version', it.version)
272-
}
273-
274-
}
258+
275259
}
260+
276261
}
277262
}
278263

@@ -292,7 +277,7 @@ artifactory {
292277
}
293278
defaults {
294279
publishArtifacts = true
295-
publications('MyPublication')
280+
publications('mavenAar')
296281
}
297282
}
298283
}

build.gradle

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ plugins {
1212
id "com.jfrog.artifactory" version "4.4.18"
1313
id "com.jfrog.bintray" version "1.7.3"
1414
id 'com.github.ben-manes.versions' version '0.17.0'
15+
id 'digital.wup.android-maven-publish' version '3.2.0' // tweak depending on Gradle version
1516
}
1617

1718
allprojects {

gradle/wrapper/gradle-wrapper.properties

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,6 @@ distributionBase=GRADLE_USER_HOME
33
distributionPath=wrapper/dists
44
zipStoreBase=GRADLE_USER_HOME
55
zipStorePath=wrapper/dists
6+
# Make sure to update the version of android-maven-publish if you bump the Gradle version
7+
# See: https://github.com/wupdigital/android-maven-publish
68
distributionUrl=https\://services.gradle.org/distributions/gradle-4.4-all.zip

0 commit comments

Comments
 (0)