Another 1.4.30 issue I’ve noticed- I’m currently ...
# dokka
b
Another 1.4.30 issue I’ve noticed- I’m currently mapping a module’s project path to a dokka output path, so a module with the project path
:foo:bar
would have its docs output to
/docs/foo/bar
Overall this is still working, but 1.4.30 is now generating an extra
index.md
in
/docs/foo
. It is actually copying the index.md from the last module it generates docs for, so e.g.
/docs/foo/index.md
is identical to
/docs/foo/bar/index.md
My method for setting the output directory is:
Copy code
dokkaGfm {
    def tokenizedPath = project.path.tokenize(":")
    def outputPath = "$rootDir/docs/api/${tokenizedPath.subList(0, tokenizedPath.size() - 1).join("/")}"
    outputDirectory = file(outputPath)
}
Happy to file a bug, but wanted to post here in case there’s just a new configuration option I missed or something
k
Can you try setting the output directory with
set()
?
b
Unfortunately same behavior with
outputDirectory.set(file(outputPath))
The docs are getting generated in the right directories, I’m just getting those extra
index.md
files in the intermediate directories
k
Huh, strange. Could you provide a minimal example and file a bug please?
b
It’s a bit more broad than I had thought after setting up a sample project- looks like the location of a module’s index is just always one directory too high when an outputDirectory is set. https://github.com/Kotlin/dokka/issues/1796
k
That’s actually not a bug, this change in the structure was intentional as we got many requests for that. We’ll probably make a plugin that restores the old structure in the future ☺️
b
What about the case where multiple modules are publishing docs to the same
outputDirectory
? With the current behavior, only one index.md is published from a single module and the index.md of all the other modules is lost
k
For multiple modules there is a
dokkaGfmMultiModule
task which handles this situation correctly
b
I’ll play around with that a bit- we aren’t currently using the multi module task because we are generating some of those bits ourselves. It’s been a while since I’ve checked the multimodule support out though
Thanks for the help!
k
With
1.4.30
we actually released a new multimodule support. It’s based on template files, eg. each module generates a template documentation (without internal links and so on) and then the root task collects those templates and fills in the blanks. The one important thing to note is that the module-level task to configure those templating (eg. add external links, includes and so on) is called
dokkaGfmPartial
(instead of the regular
dokkaGfm
, which still exists of course). If you have some bits generated by yourself, you can try the
dokkaGfmCollector
which should theoretically collect everything and create a multimodule page. I haven’t tested it in a while though
🙏 1