diff options
author | Kamil Doległo <kamilok1965@interia.pl> | 2019-08-22 16:04:19 +0200 |
---|---|---|
committer | Kamil Doległo <kamilok1965@interia.pl> | 2019-08-22 16:04:19 +0200 |
commit | 1c4a3c6b21846271bcdba3818ba323d1b0bb096f (patch) | |
tree | fa3a5e40d879bd1dbb284c69cee1b418f5044021 /runners/android-gradle-plugin | |
parent | e224c709692adf450786e16e245b4574a480cdab (diff) | |
download | dokka-1c4a3c6b21846271bcdba3818ba323d1b0bb096f.tar.gz dokka-1c4a3c6b21846271bcdba3818ba323d1b0bb096f.tar.bz2 dokka-1c4a3c6b21846271bcdba3818ba323d1b0bb096f.zip |
Merge Android plugin into Gradle plugin
Diffstat (limited to 'runners/android-gradle-plugin')
4 files changed, 0 insertions, 177 deletions
diff --git a/runners/android-gradle-plugin/build.gradle b/runners/android-gradle-plugin/build.gradle deleted file mode 100644 index 99e3abc6..00000000 --- a/runners/android-gradle-plugin/build.gradle +++ /dev/null @@ -1,105 +0,0 @@ -import com.gradle.publish.DependenciesBuilder -import org.jetbrains.CorrectShadowPublishing - -apply plugin: 'java' -apply plugin: 'kotlin' - - -apply plugin: 'com.github.johnrengelman.shadow' -apply plugin: "com.gradle.plugin-publish" - -sourceCompatibility = 1.8 - -tasks.withType(org.jetbrains.kotlin.gradle.tasks.KotlinCompile).all { - kotlinOptions { - freeCompilerArgs += "-Xjsr305=strict" - languageVersion = language_version - apiVersion = language_version - jvmTarget = "1.8" - } -} - -repositories { - jcenter() - google() -} - -dependencies { - testCompile group: 'junit', name: 'junit', version: '4.12' - - shadow project(path: ':runners:gradle-plugin', configuration: 'shadow') - compileOnly project(':integration') - - compileOnly gradleApi() - compileOnly localGroovy() - compileOnly("com.android.tools.build:gradle:3.0.0") - compileOnly("com.android.tools.build:gradle-core:3.0.0") - compileOnly("com.android.tools.build:builder-model:3.0.0") -} - -task sourceJar(type: Jar) { - from sourceSets.main.allSource -} - -processResources { - eachFile { - if (it.name == "org.jetbrains.dokka-android.properties") { - it.filter { line -> - line.replace("<version>", dokka_version) - } - } - } -} - -shadowJar { - baseName = 'dokka-android-gradle-plugin' - classifier = '' -} - -apply plugin: 'maven-publish' - -publishing { - publications { - dokkaAndroidGradlePlugin(MavenPublication) { MavenPublication publication -> - artifactId = 'dokka-android-gradle-plugin' - - artifact sourceJar { - classifier "sources" - } - - CorrectShadowPublishing.configure(publication, project) - } - } -} - -bintrayPublication(project, ['dokkaAndroidGradlePlugin']) - -configurations.archives.artifacts.clear() -artifacts { - archives shadowJar -} - -pluginBundle { - website = 'https://www.kotlinlang.org/' - vcsUrl = 'https://github.com/kotlin/dokka.git' - description = 'Dokka, the Kotlin documentation tool' - tags = ['dokka', 'kotlin', 'kdoc', 'android'] - - plugins { - dokkaAndroidGradlePlugin { - id = 'org.jetbrains.dokka-android' - displayName = 'Dokka Android plugin' - } - } - - withDependencies { List<Dependency> list -> - list.clear() - def builder = new DependenciesBuilder() - builder.addUniqueScopedDependencies(list, configurations.shadow, "compile") - } - - mavenCoordinates { - groupId = "org.jetbrains.dokka" - artifactId = "dokka-android-gradle-plugin" - } -}
\ No newline at end of file diff --git a/runners/android-gradle-plugin/src/main/kotlin/AndroidConfigurationExtractor.kt b/runners/android-gradle-plugin/src/main/kotlin/AndroidConfigurationExtractor.kt deleted file mode 100644 index 8a2a2dff..00000000 --- a/runners/android-gradle-plugin/src/main/kotlin/AndroidConfigurationExtractor.kt +++ /dev/null @@ -1,32 +0,0 @@ -package org.jetbrains.dokka.gradle - -import com.android.build.gradle.* -import com.android.build.gradle.api.BaseVariant -import com.android.builder.core.BuilderConstants -import org.gradle.api.Project - -class AndroidConfigurationExtractor(private val project: Project): AbstractConfigurationExtractor(project) { - override fun getMainCompilationName(): String = getVariants(project).filter { it.name == BuilderConstants.RELEASE }.map { it.name }.first() - - private fun getVariants(project: Project): Set<BaseVariant> { - val androidExtension = project.extensions.getByName("android") - return when (androidExtension) { - is AppExtension -> androidExtension.applicationVariants.toSet() - is LibraryExtension -> { - androidExtension.libraryVariants.toSet() + - if (androidExtension is FeatureExtension) { - androidExtension.featureVariants.toSet() - } else { - emptySet<BaseVariant>() - } - } - is TestExtension -> androidExtension.applicationVariants.toSet() - else -> emptySet() - } + - if (androidExtension is TestedExtension) { - androidExtension.testVariants.toSet() + androidExtension.unitTestVariants.toSet() - } else { - emptySet<BaseVariant>() - } - } -}
\ No newline at end of file diff --git a/runners/android-gradle-plugin/src/main/kotlin/mainAndroid.kt b/runners/android-gradle-plugin/src/main/kotlin/mainAndroid.kt deleted file mode 100644 index 8e293ed6..00000000 --- a/runners/android-gradle-plugin/src/main/kotlin/mainAndroid.kt +++ /dev/null @@ -1,38 +0,0 @@ -package org.jetbrains.dokka.gradle - -import org.gradle.api.Project -import org.gradle.api.tasks.Input -import org.jetbrains.dokka.DokkaConfiguration.ExternalDocumentationLink.Builder -import org.jetbrains.dokka.DokkaConfiguration.SourceRoot -import java.io.File - -open class DokkaAndroidPlugin : DokkaPlugin() { - - override fun apply(project: Project) { - loadDokkaVersion() - val dokkaRuntimeConfiguration = addConfiguration(project) - addTasks(project, dokkaRuntimeConfiguration, DokkaAndroidTask::class.java) - } -} - -private val ANDROID_REFERENCE_URL = Builder("https://developer.android.com/reference/").build() - -open class DokkaAndroidTask : DokkaTask() { - @Input var noAndroidSdkLink: Boolean = false - override val configurationExtractor = AndroidConfigurationExtractor(project) - - override fun collectSuppressedFiles(sourceRoots: List<SourceRoot>): List<String> { - val generatedRoot = project.buildDir.resolve("generated").absoluteFile - return sourceRoots - .map { File(it.path) } - .filter { it.startsWith(generatedRoot) } - .flatMap { it.walk().toList() } - .map { it.absolutePath } - } - - init { - project.afterEvaluate { - if (!noAndroidSdkLink) externalDocumentationLinks.add(ANDROID_REFERENCE_URL) - } - } -}
\ No newline at end of file diff --git a/runners/android-gradle-plugin/src/main/resources/META-INF/gradle-plugins/org.jetbrains.dokka-android.properties b/runners/android-gradle-plugin/src/main/resources/META-INF/gradle-plugins/org.jetbrains.dokka-android.properties deleted file mode 100644 index b204da7b..00000000 --- a/runners/android-gradle-plugin/src/main/resources/META-INF/gradle-plugins/org.jetbrains.dokka-android.properties +++ /dev/null @@ -1,2 +0,0 @@ -implementation-class=org.jetbrains.dokka.gradle.DokkaAndroidPlugin -dokka-version=<version>
\ No newline at end of file |