Skip to content

bld Extension to Generate API Documentation with Dokka for Kotlin

License

Notifications You must be signed in to change notification settings

rife2/bld-dokka

Folders and files

NameName
Last commit message
Last commit date

Latest commit

11a00fd · Mar 24, 2025

History

45 Commits
Mar 24, 2025
Feb 25, 2025
Feb 25, 2025
Oct 27, 2024
Mar 24, 2025
Mar 18, 2025
Jun 15, 2024
Mar 24, 2025
Jun 15, 2024
Jun 15, 2024
Mar 18, 2025
Jun 15, 2024
Jun 15, 2024

Repository files navigation

bld Extension to Generate API Documentation with Dokka for Kotlin

License Java bld Release Snapshot GitHub CI

To install the latest version, add the following to the lib/bld/bld-wrapper.properties file:

bld.extension-dokka=com.uwyn.rife2:bld-dokka

For more information, please refer to the extensions documentation.

Generate API Documentation

To generate a project's documentation in various formats:

@BuildCommand(value = "dokka-gfm", summary = "Generates documentation in GitHub flavored markdown format")
public void dokkaGfm() throws ExitStatusException, IOException, InterruptedException {
    new DokkaOperation()
            .fromProject(this)
            .loggingLevel(LoggingLevel.INFO)
            // Create build/dokka/gfm 
            .outputDir(Path.of(buildDirectory().getAbsolutePath(), "dokka", "gfm").toFile())
            .outputFormat(OutputFormat.MARKDOWN)
            .execute();
}

@BuildCommand(value = "dokka-html", summary = "Generates documentation in HTML format")
public void dokkaHtml() throws ExitStatusException, IOException, InterruptedException {
    new DokkaOperation()
            .fromProject(this)
            .loggingLevel(LoggingLevel.INFO)
            // Create build/dokka/html
            .outputDir(Path.of(buildDirectory().getAbsolutePath(), "dokka", "html").toFile())
            .outputFormat(OutputFormat.HTML)
            .execute();
}

@BuildCommand(value = "dokka-jekyll", summary = "Generates documentation in Jekyll flavored markdown format")
public void dokkaJekyll() throws ExitStatusException, IOException, InterruptedException {
    new DokkaOperation()
            .fromProject(this)
            .loggingLevel(LoggingLevel.INFO)
            // Create build/dokka/jekyll
            .outputDir(Path.of(buildDirectory().getAbsolutePath(), "dokka", "jekkyl").toFile())
            .outputFormat(OutputFormat.JEKYLL)
            .execute();
}

@BuildCommand(summary = "Generates Javadoc for the project")
@Override
public void javadoc() throws ExitStatusException, IOException, InterruptedException {
    new DokkaOperation()
            .fromProject(this)
            .failOnWarning(true)
            .loggingLevel(LoggingLevel.INFO)
            // Create build/javadoc
            .outputDir(new File(buildDirectory(), "javadoc"))
            .outputFormat(OutputFormat.JAVADOC)
            .execute();
}
./bld javadoc
./bld dokka-html
./bld dokka-gfm
./bld dokka-jekyll

Please check the Dokka Operation documentation for all available configuration options.

Template Project

There is also a Kotlin Template Project with support for Dokka and the Detekt extensions.