aboutsummaryrefslogtreecommitdiff
path: root/dokka-android-gradle-plugin
diff options
context:
space:
mode:
authorDmitry Jemerov <yole@jetbrains.com>2016-04-29 22:05:12 +0200
committerDmitry Jemerov <yole@jetbrains.com>2016-04-29 22:05:12 +0200
commitc4a759b64f08086ca9e6eec7b2995081fe1cce30 (patch)
tree6a83a5d70d5ef43624d8635069273a8894739536 /dokka-android-gradle-plugin
parent3ce272588136267971f30160b274402e6f04b4f4 (diff)
downloaddokka-c4a759b64f08086ca9e6eec7b2995081fe1cce30.tar.gz
dokka-c4a759b64f08086ca9e6eec7b2995081fe1cce30.tar.bz2
dokka-c4a759b64f08086ca9e6eec7b2995081fe1cce30.zip
dokka-android plugin: support Android application as well as library projects
Diffstat (limited to 'dokka-android-gradle-plugin')
-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
}
}