Dokka - skip generating javadoc for default android packages

3.1k views Asked by At

I am trying to use Dokka plugin to generate Javadoc for android Kotlin application. I added the plugin to my gradle:

classpath "org.jetbrains.dokka:dokka-gradle-plugin:0.9.15"

Then I made a basic configuration following project instructions:

dokka {
    outputFormat = 'javadoc'
    outputDirectory = "$rootDir/docs"
    skipEmptyPackages = true
    noStdlibLink = true
}

I generate documentation using basic gradle command:

[user@linux AppDir]$ bash gradlew dokka

Output is fine, but it includes multiple directories from android or plugins I have added to my project, for example:

android.R
android.support
com.google
com.crashlytics
.
.
.
etc.

How do I skip these packages? Is there any way to generate dock only for my /app/scr/java folder, and files I created? Any help is appreciated.

2

There are 2 answers

0
Xavier Rubio Jansana On BEST ANSWER

Dokka version 0.9.16 will include a bugfix to remove generated files from documentation.

In version 0.9.15, the following commit seemed to address that "Suppress output of android.R and other generated stuff in dokka-android", but apparently after creating the suppresedFiles map with the needed information, it was not really used to filter sourceSets.


UPDATE: Dokka 0.9.16 has been released with the fix, among other improvements.

#224 Filtered out Android generated classes from docs

1
Paul Spiesberger On

Here is a working example with Dokka 0.9.16:

task dokka(overwrite: true, type: org.jetbrains.dokka.gradle.DokkaAndroidTask) {
    outputFormat = 'javadoc'
    outputDirectory = "$buildDir/docs"

    // Do not create index pages for empty packages
    skipEmptyPackages = true

    //Do not output deprecated members. Applies globally, can be overridden by packageOptions
    skipDeprecated = false

    //No default documentation link to kotlin-stdlib
    noStdlibLink = false
}

If you use Android then the type is important: org.jetbrains.dokka.gradle.DokkaAndroidTask

Not DokkaTask but DokkaAndroidTask.