Created
June 27, 2018 09:30
-
-
Save prokash-sarkar/3132bbc0a79564255f2507961f975ac4 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
// ./gradlew clean build generateRelease | |
apply plugin: 'maven' | |
def groupId = project.PUBLISH_GROUP_ID | |
def artifactId = project.PUBLISH_ARTIFACT_ID | |
def version = project.PUBLISH_VERSION | |
def localReleaseDest = "${buildDir}/release/${version}" | |
task androidJavadocs(type: Javadoc) { | |
failOnError = false | |
source = android.sourceSets.main.java.srcDirs | |
ext.androidJar = "${android.sdkDirectory}/platforms/${android.compileSdkVersion}/android.jar" | |
classpath += files(ext.androidJar) | |
} | |
task androidJavadocsJar(type: Jar, dependsOn: androidJavadocs) { | |
classifier = 'javadoc' | |
from androidJavadocs.destinationDir | |
} | |
task androidSourcesJar(type: Jar) { | |
classifier = 'sources' | |
from android.sourceSets.main.java.srcDirs | |
} | |
uploadArchives { | |
repositories.mavenDeployer { | |
pom.groupId = groupId | |
pom.artifactId = artifactId | |
pom.version = version | |
// Add other pom properties here if you want (developer details / licenses) | |
repository(url: "file://${localReleaseDest}") | |
} | |
} | |
task zipRelease(type: Zip) { | |
from localReleaseDest | |
destinationDir buildDir | |
archiveName "release-${version}.zip" | |
} | |
task generateRelease { | |
doLast { | |
println "Release ${version} can be found at ${localReleaseDest}/" | |
println "Release ${version} zipped can be found ${buildDir}/release-${version}.zip" | |
} | |
} | |
generateRelease.dependsOn(uploadArchives) | |
generateRelease.dependsOn(zipRelease) | |
artifacts { | |
archives androidSourcesJar | |
archives androidJavadocsJar | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment