Skip to content

Commit

Permalink
Merge pull request #34 from andreban/maven-generation
Browse files Browse the repository at this point in the history
Generate Maven Artifacts
  • Loading branch information
andreban authored Oct 18, 2019
2 parents 9f0a0f0 + 450426c commit 9f96eef
Showing 1 changed file with 43 additions and 0 deletions.
43 changes: 43 additions & 0 deletions androidbrowserhelper/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
*/

apply plugin: 'com.android.library'
apply plugin: 'maven-publish'

android {
compileSdkVersion 28
Expand Down Expand Up @@ -61,3 +62,45 @@ dependencies {
androidTestImplementation 'com.linkedin.dexmaker:dexmaker-mockito:2.19.0'
androidTestImplementation 'junit:junit:4.12'
}

publishing {
publications {
Production(MavenPublication) {
pom {
name = 'android-browser-helper'
url = 'https://github.com/GoogleChrome/android-browser-helper'
licenses {
license {
name = 'The Apache License, Version 2.0'
url = 'http://www.apache.org/licenses/LICENSE-2.0.txt'
}
}
}

artifact("$buildDir/outputs/aar/androidbrowserhelper-release.aar")

groupId 'com.google.androidbrowserhelper'
artifactId 'androidbrowserhelper'
version '0.1.0-alpha1'

// This ensures that the generated POM file contains the correct Android dependencies.
// The section used the BinTray example as a base:
// https://github.com/bintray/bintray-examples/blob/master/gradle-bintray-plugin-examples/android-gradle-3.0.0-maven-example/app/publish.gradle#L7-L31
pom.withXml {
def dependenciesNode = asNode().appendNode('dependencies')

// Iterate over the implementation dependencies (we don't want the test ones),
// adding a <dependency> node for each
configurations.implementation.allDependencies.each {
// Ensure dependencies such as fileTree are not included in the pom.
if (it.name != 'unspecified') {
def dependencyNode = dependenciesNode.appendNode('dependency')
dependencyNode.appendNode('groupId', it.group)
dependencyNode.appendNode('artifactId', it.name)
dependencyNode.appendNode('version', it.version)
}
}
}
}
}
}

0 comments on commit 9f96eef

Please sign in to comment.