refactor(build): centralize Dokka documentation generation (#4171)

Signed-off-by: James Rich <2199651+jamesarich@users.noreply.github.com>
This commit is contained in:
James Rich
2026-01-08 17:55:07 -06:00
committed by GitHub
parent 7744a42e1c
commit 02f99bd7bb
4 changed files with 89 additions and 44 deletions

View File

@@ -43,12 +43,12 @@ jobs:
uses: gradle/actions/setup-gradle@v5
- name: Build Dokka HTML documentation
run: ./gradlew :app:dokkaGeneratePublicationHtml
run: ./gradlew dokkaGeneratePublicationHtml
- name: Upload artifact
uses: actions/upload-pages-artifact@v4
with:
path: app/build/dokka/html
path: build/dokka/html
deploy:
if: github.repository == 'meshtastic/Meshtastic-Android'

View File

@@ -254,26 +254,6 @@ dependencies {
dokkaPlugin(libs.dokka.android.documentation.plugin)
}
dokka {
moduleName.set("Meshtastic App")
dokkaSourceSets.register("main") {
sourceLink {
enableJdkDocumentationLink.set(true)
enableKotlinStdLibDocumentationLink.set(true)
enableJdkDocumentationLink.set(true)
reportUndocumented.set(true)
localDirectory.set(file("src/main/java"))
remoteUrl("https://github.com/geeksville/Meshtastic-Android/app/src/main/java")
remoteLineSuffix.set("#L")
}
}
dokkaPublications.html { suppressInheritedMembers.set(true) }
dokkaGeneratorIsolation = ProcessIsolation {
// Configures heap size
maxHeapSize = "6g"
}
}
aboutLibraries {
export { excludeFields = listOf("generated") }
library {

View File

@@ -32,6 +32,7 @@ class AndroidLibraryConventionPlugin : Plugin<Project> {
apply(plugin = "meshtastic.android.lint")
apply(plugin = "meshtastic.detekt")
apply(plugin = "meshtastic.spotless")
apply(plugin = "org.jetbrains.dokka")
extensions.configure<LibraryExtension> {
configureKotlinAndroid(this)

View File

@@ -39,6 +39,7 @@ plugins {
alias(libs.plugins.detekt) apply false
alias(libs.plugins.kover)
alias(libs.plugins.spotless) apply false
alias(libs.plugins.dokka)
alias(libs.plugins.meshtastic.root)
}
@@ -46,29 +47,64 @@ plugins {
kover {
reports {
total {
filters {
excludes {
// Exclude generated classes
classes("*_Impl")
classes("*Binding")
classes("*Factory")
classes("*.BuildConfig")
classes("*.R")
classes("*.R$*")
filters {
excludes {
// Exclude generated classes
classes("*_Impl")
classes("*Binding")
classes("*Factory")
classes("*.BuildConfig")
classes("*.R")
classes("*.R$*")
// Exclude UI components
annotatedBy("*Preview")
// Exclude UI components
annotatedBy("*Preview")
// Exclude declarations
annotatedBy(
"*.HiltAndroidApp",
"*.AndroidEntryPoint",
"*.Module",
"*.Provides",
"*.Binds",
"*.Composable",
)
// Exclude declarations
annotatedBy(
"*.HiltAndroidApp",
"*.AndroidEntryPoint",
"*.Module",
"*.Provides",
"*.Binds",
"*.Composable",
)
// Suppress generated code
packages("hilt_aggregated_deps")
packages("org.meshtastic.core.strings")
}
}
}
}
subprojects {
// Apply Dokka to all subprojects to ensure they are available for aggregation
apply(plugin = "org.jetbrains.dokka")
dokka {
dokkaSourceSets.configureEach {
perPackageOption {
matchingRegex.set("hilt_aggregated_deps")
suppress.set(true)
}
perPackageOption {
matchingRegex.set("org.meshtastic.core.strings.*")
suppress.set(true)
}
listOf("java", "kotlin").forEach { lang ->
val dir = file("src/main/$lang")
if (dir.exists()) {
sourceLink {
enableJdkDocumentationLink.set(true)
enableKotlinStdLibDocumentationLink.set(true)
reportUndocumented.set(true)
localDirectory.set(dir)
val relativePath = project.projectDir.relativeTo(rootProject.projectDir).path.replace("\\", "/")
remoteUrl("https://github.com/meshtastic/Meshtastic-Android/blob/main/$relativePath/src/main/$lang")
remoteLineSuffix.set("#L")
}
}
}
}
@@ -77,7 +113,6 @@ kover {
dependencies {
kover(projects.app)
kover(projects.meshServiceExample)
kover(projects.core.analytics)
kover(projects.core.common)
@@ -93,4 +128,33 @@ dependencies {
kover(projects.feature.map)
kover(projects.feature.node)
kover(projects.feature.settings)
dokka(project(":app"))
dokka(project(":core:analytics"))
dokka(project(":core:common"))
dokka(project(":core:data"))
dokka(project(":core:database"))
dokka(project(":core:datastore"))
dokka(project(":core:di"))
dokka(project(":core:model"))
dokka(project(":core:navigation"))
dokka(project(":core:network"))
dokka(project(":core:prefs"))
dokka(project(":core:proto"))
dokka(project(":core:service"))
dokka(project(":core:ui"))
dokka(project(":feature:intro"))
dokka(project(":feature:messaging"))
dokka(project(":feature:map"))
dokka(project(":feature:node"))
dokka(project(":feature:settings"))
}
dokka {
moduleName.set("Meshtastic App")
dokkaPublications.html {
suppressInheritedMembers.set(true)
}
}