简体   繁体   中英

How to modify build.gradle.kts sourceSets for Dokka task?

I am using the Dokka plugin in build.gradle.kts . I am able to generate the Dokka HTML for my source code but have been unable to figure out how to configure the task to include package.md files that document packages. (I am not using modules.)

I tried this:

tasks.withType<org.jetbrains.dokka.gradle.DokkaTask>().configureEach {
    dokkaSourceSets {
        named("main") {
            includes.from("package.md")
        }
    }
}

I received an error because there was no package.md file in the root directory.

I also tried this line, but the wildcards were not expanded:

includes.from("src/**/package.md")

How do I instruct Gradle to include all files named package.md , regardless of their directory, the way it includes all Kotlin source code, regardless of directory?

This differs from How to configure Dokka for package documentation using Gradle? , which uses Groovy.

I received an answer on the Kotlin Slack:

tasks.withType<org.jetbrains.dokka.gradle.DokkaTask>().configureEach {
    dokkaSourceSets {
        named("main") {
            includes.from(fileTree(project.rootDir) {
                include("src/**/package.md")
            })
        }
    }
}

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