Created
April 15, 2019 04:42
-
-
Save pengrad/1e4aaec817ebb73cae5ae30b8960b79c to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
android.libraryVariants.all { variant -> | |
javadocs.doFirst { | |
classpath += files(android.bootClasspath) | |
if (variant.hasProperty('javaCompileProvider')) { | |
classpath += files(variant.javaCompileProvider.get().classpath.files) | |
} else if (variant.hasProperty('javaCompiler')) { | |
classpath += files(variant.javaCompiler.classpath.files) | |
} | |
// Process AAR dependencies | |
def aarDependencies = classpath.filter { | |
it.name.endsWith('.aar') | |
} | |
classpath -= aarDependencies | |
aarDependencies.each { aar -> | |
// Extract classes.jar from the AAR dependency and add it to the androidJavadocs classpath | |
final String outputPath = "${buildDir}/tmp/aarJar/${aar.name.replace('.aar', '.jar')}" | |
classpath += files(outputPath) | |
// Use a task so the actual extraction only happens before the androidJavadocs task is run | |
dependsOn task(name: "extract${aar.name}").doLast { | |
MavenPushUtils.extractEntry(aar, 'classes.jar', outputPath) | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment