|
|
|
@ -1,8 +1,8 @@ |
|
|
|
|
apply plugin: 'com.android.library' |
|
|
|
|
|
|
|
|
|
apply plugin: 'com.github.dcendents.android-maven' |
|
|
|
|
|
|
|
|
|
group='com.github.AriaLyy' |
|
|
|
|
//apply plugin: 'com.github.dcendents.android-maven' |
|
|
|
|
// |
|
|
|
|
//group='com.github.AriaLyy' |
|
|
|
|
|
|
|
|
|
android { |
|
|
|
|
compileSdkVersion 23 |
|
|
|
@ -27,58 +27,59 @@ dependencies { |
|
|
|
|
testCompile 'junit:junit:4.12' |
|
|
|
|
compile 'com.android.support:appcompat-v7:23.1.1' |
|
|
|
|
} |
|
|
|
|
//apply from: 'jcenter.gradle' |
|
|
|
|
|
|
|
|
|
// build a jar with source files |
|
|
|
|
task sourcesJar(type: Jar) { |
|
|
|
|
from android.sourceSets.main.java.srcDirs |
|
|
|
|
classifier = 'sources' |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
task javadoc(type: Javadoc) { |
|
|
|
|
failOnError false |
|
|
|
|
source = android.sourceSets.main.java.sourceFiles |
|
|
|
|
classpath += project.files(android.getBootClasspath().join(File.pathSeparator)) |
|
|
|
|
classpath += configurations.compile |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// build a jar with javadoc |
|
|
|
|
task javadocJar(type: Jar, dependsOn: javadoc) { |
|
|
|
|
classifier = 'javadoc' |
|
|
|
|
from javadoc.destinationDir |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
android.libraryVariants.all { variant -> |
|
|
|
|
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") |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
artifacts { |
|
|
|
|
archives sourcesJar |
|
|
|
|
archives javadocJar |
|
|
|
|
} |
|
|
|
|
//task sourcesJar(type: Jar) { |
|
|
|
|
// from android.sourceSets.main.java.srcDirs |
|
|
|
|
// classifier = 'sources' |
|
|
|
|
//} |
|
|
|
|
// |
|
|
|
|
//task javadoc(type: Javadoc) { |
|
|
|
|
// failOnError false |
|
|
|
|
// source = android.sourceSets.main.java.sourceFiles |
|
|
|
|
// classpath += project.files(android.getBootClasspath().join(File.pathSeparator)) |
|
|
|
|
// classpath += configurations.compile |
|
|
|
|
//} |
|
|
|
|
// |
|
|
|
|
//// build a jar with javadoc |
|
|
|
|
//task javadocJar(type: Jar, dependsOn: javadoc) { |
|
|
|
|
// classifier = 'javadoc' |
|
|
|
|
// from javadoc.destinationDir |
|
|
|
|
//} |
|
|
|
|
// |
|
|
|
|
//android.libraryVariants.all { variant -> |
|
|
|
|
// 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") |
|
|
|
|
// } |
|
|
|
|
// } |
|
|
|
|
//} |
|
|
|
|
// |
|
|
|
|
//artifacts { |
|
|
|
|
// archives sourcesJar |
|
|
|
|
// archives javadocJar |
|
|
|
|
//} |
|
|
|
|
|
|
|
|
|
//apply frome: 'build_source.gradle' |
|
|
|
|
//apply from: 'jcenter.gradle' |