Last active
May 25, 2021 21:10
-
-
Save kibotu/994c9cc65fe623b76b76fedfac74b34b to your computer and use it in GitHub Desktop.
Gradle generate javadoc for Android.
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
// 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 | |
} | |
artifacts { | |
archives sourcesJar | |
archives javadocJar | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Thank you for posting this. It worked perfectly for me after I'd been struggling to write my own without errors