Or Cohen
09/06/2020, 9:46 AMbuild.gradle.kts
script in which I apply the Dokka plugin to all libraries -
configure(subprojects.filter { it.parent?.name == "libs" }) {
apply {
plugin("org.jetbrains.dokka")
}
}
I’ve also added the following block that is mentioned in the docs for multi module support -
tasks.dokkaHtmlMultiModule.configure {
outputDirectory.set(buildDir.resolve("dokkaCustomMultiModuleOutput"))
documentationFileName.set("README.md")
}
I also have a README.md
file under each of my libraries under libs
folder, and I added the following to the build.gradle.kts
script of each of the libraries which I want to include in the generated docs -
tasks.withType<org.jetbrains.dokka.gradle.DokkaTask>().configureEach {
dokkaSourceSets.configureEach {
includes.from("README.md")
}
}
After running dokkaHtmlMultiModule
, it seems like I get a folder for each library under build/dokkaCustomMultiModuleOutput/libs
(with all generated docs inside), but I can’t seem to find any top-level index.html
file. In addition, none of the libraries are listed in the top level -modules.html
file.
Am I missing something, or doing something wrong?
Thanks in advance 🙏Joffrey
09/06/2020, 1:02 PMSebastian Sellmair [JB]
09/09/2020, 1:48 PMKamil Doległo
09/09/2020, 1:59 PM./gradlew :dokkaHtmlMultiModule
, you should see the dokkaCustomMultiModuleOutput
directory under the toplevel build
with all documentations collected there. There is no toplevel index.html
but -modules.html
instead (note to self: we should probably rename that at some point) and all your submodules should be listed. Can you provide some MRE for the issue?Kamil Doległo
09/09/2020, 2:06 PMI also have trouble understanding where I should apply the dokka plugin for multi-module projects. Should I apply it to every subproject AND the root project?Yes, exactly. Dokka generates documentation in each subproject separately (hence is must be present in each) and can optionally collect all generated documentations (you have to apply dokka in the root project for that)
Kamil Doległo
09/09/2020, 2:08 PMIt was my understanding that the dokka plugin made use of the kotlin plugin, but I don’t use the Kotlin plugin on the root project (only on subprojects).That’s true, but for collecting the subdocumentation from children the
kotlin-plugin
in the root project shouldn’t be necessary IIRC (not applied at least)Or Cohen
09/09/2020, 2:54 PMdokkaCustomMultiModuleOutput
and the -modules.html
file inside, it just doesn’t seem to contain any of my modules to which I’ve configured the DokkaTask
Or Cohen
09/09/2020, 2:55 PMKamil Doległo
09/09/2020, 2:56 PMKamil Doległo
09/09/2020, 2:57 PMaddChildTask()
however I’d be very interested why it’s not working properlyOr Cohen
09/09/2020, 3:00 PM./gradlew dokkaHtmlMultiModule --dry-run
it seems like the dokkaHtml
tasks of my subproject are already added -
:libs:core:compileKotlin SKIPPED
:libs:core:compileJava SKIPPED
:libs:core:dokkaHtml SKIPPED
:libs:core-test:dokkaHtml SKIPPED
:dokkaHtmlMultiModule SKIPPED
Or Cohen
09/09/2020, 3:01 PMlibs/core
& /libs/core-test
under dokkaCustomMultiModuleOutput
Or Cohen
09/09/2020, 3:01 PM-modules.html
file for some reason.Kamil Doległo
09/09/2020, 3:05 PMdokkaCustomMultiModuleOutput
directory entirely and the run the toplevel task explicitly? (I mean with colon: ./gradlew :dokkaHtmlMultiModule
)Or Cohen
09/09/2020, 3:12 PMKamil Doległo
09/09/2020, 3:17 PMKamil Doległo
09/09/2020, 3:27 PMdocumentationFileName.set("README.md")
?
I have a feeling that it may just overwrite the -modules.html
file. Didn’t think of that before as we changed this in newer versionsOr Cohen
09/09/2020, 3:32 PMincludes.from("README.md")
of each subproject as well?Kamil Doległo
09/09/2020, 3:33 PM-modules
pageOr Cohen
09/09/2020, 5:08 PMKamil Doległo
09/09/2020, 5:24 PMDokkaMultiModuleTask
(runners/gradle-plugin
). I think the configuration there should be correct (as you do get subtasks to run and then their documentation collected). The next point to check would be the MultimodulePageCreator
(plugins/base
) modules present there and the content node tree generated
If everything is ok in those places then I just have no idea what’s going wrongOr Cohen
09/09/2020, 5:26 PMMultimodulePageCreator
first.
Thanks a lot again!Kamil Doległo
09/09/2020, 5:27 PMmaven("<https://maven.pkg.jetbrains.space/kotlin/p/dokka/dev>")
and the latest version would be 1.4.10-dev-69
Joffrey
09/09/2020, 7:41 PMKamil Doległo
09/09/2020, 11:12 PMJoffrey
09/10/2020, 7:12 AMJoffrey
09/10/2020, 7:24 AMOr Cohen
09/10/2020, 8:51 AMfirstParagraph()
method to return null
and that’s why I had no modules listed in my -modules.html
file -Or Cohen
09/10/2020, 8:53 AM-modules.html
and then browse into a specific module, I can only go back by hitting “back” on the browser or by editing the url myselfKamil Doległo
09/10/2020, 9:19 PMKamil Doległo
09/10/2020, 9:23 PMJoffrey
09/10/2020, 9:26 PMjs
one, but now it’s so nice I don’t even need to configure anything, so I’m wondering what’s the minimal config to disable the JS platform.Kamil Doległo
09/10/2020, 9:30 PMsuppress.set(true)
in the dokka source set definition for JS should be enough ☺️Joffrey
09/10/2020, 9:30 PMOr Cohen
09/10/2020, 10:02 PMJoffrey
09/12/2020, 9:52 AMbuild.gradle
at the end of the allProjects
block:
afterEvaluate {
tasks.withType<DokkaTask>().configureEach {
dokkaSourceSets.findByName("jsMain")
?.suppress?.set(true)
dokkaSourceSets.findByName("jsTest")
?.suppress?.set(true)
}
}
Kamil Doległo
09/15/2020, 8:47 AMafterEvaluate
here (I may be wrong though).
Properties should correctly retain the state set in the configuration phaseJoffrey
09/15/2020, 8:51 AMallprojects
block, the rest of the configuration of the source sets etc might not be done at that point in every subproject, I think that’s why I had to do this, to ensure it’s done after the configuration of the subprojects.
Properties should correctly retain the state set in the configuration phaseyes, but if the source set
jsMain
doesn’t exist yet in the dokka task at that point, findByName("jsMain")?.suppress?.set(true)
has no effect