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/downloadutil/jcenter.gradle

166 lines
4.5 KiB

9 years ago
group = PROJ_GROUP
version = PROJ_VERSION
project.archivesBaseName = PROJ_ARTIFACTID
apply plugin: 'com.jfrog.bintray'
apply plugin: "com.jfrog.artifactory"
apply plugin: 'maven-publish'
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"
title PROJ_ARTIFACTID
}
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
}
artifacts {
archives tasks.getByName("javadoc${variant.name.capitalize()}Jar")
}
}
9 years ago
}
artifacts {
8 years ago
archives javadocJar
archives sourcesJar
9 years ago
}
def pomConfig = {
8 years ago
scm {
connection PROJ_VCSURL
developerConnection PROJ_VCSURL
url PROJ_WEBSITEURL
}
licenses {
license {
name "The Apache Software License, Version 2.0"
url "http://www.apache.org/licenses/LICENSE-2.0.txt"
distribution "repo"
}
9 years ago
}
8 years ago
developers {
developer {
id DEVELOPER_ID
name DEVELOPER_NAME
email DEVELOPER_EMAIL
}
}
"dependencies " {
// dependency {
// groupId "com.alibaba"
// artifactId "fastjson"
// "version " "1.2.6"
// //同dependencies
// }
// }
9 years ago
}
}
publishing {
8 years ago
publications {
mavenJava(MavenPublication) {
artifactId PROJ_ARTIFACTID
artifact javadocJar
artifact sourcesJar
9 years ago
8 years ago
pom {
packaging 'aar'
}
pom.withXml {
def root = asNode()
root.appendNode('description', PROJ_DESCRIPTION)
root.children().last() + pomConfig
}
}
9 years ago
}
}
afterEvaluate {
8 years ago
publishing.publications.mavenJava.artifact(bundleRelease)
9 years ago
}
bintray {
8 years ago
user = hasProperty("bintrayUser") ? getProperty("bintrayUser") : getProperty("BINTRAY_USER")
key = hasProperty("bintrayKey") ? getProperty("bintrayKey") : getProperty("BINTRAY_KEY")
9 years ago
8 years ago
configurations = ['archives']
publications = ['mavenJava']
publish = true
9 years ago
8 years ago
pkg {
repo = 'maven'
name = PROJ_NAME
desc = PROJ_DESCRIPTION
websiteUrl = PROJ_WEBSITEURL
issueTrackerUrl = PROJ_ISSUETRACKERURL
vcsUrl = PROJ_VCSURL
licenses = ['Apache-2.0']
publicDownloadNumbers = true
}
9 years ago
}
artifactory {
8 years ago
contextUrl = 'http://oss.jfrog.org/artifactory'
resolve {
repository {
repoKey = 'libs-release'
}
9 years ago
}
8 years ago
publish {
repository {
repoKey = 'oss-snapshot-local' //The Artifactory repository key to publish to
username = bintray.user
password = bintray.key
maven = true
}
defaults {
publications('mavenJava')
publishArtifacts = true
}
9 years ago
}
}