aboutsummaryrefslogtreecommitdiff
path: root/dokka-android-gradle-plugin
diff options
context:
space:
mode:
Diffstat (limited to 'dokka-android-gradle-plugin')
-rw-r--r--dokka-android-gradle-plugin/build.gradle71
-rw-r--r--dokka-android-gradle-plugin/settings.gradle2
-rw-r--r--dokka-android-gradle-plugin/src/main/kotlin/main.kt76
-rw-r--r--dokka-android-gradle-plugin/src/main/resources/META-INF/gradle-plugins/org.jetbrains.dokka-android.properties1
4 files changed, 0 insertions, 150 deletions
diff --git a/dokka-android-gradle-plugin/build.gradle b/dokka-android-gradle-plugin/build.gradle
deleted file mode 100644
index fa5303a0..00000000
--- a/dokka-android-gradle-plugin/build.gradle
+++ /dev/null
@@ -1,71 +0,0 @@
-group 'org.jetbrains.dokka'
-version dokka_version
-
-buildscript {
- dependencies {
- classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
- classpath 'com.jfrog.bintray.gradle:gradle-bintray-plugin:1.4'
- }
-}
-
-apply plugin: 'java'
-apply plugin: 'kotlin'
-apply plugin: 'maven-publish'
-apply plugin: 'com.jfrog.bintray'
-
-sourceCompatibility = 1.6
-
-dependencies {
- testCompile group: 'junit', name: 'junit', version: '4.12'
- compile project(':core')
- compile project(':dokka-gradle-plugin')
-
- compile gradleApi()
- compile localGroovy()
-
- compile 'com.android.tools.build:gradle:2.0.0'
-}
-
-sourceSets {
- main.java.srcDirs += 'src/main/kotlin'
-}
-
-task sourceJar(type: Jar) {
- from sourceSets.main.allSource
-}
-
-task wrapper(type: Wrapper) {
- gradleVersion = '2.5'
- distributionUrl = "https://services.gradle.org/distributions/gradle-$gradleVersion-all.zip"
-}
-
-publishing {
- publications {
- mavenJava(MavenPublication) {
- from components.java
-
- artifact sourceJar {
- classifier "sources"
- }
- }
- }
-}
-
-bintray {
- user = System.getenv('BINTRAY_USER')
- key = System.getenv('BINTRAY_KEY')
-
- pkg {
- repo = dokka_eap.toBoolean() ? 'kotlin-eap' : 'dokka'
- name = 'dokka'
- userOrg = 'kotlin'
- desc = 'Dokka, the Kotlin documentation tool'
- vcsUrl = 'https://github.com/kotlin/dokka.git'
- licenses = ['Apache-2.0']
- version {
- name = dokka_version
- }
- }
-
- publications = ['mavenJava']
-}
diff --git a/dokka-android-gradle-plugin/settings.gradle b/dokka-android-gradle-plugin/settings.gradle
deleted file mode 100644
index 08876dc5..00000000
--- a/dokka-android-gradle-plugin/settings.gradle
+++ /dev/null
@@ -1,2 +0,0 @@
-rootProject.name = 'dokka-android-gradle-plugin'
-
diff --git a/dokka-android-gradle-plugin/src/main/kotlin/main.kt b/dokka-android-gradle-plugin/src/main/kotlin/main.kt
deleted file mode 100644
index 054ed358..00000000
--- a/dokka-android-gradle-plugin/src/main/kotlin/main.kt
+++ /dev/null
@@ -1,76 +0,0 @@
-package org.jetbrains.dokka.gradle
-
-import com.android.build.gradle.AppExtension
-import com.android.build.gradle.LibraryExtension
-import com.android.build.gradle.api.BaseVariant
-import org.gradle.api.Plugin
-import org.gradle.api.Project
-import org.gradle.api.tasks.SourceSet
-import java.io.File
-
-open class DokkaAndroidPlugin : Plugin<Project> {
- val allVariantsClassPath = mutableSetOf<File>()
-
- override fun apply(project: Project) {
- project.tasks.create("dokka", DokkaAndroidTask::class.java).apply {
- moduleName = project.name
- outputDirectory = File(project.buildDir, "dokka").absolutePath
- }
-
- if (project.hasAndroidPlugin()) {
- project.afterEvaluate {
- collectClasspath(project)
- }
- }
- else {
- project.plugins.whenPluginAdded {
- if (project.hasAndroidPlugin()) {
- collectClasspath(project)
- }
- }
- }
- }
-
- private fun collectClasspath(project: Project) {
- val variants = project.collectAllVariants()
- variants.flatMapTo(allVariantsClassPath) { it.javaCompiler.classpath.files }
- }
-}
-
-open class DokkaAndroidTask : DokkaTask() {
- override val sdkProvider: SdkProvider? = AndroidSdkProvider(project)
-}
-
-private fun Project.hasAndroidPlugin() = plugins.hasPlugin("com.android.library") || plugins.hasPlugin("com.android.application")
-
-private fun Project.findDokkaAndroidPlugin() = plugins.findPlugin(DokkaAndroidPlugin::class.java)
-
-private fun Project.collectAllVariants(): Collection<BaseVariant> {
- extensions.findByType(LibraryExtension::class.java)?.let {
- return it.libraryVariants
- }
- extensions.findByType(AppExtension::class.java)?.let {
- return it.applicationVariants
- }
- return emptyList()
-}
-
-private class AndroidSdkProvider(private val project: Project) : SdkProvider {
- 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.hasAndroidPlugin()
-
- override val classpath: List<File>
- get() = ext.bootClasspath + (project.findDokkaAndroidPlugin()?.allVariantsClassPath ?: emptyList<File>())
-
- override val sourceDirs: Set<File>?
- get() {
- val sourceSet = ext?.sourceSets?.findByName(SourceSet.MAIN_SOURCE_SET_NAME)
- return sourceSet?.java?.srcDirs
- }
-}
diff --git a/dokka-android-gradle-plugin/src/main/resources/META-INF/gradle-plugins/org.jetbrains.dokka-android.properties b/dokka-android-gradle-plugin/src/main/resources/META-INF/gradle-plugins/org.jetbrains.dokka-android.properties
deleted file mode 100644
index 03b28d93..00000000
--- a/dokka-android-gradle-plugin/src/main/resources/META-INF/gradle-plugins/org.jetbrains.dokka-android.properties
+++ /dev/null
@@ -1 +0,0 @@
-implementation-class=org.jetbrains.dokka.gradle.DokkaAndroidPlugin \ No newline at end of file