Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Dokka - skip generating javadoc for default android packages

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.

like image 365
ikurek Avatar asked Sep 07 '17 14:09

ikurek


2 Answers

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

like image 68
Xavier Rubio Jansana Avatar answered Oct 14 '22 07:10

Xavier Rubio Jansana


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.

like image 36
Paul Spiesberger Avatar answered Oct 14 '22 07:10

Paul Spiesberger