Skip to content

Commit

Permalink
Fix javadoc task error for Android library
Browse files Browse the repository at this point in the history
  • Loading branch information
johnsonlee committed Oct 7, 2021
1 parent f4c4552 commit 66f072a
Showing 1 changed file with 19 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -23,18 +23,25 @@ class AndroidLibraryPublishPlugin : AbstractLibraryPublishPlugin() {

publications.run {
android.libraryVariants.forEach { variant ->
val javadoc = tasks.register("javadocFor${variant.name.capitalize()}", Javadoc::class.java) {
dependsOn("dokkaHtml")
source(android.sourceSets["main"].java.srcDirs)
classpath += files(android.bootClasspath)
classpath += variant.javaCompileProvider.get().classpath
exclude("**/R.html", "**/R.*.html", "**/index.html")
}

val javadocJar = tasks.register("packageJavadocFor${variant.name.capitalize()}", Jar::class.java) {
dependsOn(javadoc)
archiveClassifier.set("javadoc")
from(tasks["dokkaHtml"])
val javadocJar = if (extensions.findByName("kotlin") != null) {
tasks.register("packageJavadocFor${variant.name.capitalize()}", Jar::class.java) {
dependsOn("dokkaHtml")
archiveClassifier.set("javadoc")
from(tasks["dokkaHtml"])
}
} else {
val javadoc = tasks.register("javadocFor${variant.name.capitalize()}", Javadoc::class.java) {
source(android.sourceSets["main"].java.srcDirs)
classpath += files(android.bootClasspath)
classpath += variant.javaCompileProvider.get().classpath
exclude("**/R.html", "**/R.*.html", "**/index.html")
}

tasks.register("packageJavadocFor${variant.name.capitalize()}", Jar::class.java) {
dependsOn(javadoc)
archiveClassifier.set("javadoc")
from(tasks["dokkaHtml"])
}
}

val sourcesJar = tasks.register("packageSourcesFor${variant.name.capitalize()}", Jar::class.java) {
Expand Down

0 comments on commit 66f072a

Please sign in to comment.