Does anyone have any examples of the versioning pl...
# dokka
k
Does anyone have any examples of the versioning plugin being used with a single module Kotlin multiplatform project? These examples don't cover that. https://github.com/Kotlin/dokka/tree/2.0.0/examples/gradle
Following up on this. Perhaps you know @Oleg Yukhnevich? I'm having a lot of trouble setting up the versioning plugin on a single module KMP project.
o
Hey! I don't have a specific example at my side, but Dokka setup is almost the same as in multimodule example E.g with something like this everything should work fine:
Copy code
plugins {
    kotlin("multiplatform") version "2.1.0"
    id("org.jetbrains.dokka") version "2.0.0"
}

kotlin {
    jvm()
}

dependencies {
    dokkaHtmlPlugin("org.jetbrains.dokka:versioning-plugin")
}

dokka {
    pluginsConfiguration {
        versioning {
            version = "2.0"
            olderVersionsDir = layout.projectDirectory.dir("previousDocVersions")
        }
    }
}
running
dokkaGenerate
will work fine at my side, and when old version will be in
previousDocVersions/1.0
- it also works fine May be you do have some specific issue in mind?
k
That helped a lot, thanks. I have a separate question unfortunately. Do you have any idea how to support generating versioned documentation with a build setup that commits the generated documentation to a separate branch? For example, in alchemist I have two branches: trunk and site. Upon a successful merge to trunk documentation is generated and committed to the site branch. It seems that all of the previous documentation must be present when using the versioning plugin, and you can incrementally add to the
olderVersionsDir
over time. Is that correct?
o
Do you have any idea how to support generating versioned documentation with a build setup that commits the generated documentation to a separate branch?
Hm, I think that during building docs for next version you can on CI: 1. checkout release branch as always 2. checkout
site
branch in some predefined folder (or you can just download zip of that branch via GitHub API) 3. point Dokka
olderVersionsDir
to that folder
It seems that all of the previous documentation must be present when using the versioning plugin, and you can incrementally add to the
olderVersionsDir
over time. Is that correct?
yeah, that's true
k
Hm, I think that during building docs for next version you can on CI:
1. checkout release branch as always
2. checkout
site
branch in some predefined folder (or you can just download zip of that branch via GitHub API)
3. point Dokka
olderVersionsDir
to that folder
Yeah I also came to this conclusion. I’ll give it a try. Thanks again for your help.
Is it naughty to have a documentation directory like the following? Essentially, outputting both the current and older versions to the same directory. • olderVersionsDir ◦ x.y.z — This is the current version ◦ x.y.y ◦ x.y.x ◦ y.y.w
o
it's also possible to directly provide directories per version via olderVersions property, not sure if it helps here though In fact, after you've built documentation with Dokka, it will include all previous versions of documentation inside it (in
older
directory)
k
In fact, after you’ve built documentation with Dokka, it will include all previous versions of documentation inside it (in
older
directory)
Hm, I tried this last night by bumping a local version from
x.y.z-SNAPSHOT
to
x.y.z
and I didn’t see dokka automatically reorganize the documentation. Perhaps I was looking in the wrong place? I think my question still stands though. Will I cause any problems is the current version documentation parent dir and the older versions parent dir are the same?
o
Perhaps I was looking in the wrong place?
probably i've confused you 🙂 I mean, when you use versioning plugin, documentation for old versions (f.e coming from
olderVersionsDir
) will be embedded inside documentation for new version in it's
older
directory
Will I cause any problems is the current version documentation parent dir and the older versions parent dir are the same?
There should be no problems. ktor is also doing the same
👍 1
k
Alright I’ll give it a whirl soon and report back. Thanks for your help.
kodee loving 1