You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
Android-Download/Aria/jcenter.gradle

143 lines
4.2 KiB

8 years ago
group = PROJ_GROUP_ID
9 years ago
version = PROJ_VERSION
8 years ago
project.archivesBaseName = PROJ_ARTIFACT_ID
9 years ago
apply plugin: 'com.jfrog.bintray'
8 years ago
apply plugin: 'com.github.dcendents.android-maven'
8 years ago
//输入:gradlew bintray 执行
9 years ago
8 years ago
//############################## jar、sources、doc 打包 start #######################################
9 years ago
task sourcesJar(type: Jar) {
8 years ago
from android.sourceSets.main.java.srcDirs
classifier = 'sources'
9 years ago
}
task javadoc(type: Javadoc) {
8 years ago
source = android.sourceSets.main.java.srcDirs
classpath += configurations.compile
classpath += project.files(android.getBootClasspath().join(File.pathSeparator))
9 years ago
}
task javadocJar(type: Jar, dependsOn: javadoc) {
8 years ago
classifier = 'javadoc'
from javadoc.destinationDir
9 years ago
}
javadoc {
8 years ago
options {
encoding "UTF-8"
charSet 'UTF-8'
author true
version true
links "http://docs.oracle.com/javase/7/docs/api"
8 years ago
title PROJ_ARTIFACT_ID
8 years ago
}
9 years ago
}
//添加以下信息避免JAVADOC打包时引用其它类库而出现问题,比如出现以下错误
// xxxx.java:20: 错误: 找不到符号
// public static <T> T create(JsonElement json, Class<T> classOfModel) {
// ^
// 符号: 类 JsonElement
// 位置: 类 xxxx
android.libraryVariants.all { variant ->
8 years ago
println variant.javaCompile.classpath.files
if (variant.name == 'release') {
//我们只需 release 的 javadoc
task("generate${variant.name.capitalize()}Javadoc", type: Javadoc) {
// title = ''
// description = ''
source = variant.javaCompile.source
classpath = files(variant.javaCompile.classpath.files, project.android.getBootClasspath())
options {
encoding "utf-8"
links "http://docs.oracle.com/javase/7/docs/api/"
linksOffline "http://d.android.com/reference", "${android.sdkDirectory}/docs/reference"
}
exclude '**/BuildConfig.java'
exclude '**/R.java'
}
task("javadoc${variant.name.capitalize()}Jar", type: Jar,
dependsOn: "generate${variant.name.capitalize()}Javadoc") {
classifier = 'javadoc'
from tasks.getByName("generate${variant.name.capitalize()}Javadoc").destinationDir
}
8 years ago
artifacts {
archives tasks.getByName("javadoc${variant.name.capitalize()}Jar")
}
}
9 years ago
}
artifacts {
8 years ago
archives javadocJar
archives sourcesJar
9 years ago
}
8 years ago
//############################## jar、sources、doc 打包 end #######################################
9 years ago
8 years ago
//################################# jcenter 上传配置 start #########################################
9 years ago
bintray {
8 years ago
// user = hasProperty("bintrayUser") ? getProperty("bintrayUser") : getProperty("BINTRAY_USER")
// key = hasProperty("bintrayKey") ? getProperty("bintrayKey") : getProperty("BINTRAY_KEY")
user = BINTRAY_USER
key = BINTRAY_KEY
8 years ago
configurations = ['archives']
9 years ago
8 years ago
pkg {
8 years ago
repo = PROJ_REPO
8 years ago
name = PROJ_NAME
desc = PROJ_DESCRIPTION
8 years ago
websiteUrl = PROJ_WEB_SITE_URL
issueTrackerUrl = PROJ_ISSUE_TRACKER_URL
vcsUrl = PROJ_VCS_URL
publish = true
8 years ago
publicDownloadNumbers = true
8 years ago
licenses = LICENSES
// version {
// desc = libraryDescription
// 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'
// }
// }
8 years ago
}
9 years ago
}
8 years ago
//install
8 years ago
install {
repositories.mavenInstaller {
// This generates POM.xml with proper parameters
pom {
project {
packaging 'aar'
groupId PROJ_GROUP_ID
artifactId PROJ_ARTIFACT_ID
// Add your description here
name PROJ_NAME
description PROJ_DESCRIPTION
url PROJ_WEB_SITE_URL
// Set your license
licenses {
license {
name LICENSE_NAME
url LICENSE_URL
}
}
developers {
developer {
id DEVELOPER_ID
name DEVELOPER_NAME
email DEVELOPER_EMAIL
}
}
scm {
connection PROJ_WEB_SITE_URL
developerConnection PROJ_WEB_SITE_URL
url PROJ_VCS_URL
}
}
9 years ago
}
8 years ago
}
8 years ago
}
//################################# jcenter 上传配置 end #########################################