Created
May 4, 2020 14:52
-
-
Save chenzhang2006/c254e4403171f403df319fe71059227f to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
apply plugin: 'maven-publish' | |
def LIB_GROUP_ID = 'com.chenzhang2006.libraries' | |
def LIB_ARTIFACT_ID = 'droidlib2' | |
def LIB_VERSION = '3.0.1' | |
task sourceJar(type: Jar) { | |
from android.sourceSets.main.java.srcDirs | |
classifier "sources" | |
} | |
publishing { | |
repositories { | |
maven { | |
name = "GithubPackages" | |
url = uri("https://maven.pkg.github.com/chenzhang2006/AndroidLibForArtifactory") | |
credentials { | |
username = System.getenv('GITHUB_USER') ?: project.properties['GITHUB_USER'] | |
password = System.getenv('GITHUB_PERSONAL_ACCESS_TOKEN') ?: project.properties['GITHUB_PERSONAL_ACCESS_TOKEN'] | |
} | |
} | |
maven { | |
name = 'CustomMavenRepo' | |
url = "file://${buildDir}/repo" | |
} | |
} | |
publications { | |
droidlib2(MavenPublication) { | |
groupId LIB_GROUP_ID | |
artifactId LIB_ARTIFACT_ID | |
version LIB_VERSION | |
artifact("$buildDir/outputs/aar/droidlibrary2-release.aar") | |
artifact(sourceJar) | |
pom.withXml { | |
def dependenciesNode = asNode().appendNode('dependencies') | |
//Iterate over the compile dependencies (we don't want the test ones), adding a <dependency> node for each | |
configurations.api.allDependencies.each { | |
def dependencyNode = dependenciesNode.appendNode('dependency') | |
dependencyNode.appendNode('groupId', it.group) | |
dependencyNode.appendNode('artifactId', it.name) | |
dependencyNode.appendNode('version', it.version) | |
} | |
} | |
} | |
} | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment