Android-DFU-Library/gradle/gradle-bintray-push.gradle

132 lines
4.2 KiB
Groovy

apply plugin: 'maven-publish'
apply plugin: 'digital.wup.android-maven-publish'
apply plugin: 'com.jfrog.bintray'
version = VERSION_NAME
group = GROUP
afterEvaluate { project ->
publishing {
publications {
library(MavenPublication) {
from components.android
groupId = GROUP
artifactId = POM_ARTIFACT_ID
version = VERSION_NAME
pom {
name = POM_NAME
packaging = POM_PACKAGING
description = POM_DESCRIPTION
url = POM_URL
scm {
url = POM_SCM_URL
connection = POM_SCM_CONNECTION
developerConnection = POM_SCM_DEV_CONNECTION
}
licenses {
license {
name = POM_LICENCE_NAME
url = POM_LICENCE_URL
}
}
developers {
developer {
id = POM_DEVELOPER_ID
name = POM_DEVELOPER_NAME
email = POM_DEVELOPER_EMAIL
}
}
}
}
}
}
task javadoc(type: Javadoc) {
failOnError false
source = android.sourceSets.main.java.sourceFiles
title = POM_DESCRIPTION
options.links("https://docs.oracle.com/javase/8/docs/api/")
options.linksOffline("https://d.android.com/reference","${android.sdkDirectory}/docs/reference")
classpath += project.files(android.getBootClasspath().join(File.pathSeparator))
classpath += configurations.compile
// We're excluding these generated files
exclude '**/BuildConfig.java'
exclude '**/R.java'
}
task androidJavadocsJar(type: Jar, dependsOn: javadoc) {
classifier = 'javadoc'
from javadoc.destinationDir
}
task androidSourcesJar(type: Jar) {
classifier = 'sources'
from android.sourceSets.main.java.source
}
if (JavaVersion.current().isJava8Compatible()) {
allprojects {
tasks.withType(Javadoc) {
options.addStringOption('Xdoclint:none', '-quiet')
}
}
}
artifacts {
archives androidSourcesJar
archives androidJavadocsJar
}
}
// Bintray
Properties properties = new Properties()
properties.load(project.rootProject.file('local.properties').newDataInputStream())
bintray {
user = properties.getProperty("BINTRAY_USER")
key = properties.getProperty("BINTRAY_APIKEY")
publications = ['library']
pkg {
name = GROUP + ":" + POM_ARTIFACT_ID
desc = POM_DESCRIPTION
userOrg = properties.getProperty("BINTRAY_USER_ORG")
repo = properties.getProperty("BINTRAY_REPO")
websiteUrl = POM_URL
issueTrackerUrl = POM_URL + "/issues"
vcsUrl = POM_URL + ".git"
licenses = [POM_LICENCE]
publish = true
publicDownloadNumbers = true
version {
desc = POM_DESCRIPTION
vcsTag = "v" + VERSION_NAME
gpg {
sign = true // Determines whether to GPG sign the files. The default is false
passphrase = properties.getProperty("BINTRAY_GPG_PASSWORD") // Optional. The passphrase for GPG signing'
}
// Optional configuration for Maven Central sync of the version
mavenCentralSync {
sync = true //[Default: true] Determines whether to sync the version to Maven Central.
user = properties.getProperty("SONATYPE_NEXUS_USERNAME") //OSS user token: mandatory
password = properties.getProperty("SONATYPE_NEXUS_PASSWORD") //OSS user password: mandatory
close = '1' //Optional property. By default the staging repository is closed and artifacts are released to Maven Central. You can optionally turn this behaviour off (by puting 0 as value) and release the version manually.
}
}
}
}