Kotlin / dokka

API documentation engine for Kotlin
https://kotl.in/dokka
Apache License 2.0
3.36k stars 397 forks source link

Multimodule github page with dokkaGfmMultiModule/dokkaGfmCollector #1469

Open motorro opened 3 years ago

motorro commented 3 years ago

Question I can't figure out how to build github pages folder for my multi-module project with 1.4 dokkaGfmMultiModule/dokkaGfmCollector tasks. I used to gather dokka outputs with a recipe from here and had the build folder with:

I've tried to build the same with Dokka 1.4 and failed with both tasks

dokkaGfmCollector Almost does the job the way it used to be:

But:

image

dokkaGfmMultiModule

image

Installation

Additional context Some top-level build.gradle abstract. Full project with integration attempt available here:

ext {
    // Dokka
    docDir = "${projectDir}/docs"
}

allprojects {
    tasks.withType(org.jetbrains.dokka.gradle.DokkaTask).configureEach {
        outputDirectory.set(new File("$buildDir/javadoc"))
        dokkaSourceSets {
            named("main") {
                noAndroidSdkLink.set(false)
                includes.from ("${projectDir}/module.md")
                externalDocumentationLink {
                    url.set(new URL ("http://reactivex.io/RxJava/2.x/javadoc/"))
                    packageListUrl.set(new URL ("http://reactivex.io/RxJava/2.x/javadoc/package-list"))
                }
            }
        }
    }
}

dokkaGfmCollector.configure {
    outputDirectory = new File(docDir)
}
dokkaGfmMultiModule.configure {
    outputDirectory = new File(docDir)
    documentationFileName.set("module.md")
}
dokkaHtmlMultiModule.configure {
    outputDirectory = new File(docDir)
    documentationFileName.set("module.md")
}
SBNTT commented 3 years ago

Maybe https://github.com/SBNTT/mpp-game-docs can helps

cromefire commented 3 years ago

I've also come across this with the html documentation and I can't even find a documentationFileName option (version 1.4.20). I can rename the the -modules.html to index.html (not a big deal) but that still doesn't allow any link back to the root of the documentation once you are inside a module. The collector works fine, but discards any reference to the modules of course (which I'd like to preserve).

rvp-diconium commented 1 year ago

+1 for this issue. projects are everyday bigger and more multi-module.

I've developed a very similar script (below), but the contents from dokka.md are only applied to individual modules. I tried to an API similar to the includes.from(" for the dokkaJekyllCollector task but there isn't any.

Any workaround or solution here?

fun Project.applyDokka() {

    apply(plugin = PluginIds.Dokka)

    tasks.named<org.jetbrains.dokka.gradle.DokkaTask>("dokkaJekyll") {
        outputDirectory.set(File(buildDir, "documentation"))
        moduleName.set(this.project.name)
        suppressObviousFunctions.set(true)
        dokkaSourceSets {
            configureEach {
                includes.from("${rootProject.rootDir}/dokka.md")
                perPackageOption {
                    matchingRegex.set(""".*\.internal.*""")
                    suppress.set(true)
                }
                noAndroidSdkLink.set(false)
            }
        }
    }
}