|
|
@ -6,31 +6,30 @@ apply plugin: "com.jfrog.artifactory" |
|
|
|
apply plugin: 'maven-publish' |
|
|
|
apply plugin: 'maven-publish' |
|
|
|
|
|
|
|
|
|
|
|
task sourcesJar(type: Jar) { |
|
|
|
task sourcesJar(type: Jar) { |
|
|
|
from android.sourceSets.main.java.srcDirs |
|
|
|
from android.sourceSets.main.java.srcDirs |
|
|
|
classifier = 'sources' |
|
|
|
classifier = 'sources' |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
task javadoc(type: Javadoc) { |
|
|
|
task javadoc(type: Javadoc) { |
|
|
|
options.encoding = "utf-8" |
|
|
|
source = android.sourceSets.main.java.srcDirs |
|
|
|
source = android.sourceSets.main.java.srcDirs |
|
|
|
classpath += configurations.compile |
|
|
|
classpath += configurations.compile |
|
|
|
classpath += project.files(android.getBootClasspath().join(File.pathSeparator)) |
|
|
|
classpath += project.files(android.getBootClasspath().join(File.pathSeparator)) |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
task javadocJar(type: Jar, dependsOn: javadoc) { |
|
|
|
task javadocJar(type: Jar, dependsOn: javadoc) { |
|
|
|
classifier = 'javadoc' |
|
|
|
classifier = 'javadoc' |
|
|
|
from javadoc.destinationDir |
|
|
|
from javadoc.destinationDir |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
javadoc { |
|
|
|
javadoc { |
|
|
|
options { |
|
|
|
options { |
|
|
|
encoding "UTF-8" |
|
|
|
encoding "UTF-8" |
|
|
|
charSet 'UTF-8' |
|
|
|
charSet 'UTF-8' |
|
|
|
author true |
|
|
|
author true |
|
|
|
version true |
|
|
|
version true |
|
|
|
links "http://docs.oracle.com/javase/7/docs/api" |
|
|
|
links "http://docs.oracle.com/javase/7/docs/api" |
|
|
|
title PROJ_ARTIFACTID |
|
|
|
title PROJ_ARTIFACTID |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
//添加以下信息避免JAVADOC打包时引用其它类库而出现问题,比如出现以下错误 |
|
|
|
//添加以下信息避免JAVADOC打包时引用其它类库而出现问题,比如出现以下错误 |
|
|
@ -40,121 +39,128 @@ javadoc { |
|
|
|
// 符号: 类 JsonElement |
|
|
|
// 符号: 类 JsonElement |
|
|
|
// 位置: 类 xxxx |
|
|
|
// 位置: 类 xxxx |
|
|
|
android.libraryVariants.all { variant -> |
|
|
|
android.libraryVariants.all { variant -> |
|
|
|
println variant.javaCompile.classpath.files |
|
|
|
println variant.javaCompile.classpath.files |
|
|
|
if (variant.name == 'release') { |
|
|
|
if (variant.name == 'release') { //我们只需 release 的 javadoc |
|
|
|
//我们只需 release 的 javadoc |
|
|
|
task("generate${variant.name.capitalize()}Javadoc", type: Javadoc) { |
|
|
|
task("generate${variant.name.capitalize()}Javadoc", type: Javadoc) { |
|
|
|
// title = '' |
|
|
|
// title = '' |
|
|
|
// description = '' |
|
|
|
// description = '' |
|
|
|
source = variant.javaCompile.source |
|
|
|
source = variant.javaCompile.source |
|
|
|
classpath = files(variant.javaCompile.classpath.files, project.android.getBootClasspath()) |
|
|
|
classpath = files(variant.javaCompile.classpath.files, project.android.getBootClasspath()) |
|
|
|
options { |
|
|
|
options { |
|
|
|
encoding "utf-8" |
|
|
|
encoding "utf-8" |
|
|
|
links "http://docs.oracle.com/javase/7/docs/api/" |
|
|
|
links "http://docs.oracle.com/javase/7/docs/api/" |
|
|
|
linksOffline "http://d.android.com/reference", "${android.sdkDirectory}/docs/reference" |
|
|
|
linksOffline "http://d.android.com/reference", "${android.sdkDirectory}/docs/reference" |
|
|
|
} |
|
|
|
} |
|
|
|
exclude '**/BuildConfig.java' |
|
|
|
exclude '**/BuildConfig.java' |
|
|
|
exclude '**/R.java' |
|
|
|
exclude '**/R.java' |
|
|
|
} |
|
|
|
} |
|
|
|
task("javadoc${variant.name.capitalize()}Jar", type: Jar, dependsOn: "generate${variant.name.capitalize()}Javadoc") { |
|
|
|
task("javadoc${variant.name.capitalize()}Jar", type: Jar, |
|
|
|
classifier = 'javadoc' |
|
|
|
dependsOn: "generate${variant.name.capitalize()}Javadoc") { |
|
|
|
from tasks.getByName("generate${variant.name.capitalize()}Javadoc").destinationDir |
|
|
|
classifier = 'javadoc' |
|
|
|
} |
|
|
|
from tasks.getByName("generate${variant.name.capitalize()}Javadoc").destinationDir |
|
|
|
artifacts { |
|
|
|
|
|
|
|
archives tasks.getByName("javadoc${variant.name.capitalize()}Jar") |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
artifacts { |
|
|
|
|
|
|
|
archives tasks.getByName("javadoc${variant.name.capitalize()}Jar") |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
artifacts { |
|
|
|
artifacts { |
|
|
|
archives javadocJar |
|
|
|
archives javadocJar |
|
|
|
archives sourcesJar |
|
|
|
archives sourcesJar |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def pomConfig = { |
|
|
|
def pomConfig = { |
|
|
|
scm { |
|
|
|
scm { |
|
|
|
connection PROJ_VCSURL |
|
|
|
connection PROJ_VCSURL |
|
|
|
developerConnection PROJ_VCSURL |
|
|
|
developerConnection PROJ_VCSURL |
|
|
|
url PROJ_WEBSITEURL |
|
|
|
url PROJ_WEBSITEURL |
|
|
|
} |
|
|
|
} |
|
|
|
licenses { |
|
|
|
licenses { |
|
|
|
license { |
|
|
|
license { |
|
|
|
name "The Apache Software License, Version 2.0" |
|
|
|
name "The Apache Software License, Version 2.0" |
|
|
|
url "http://www.apache.org/licenses/LICENSE-2.0.txt" |
|
|
|
url "http://www.apache.org/licenses/LICENSE-2.0.txt" |
|
|
|
distribution "repo" |
|
|
|
distribution "repo" |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
developers { |
|
|
|
developers { |
|
|
|
developer { |
|
|
|
developer { |
|
|
|
id DEVELOPER_ID |
|
|
|
id DEVELOPER_ID |
|
|
|
name DEVELOPER_NAME |
|
|
|
name DEVELOPER_NAME |
|
|
|
email DEVELOPER_EMAIL |
|
|
|
email DEVELOPER_EMAIL |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
"dependencies " { |
|
|
|
|
|
|
|
// dependency { |
|
|
|
|
|
|
|
// groupId "com.alibaba" |
|
|
|
|
|
|
|
// artifactId "fastjson" |
|
|
|
|
|
|
|
// "version " "1.2.6" |
|
|
|
|
|
|
|
// //同dependencies |
|
|
|
|
|
|
|
// } |
|
|
|
|
|
|
|
// } |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
publishing { |
|
|
|
publishing { |
|
|
|
publications { |
|
|
|
publications { |
|
|
|
mavenJava(MavenPublication) { |
|
|
|
mavenJava(MavenPublication) { |
|
|
|
artifactId PROJ_ARTIFACTID |
|
|
|
artifactId PROJ_ARTIFACTID |
|
|
|
artifact javadocJar |
|
|
|
artifact javadocJar |
|
|
|
artifact sourcesJar |
|
|
|
artifact sourcesJar |
|
|
|
|
|
|
|
|
|
|
|
pom { |
|
|
|
pom { |
|
|
|
packaging 'aar' |
|
|
|
packaging 'aar' |
|
|
|
} |
|
|
|
} |
|
|
|
pom.withXml { |
|
|
|
pom.withXml { |
|
|
|
def root = asNode() |
|
|
|
def root = asNode() |
|
|
|
root.appendNode('description', PROJ_DESCRIPTION) |
|
|
|
root.appendNode('description', PROJ_DESCRIPTION) |
|
|
|
root.children().last() + pomConfig |
|
|
|
root.children().last() + pomConfig |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
afterEvaluate { |
|
|
|
afterEvaluate { |
|
|
|
publishing.publications.mavenJava.artifact(bundleRelease) |
|
|
|
publishing.publications.mavenJava.artifact(bundleRelease) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
bintray { |
|
|
|
bintray { |
|
|
|
user = hasProperty("bintrayUser") ? getProperty("bintrayUser") : getProperty("BINTRAY_USER") |
|
|
|
user = hasProperty("bintrayUser") ? getProperty("bintrayUser") : getProperty("BINTRAY_USER") |
|
|
|
key = hasProperty("bintrayKey") ? getProperty("bintrayKey") : getProperty("BINTRAY_KEY") |
|
|
|
key = hasProperty("bintrayKey") ? getProperty("bintrayKey") : getProperty("BINTRAY_KEY") |
|
|
|
|
|
|
|
|
|
|
|
configurations = ['archives'] |
|
|
|
configurations = ['archives'] |
|
|
|
publications = ['mavenJava'] |
|
|
|
publications = ['mavenJava'] |
|
|
|
publish = true |
|
|
|
publish = true |
|
|
|
|
|
|
|
|
|
|
|
pkg { |
|
|
|
pkg { |
|
|
|
repo = 'maven' |
|
|
|
repo = 'maven' |
|
|
|
name = PROJ_NAME |
|
|
|
name = PROJ_NAME |
|
|
|
desc = PROJ_DESCRIPTION |
|
|
|
desc = PROJ_DESCRIPTION |
|
|
|
websiteUrl = PROJ_WEBSITEURL |
|
|
|
websiteUrl = PROJ_WEBSITEURL |
|
|
|
issueTrackerUrl = PROJ_ISSUETRACKERURL |
|
|
|
issueTrackerUrl = PROJ_ISSUETRACKERURL |
|
|
|
vcsUrl = PROJ_VCSURL |
|
|
|
vcsUrl = PROJ_VCSURL |
|
|
|
licenses = ['Apache-2.0'] |
|
|
|
licenses = ['Apache-2.0'] |
|
|
|
publicDownloadNumbers = true |
|
|
|
publicDownloadNumbers = true |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
artifactory { |
|
|
|
artifactory { |
|
|
|
contextUrl = 'http://oss.jfrog.org/artifactory' |
|
|
|
contextUrl = 'http://oss.jfrog.org/artifactory' |
|
|
|
resolve { |
|
|
|
resolve { |
|
|
|
repository { |
|
|
|
repository { |
|
|
|
repoKey = 'libs-release' |
|
|
|
repoKey = 'libs-release' |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
publish { |
|
|
|
|
|
|
|
repository { |
|
|
|
|
|
|
|
repoKey = 'oss-snapshot-local' //The Artifactory repository key to publish to |
|
|
|
|
|
|
|
username = bintray.user |
|
|
|
|
|
|
|
password = bintray.key |
|
|
|
|
|
|
|
maven = true |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
defaults { |
|
|
|
publish { |
|
|
|
publications('mavenJava') |
|
|
|
repository { |
|
|
|
publishArtifacts = true |
|
|
|
repoKey = 'oss-snapshot-local' //The Artifactory repository key to publish to |
|
|
|
|
|
|
|
username = bintray.user |
|
|
|
|
|
|
|
password = bintray.key |
|
|
|
|
|
|
|
maven = true |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
defaults { |
|
|
|
|
|
|
|
publications('mavenJava') |
|
|
|
|
|
|
|
publishArtifacts = true |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
} |