From 1121071276ca2ce0afeabf4d3e540d4d8103f311 Mon Sep 17 00:00:00 2001 From: Simon Ogorodnik Date: Fri, 23 Jun 2017 16:42:23 +0300 Subject: Suppress output of android.R and other generated stuff in dokka-android --- runners/android-gradle-plugin/src/main/kotlin/mainAndroid.kt | 5 +++++ runners/gradle-plugin/src/main/kotlin/main.kt | 9 +++++---- 2 files changed, 10 insertions(+), 4 deletions(-) (limited to 'runners') diff --git a/runners/android-gradle-plugin/src/main/kotlin/mainAndroid.kt b/runners/android-gradle-plugin/src/main/kotlin/mainAndroid.kt index f392f1ab..f2261120 100644 --- a/runners/android-gradle-plugin/src/main/kotlin/mainAndroid.kt +++ b/runners/android-gradle-plugin/src/main/kotlin/mainAndroid.kt @@ -22,6 +22,11 @@ open class DokkaAndroidTask : DokkaTask() { @Input var noAndroidSdkLink: Boolean = false + override fun collectSuppressedFiles(sourceRoots: List): List { + val generatedSubpath = "${project.buildDir}/generated/source".replace("/", File.separator) + return sourceRoots.filter { generatedSubpath in it.path }.flatMap { File(it.path).walk().toList() }.map { it.absolutePath } + } + init { project.afterEvaluate { if (!noAndroidSdkLink) externalDocumentationLinks.add(ANDROID_REFERENCE_URL) diff --git a/runners/gradle-plugin/src/main/kotlin/main.kt b/runners/gradle-plugin/src/main/kotlin/main.kt index fd4053ee..0417b02a 100644 --- a/runners/gradle-plugin/src/main/kotlin/main.kt +++ b/runners/gradle-plugin/src/main/kotlin/main.kt @@ -231,6 +231,8 @@ open class DokkaTask : DefaultTask() { private fun Iterable.toSourceRoots(): List = this.filter { it.exists() }.map { SourceRoot().apply { path = it.path } } + protected open fun collectSuppressedFiles(sourceRoots: List): List = emptyList() + @TaskAction fun generate() { val kotlinColorsEnabledBefore = System.getProperty(COLORS_ENABLED_PROPERTY) ?: "false" @@ -276,7 +278,8 @@ open class DokkaTask : DefaultTask() { perPackageOptions, externalDocumentationLinks, noStdlibLink, - cacheRoot) + cacheRoot, + collectSuppressedFiles(sourceRoots)) bootstrapProxy.configure( @@ -326,11 +329,9 @@ open class DokkaTask : DefaultTask() { } - @SkipWhenEmpty @InputFiles fun getInputFiles(): FileCollection = - project.files(kotlinCompileBasedClasspathAndSourceRoots.sourceRoots.map { project.fileTree(File(it.path)) }) + - project.files(collectSourceRoots().map { project.fileTree(File(it.path)) }) + + project.files(collectSourceRoots().map { project.fileTree(File(it.path)) }) + project.files(includes) + project.files(samples.map { project.fileTree(it) }) -- cgit