aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--dokka-android-gradle-plugin/src/main/kotlin/main.kt9
1 files changed, 6 insertions, 3 deletions
diff --git a/dokka-android-gradle-plugin/src/main/kotlin/main.kt b/dokka-android-gradle-plugin/src/main/kotlin/main.kt
index 9a92e2a2..29e0b371 100644
--- a/dokka-android-gradle-plugin/src/main/kotlin/main.kt
+++ b/dokka-android-gradle-plugin/src/main/kotlin/main.kt
@@ -1,5 +1,6 @@
package org.jetbrains.dokka.gradle
+import com.android.build.gradle.AppExtension
import com.android.build.gradle.LibraryExtension
import org.gradle.api.Plugin
import org.gradle.api.Project
@@ -20,19 +21,21 @@ open class DokkaAndroidTask : DokkaTask() {
}
private class AndroidSdkProvider(private val project: Project) : SdkProvider {
- private val ext by lazy { project.extensions.getByType(LibraryExtension::class.java) }
+ private val ext by lazy {
+ project.extensions.findByType(LibraryExtension::class.java) ?: project.extensions.findByType(AppExtension::class.java)
+ }
override val name: String = "android"
override val isValid: Boolean
- get() = project.plugins.hasPlugin("com.android.library")
+ get() = project.plugins.hasPlugin("com.android.library") || project.plugins.hasPlugin("com.android.application")
override val classpath: List<File>
get() = ext.bootClasspath
override val sourceDirs: Set<File>?
get() {
- val sourceSet = ext.sourceSets.findByName(SourceSet.MAIN_SOURCE_SET_NAME)
+ val sourceSet = ext?.sourceSets?.findByName(SourceSet.MAIN_SOURCE_SET_NAME)
return sourceSet?.java?.srcDirs
}
}