andylamax
04/16/2023, 12:28 AMsimon.vergauwen
04/16/2023, 6:30 AMandylamax
04/16/2023, 9:50 AMsimon.vergauwen
04/16/2023, 10:00 AMandylamax
04/16/2023, 11:20 AMhfhbd
04/17/2023, 5:08 AMandylamax
04/17/2023, 9:44 AMdokkaHtmlMultiModule
still just produced the same version 😔.
It is likely I am missing something, But I can't seem to know what exactlyIgnat Beresnev
04/17/2023, 12:23 PMYou still need to save the old docs somewhere. Otherwise it is impossible to get the old docs (except checking out old tags, build it, and store the docs).Yeah, unfortunately - that's one of the limitation of the current implementation of the versioning plugin There's an issue that describes the flaws of this approach in more detail, and suggests a solution: https://github.com/Kotlin/dokka/issues/2785 Consider upvoting it and/or leaving a comment if you have anything to add 🙂
Adrian Landborn
04/17/2023, 2:25 PMandylamax
04/17/2023, 2:26 PMAdrian Landborn
04/17/2023, 2:31 PMval dokkaVersion: String by rootProject.extra
pluginManager.withPlugin("org.jetbrains.dokka") {
afterEvaluate {
this.tasks.withType(DokkaMultiModuleTask::class) {
pluginConfiguration<DokkaBase, DokkaBaseConfiguration> {
customAssets = listOf(file("documentation/logo-icon.svg"))
footerMessage = "© xxx 1999-2023"
}
outputDirectory.set(file("documentation/html"))
includes.from("documentation/packages.md")
pluginConfiguration<org.jetbrains.dokka.versioning.VersioningPlugin, org.jetbrains.dokka.versioning.VersioningConfiguration> {
version = "1.7.1"
versionsOrdering = listOf("1.7.1","1.7.0")
olderVersionsDir = file("documentation/version")
olderVersions = listOf(file("documentation/version/1.7.0"))
renderVersionsNavigationOnAllPages = true
}
}
dependencies {
"dokkaHtmlPlugin"("org.jetbrains.dokka:android-documentation-plugin:$dokkaVersion")
}
}
}
tasks.dokkaHtmlPartial.configure {
moduleName.set("Module A")
dokkaSourceSets {
configureEach {
jdkVersion.set(8)
includes.from("$projectDir/README.md")
samples.from(rootProject.file("example/components/component1/src/main/java/"))
reportUndocumented.set(true)
skipEmptyPackages.set(true)
}
}
}
Ignat Beresnev
04/17/2023, 3:40 PMdependencies {
dokkaHtmlPlugin("org.jetbrains.dokka:versioning-plugin:1.8.10")
}
Adrian Landborn
04/17/2023, 4:20 PMdependencies {
classpath("org.jetbrains.dokka:dokka-gradle-plugin:$dokkaVersion")
classpath("org.jetbrains.dokka:dokka-base:$dokkaVersion")
classpath("org.jetbrains.dokka:versioning-plugin:$dokkaVersion")
// etc.
}
Modules:
plugins {
id("com.android.library")
id("kotlin-android")
id("org.jetbrains.dokka")
}
Is there anything missing? (We’ve been using docka without versioning the last year)Ignat Beresnev
04/17/2023, 4:29 PMdokkaHtmlPlugin(..)
or dokkaPlugin(..)
specifically, I believe. Not classpath(..)
Adrian Landborn
04/17/2023, 4:31 PMIgnat Beresnev
04/17/2023, 4:32 PMbuildscript {}
for the configuration classes to be available, but you also need to add it as dokkaHtmlPlugin(...)
in the average dependencies {}
block of your project.Adrian Landborn
04/17/2023, 4:34 PMdependencies {
implementation(project(":xxx:foundation"))
implementation("com.google.android.material:material:$materialVersion")
// Compose
val composeBom = platform("androidx.compose:compose-bom:$composeBom")
implementation(composeBom)
implementation("androidx.compose.material:material")
// Compose Preview
implementation("androidx.compose.ui:ui-tooling-preview")
debugImplementation("androidx.compose.ui:ui-tooling")
}
tasks.dokkaHtmlPartial.configure {
moduleName.set("Design")
dokkaSourceSets {
configureEach {
jdkVersion.set(8)
includes.from("$projectDir/README.md")
samples.from(rootProject.file("xxx/design/src/main/java/"))
reportUndocumented.set(true)
skipEmptyPackages.set(true)
}
}
}
pluginManager.withPlugin("org.jetbrains.dokka") {
afterEvaluate {
this.tasks.withType(DokkaMultiModuleTask::class) {
pluginConfiguration<DokkaBase, DokkaBaseConfiguration> {
customAssets = listOf(file("documentation/logo-icon.svg"))
footerMessage = "xxx 1999-2023"
}
outputDirectory.set(file("documentation/html"))
includes.from("documentation/packages.md")
pluginConfiguration<org.jetbrains.dokka.versioning.VersioningPlugin, org.jetbrains.dokka.versioning.VersioningConfiguration> {
version = "1.7.1"
versionsOrdering = listOf("1.7.1","1.7.0")
olderVersionsDir = file("documentation/version")
olderVersions = listOf(file("documentation/version/1.7.0"))
renderVersionsNavigationOnAllPages = true
}
}
dependencies {
"dokkaHtmlPlugin"("org.jetbrains.dokka:android-documentation-plugin:$dokkaVersion")
// HERE?
}
}
}
Ignat Beresnev
04/17/2023, 4:37 PMbuild.gradle.kts
subprojects {
apply {
plugin("org.jetbrains.dokka")
}
dependencies {
dokkaHtmlPlugin("org.jetbrains.dokka:versioning-plugin:$dokkaVersion")
}
}
or you can move the dokkaHtmlPlugin
part to the actual submodules, but it needs to be applied in all of them
and then in subprojects:
buildscript {
dependencies {
classpath("org.jetbrains.dokka:versioning-plugin:1.8.10")
}
}
tasks.dokkaHtmlMultiModule {
pluginConfiguration<VersioningPlugin, VersioningConfiguration> {
version = currentVersion
olderVersionsDir = file(previousVersionsDirectory)
}
}
Or do you mean here?It's difficult to say without seeing the whole project, but if that block is applied for every subproject - yes You should look at the example project for the versioning plugin: https://github.com/Kotlin/dokka/tree/master/examples/gradle/dokka-versioning-multimodule-example
Adrian Landborn
04/17/2023, 4:59 PMIgnat Beresnev
04/17/2023, 5:11 PMAdrian Landborn
04/17/2023, 5:11 PMallprojects
and not subprojects
// Project level (build.gradle.kts)
// ... some code ...
apply(plugin = "org.jetbrains.dokka")
allprojects {
// ... some code ...
val dokkaVersion: String by rootProject.extra
val currentVersion = evaluateVersionName()
pluginManager.withPlugin("org.jetbrains.dokka") {
afterEvaluate {
val dokkaPlugin by configurations
dependencies {
dokkaPlugin("org.jetbrains.dokka:android-documentation-plugin:$dokkaVersion")
dokkaPlugin("org.jetbrains.dokka:versioning-plugin:$dokkaVersion")
}
this.tasks.withType(DokkaMultiModuleTask::class) {
pluginConfiguration<org.jetbrains.dokka.versioning.VersioningPlugin, org.jetbrains.dokka.versioning.VersioningConfiguration> {
version = currentVersion
olderVersionsDir = file("documentation/oldVersions")
renderVersionsNavigationOnAllPages = true
}
pluginConfiguration<DokkaBase, DokkaBaseConfiguration> {
customAssets = listOf(file("documentation/logo-icon.svg"))
}
outputDirectory.set(file("documentation/html"))
includes.from("documentation/packages.md")
}
}
}
}
andylamax
04/21/2023, 2:40 PMrenderVersionsNavigationOnAllPages = true
Will try it out in the near future and report back hereIgnat Beresnev
04/26/2023, 2:02 PMrenderVersionsNavigationOnAllPages
is set to true
by default, so there should be no need to set it yourself
I'm glad it worked!