Skip to content

Instantly share code, notes, and snippets.

@PatilShreyas
Created April 30, 2020 08:28
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save PatilShreyas/402d03bbe004df7f75154a160db4ebc2 to your computer and use it in GitHub Desktop.
Save PatilShreyas/402d03bbe004df7f75154a160db4ebc2 to your computer and use it in GitHub Desktop.
ext {
// This should be same as you've created in bintray
bintrayRepo = 'maven'
// Name which will be visible on bintray
bintrayName = 'CoolLibrary'
// Library Details
publishedGroupId = 'dev.shreyaspatil'
libraryName = 'CoolLibrary'
artifact = 'CoolLibrary'
libraryDescription = 'Cool Library'
libraryVersion = version
// Repository Link (For e.g. GitHub repo)
siteUrl = 'https://github.com/patilshreyas/AndroidLibDemo'
gitUrl = 'https://github.com/patilshreyas/AndroidLibDemo.git'
githubRepository= 'patilshreyas/AndroidLibDemo'
// Developer Details
developerId = 'patilshreyas'
developerName = 'Shreyas Patil'
developerEmail = 'shreyaspatilg@gmail.com'
// License Details
licenseName = 'The Apache Software License, Version 2.0'
licenseUrl = 'http://www.apache.org/licenses/LICENSE-2.0.txt'
allLicenses = ["Apache-2.0"]
}
// This is mandatory
group = publishedGroupId
install {
repositories.mavenInstaller {
// This generates POM.xml with proper parameters
pom {
project {
packaging 'aar'
groupId publishedGroupId
artifactId = artifact
name libraryName
description = libraryDescription
url siteUrl
licenses {
license {
name licenseName
url licenseUrl
}
}
developers {
developer {
id developerId
name developerName
email developerEmail
}
}
scm {
connection gitUrl
developerConnection gitUrl
url siteUrl
}
}
}
}
}
// Avoid Kotlin docs error
tasks.withType(Javadoc) {
enabled = false
}
// Remove javadoc related tasks
task javadoc(type: Javadoc) {
source = android.sourceSets.main.java.srcDirs
classpath += project.files(android.getBootClasspath().join(File.pathSeparator))
}
task sourcesJar(type: Jar) {
from android.sourceSets.main.java.srcDirs
classifier = 'sources'
}
task javadocJar(type: Jar, dependsOn: javadoc) {
classifier = 'javadoc'
from javadoc.destinationDir
}
artifacts {
archives javadocJar
archives sourcesJar
}
// https://github.com/bintray/gradle-bintray-plugin
bintray {
user = System.getenv("bintrayUser")
key = System.getenv("bintrayApiKey")
configurations = ['archives']
pkg {
repo = bintrayRepo
name = bintrayName
websiteUrl = siteUrl
vcsUrl = gitUrl
licenses = allLicenses
publish = true
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment