Dokka: Documentation for specific package

Created on 19 Jun 2018  路  5Comments  路  Source: Kotlin/dokka

Hello there!
Can dokka make documentation for specific directory (package) from my android app? For example ru.example.api.
SourceDirs and sourceRoot not working.

dokka {
    outputFormat = 'html'
    outputDirectory = "$buildDir/javadoc"
    // Use to include or exclude non public members.
    includeNonPublic = false
    noStdlibLink = true
    // Do not output deprecated members. Applies globally, can be overridden by packageOptions
    skipDeprecated = false
    // Emit warnings about not documented members. Applies globally, also can be overridden by packageOptions
    reportUndocumented = true
    skipEmptyPackages = true // Do not create index pages for empty packages
    // By default, sourceRoots is taken from kotlinTasks, following roots will be appended to it
    // Short form sourceRoots
    sourceDirs = files('src/main/java/ru/example/api')
    sourceRoot {
        // Path to source root
        path = "src/main/java/ru/example/api"
        // See platforms section of documentation
        platforms = ["JVM"]
    }
    packageOptions {
        prefix = "api" // will match kotlin and all sub-packages of it
        // All options are optional, default values are below:
        skipDeprecated = false
        reportUndocumented = true // Emit warnings about not documented members
        includeNonPublic = false
    }
}
classpath "org.jetbrains.dokka:dokka-android-gradle-plugin:0.9.17"
apply plugin: "org.jetbrains.dokka-android"
question

Most helpful comment

You can register packageOptions with suppress = true to exclude all unwanted packages, or use prefix that common for all packages, for example:

a.b.c.d 
a.b.c.y // include only that 
a.b.c.w
packageOptions {
   prefix = "a.b.c"
   suppress = true
}
packageOptions {
   prefix = "a.b.c.y"
   suppress = false 
   //other options
}

All 5 comments

Do you want to create documentation for the whole app, but include only ru.example.api into it?
What do you mean by sourceDirs doesn't working?

The project consists of api and business parts. This is sdk. They are located in different packages
I want to create documentation only for part of api. Can i do it?

You can register packageOptions with suppress = true to exclude all unwanted packages, or use prefix that common for all packages, for example:

a.b.c.d 
a.b.c.y // include only that 
a.b.c.w
packageOptions {
   prefix = "a.b.c"
   suppress = true
}
packageOptions {
   prefix = "a.b.c.y"
   suppress = false 
   //other options
}

If you want to ignore some of the declarations, not packages, put @suppress into its KDoc

@semoro Thank you very much!

Was this page helpful?
0 / 5 - 0 ratings

Related issues

xit0c picture xit0c  路  4Comments

balanegrero picture balanegrero  路  5Comments

joserobjr picture joserobjr  路  4Comments

Groostav picture Groostav  路  6Comments

jnizet picture jnizet  路  5Comments