简体   繁体   中英

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.

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

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 .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM