Skip to content
This repository has been archived by the owner on Oct 3, 2024. It is now read-only.

Commit

Permalink
Rewrite POM generation (#188)
Browse files Browse the repository at this point in the history
  • Loading branch information
samtstern authored Dec 13, 2017
2 parents fd4d351 + 771fdc2 commit 06a8357
Show file tree
Hide file tree
Showing 4 changed files with 98 additions and 62 deletions.
4 changes: 1 addition & 3 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,6 @@ buildscript {

dependencies {
classpath 'com.android.tools.build:gradle:3.0.1'

classpath 'com.github.dcendents:android-maven-gradle-plugin:1.5'
classpath 'com.jfrog.bintray.gradle:gradle-bintray-plugin:1.7.3'
}
}
Expand All @@ -31,7 +29,7 @@ ext {

mavenGroup = 'pub.devrel'
mavenArtifactId = 'easypermissions'
mavenVersion = '1.1.0'
mavenVersion = '1.1.1-SNAPSHOT'

bintrayOrg = 'easygoogle'

Expand Down
97 changes: 97 additions & 0 deletions easypermissions/bintray.gradle
Original file line number Diff line number Diff line change
@@ -1,12 +1,102 @@
apply plugin: 'com.jfrog.bintray'
apply plugin: 'maven-publish'

group = mavenGroup
version = mavenVersion

task sourcesJar(type: Jar) {
from android.sourceSets.main.java.srcDirs
classifier = 'sources'
}

task javadoc(type: Javadoc) {
source = android.sourceSets.main.java.srcDirs
classpath += configurations.compile
classpath += project.files(android.getBootClasspath().join(File.pathSeparator))

failOnError = false
}

task javadocJar(type: Jar, dependsOn: javadoc) {
classifier = 'javadoc'
from javadoc.destinationDir
}

artifacts {
archives sourcesJar
archives javadocJar
}

publishing {
publications {
library(MavenPublication) {

groupId mavenGroup
artifactId mavenArtifactId
version mavenVersion

artifact "$buildDir/outputs/aar/$mavenArtifactId-release.aar"
artifact javadocJar
artifact sourcesJar

pom.withXml {
// Name
asNode().appendNode('name', "EasyPermissions")

// Description
asNode().appendNode('description', 'A wrapper library for basic Android M system permissions logic')

// URL
asNode().appendNode('url', 'https://github.com/googlesamples/easypermissions')

// Inception Year
asNode().appendNode('inceptionYear', '2015')

// Licenses
def license = asNode().appendNode('licenses').appendNode('license')
license.appendNode('name', 'The Apache Software License, Version 2.0')
license.appendNode('url', 'http://www.apache.org/licenses/LICENSE-2.0.txt')
license.appendNode('distribution', 'repo')

// Developers
def developer = asNode().appendNode('developers').appendNode('developer')
developer.appendNode('name', 'Google')

// SCM
def scm = asNode().appendNode('scm')
scm.appendNode('connection', 'https://github.com/googlesamples/easypermissions.git')
scm.appendNode('url', 'https://github.com/googlesamples/easypermissions')

// Dependencies
def dependenciesNode = asNode().getAt('dependencies')[0]
if (dependenciesNode == null) {
dependenciesNode = asNode().appendNode('dependencies')
}

// Add all that are 'compile'
configurations.api.allDependencies.each {
def dependencyNode = dependenciesNode.appendNode('dependency')
dependencyNode.appendNode('groupId', it.group)
dependencyNode.appendNode('artifactId', it.name)
dependencyNode.appendNode('version', it.version)
}
}
}
}
}

bintray {
user = hasProperty('BINTRAY_USER') ? getProperty('BINTRAY_USER') : System.getenv('BINTRAY_USER')
key = hasProperty('BINTRAY_KEY') ? getProperty('BINTRAY_KEY') : System.getenv('BINTRAY_KEY')

filesSpec {
from "$buildDir/publications/library/pom-default.xml"
into "pub/devrel/$mavenArtifactId/$mavenVersion/"
rename { String fileName ->
"${mavenArtifactId}-${mavenVersion}.pom"
}
}

configurations = [ 'archives' ]

pkg {
Expand All @@ -22,3 +112,10 @@ bintray {
}
}
}

afterEvaluate { project ->
def pomTask = "generatePomFileForLibraryPublication"

// Convenience task to prepare everything we need for releases
task prepareArtifacts(dependsOn: [javadocJar, sourcesJar, assembleRelease, pomTask]) {}
}
1 change: 0 additions & 1 deletion easypermissions/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -27,5 +27,4 @@ dependencies {
testImplementation 'org.robolectric:robolectric:3.5.1'
}

apply from: 'maven.gradle'
apply from: 'bintray.gradle'
58 changes: 0 additions & 58 deletions easypermissions/maven.gradle

This file was deleted.

0 comments on commit 06a8357

Please sign in to comment.