diff --git a/.github/workflows/docs.yml b/.github/workflows/docs.yml index e91088420..6a6f6c4f0 100644 --- a/.github/workflows/docs.yml +++ b/.github/workflows/docs.yml @@ -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' diff --git a/app/build.gradle.kts b/app/build.gradle.kts index 8f9e8f8b1..b707b365f 100644 --- a/app/build.gradle.kts +++ b/app/build.gradle.kts @@ -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 { diff --git a/build-logic/convention/src/main/kotlin/AndroidLibraryConventionPlugin.kt b/build-logic/convention/src/main/kotlin/AndroidLibraryConventionPlugin.kt index 682c3e45f..2d725c049 100644 --- a/build-logic/convention/src/main/kotlin/AndroidLibraryConventionPlugin.kt +++ b/build-logic/convention/src/main/kotlin/AndroidLibraryConventionPlugin.kt @@ -32,6 +32,7 @@ class AndroidLibraryConventionPlugin : Plugin { apply(plugin = "meshtastic.android.lint") apply(plugin = "meshtastic.detekt") apply(plugin = "meshtastic.spotless") + apply(plugin = "org.jetbrains.dokka") extensions.configure { configureKotlinAndroid(this) diff --git a/build.gradle.kts b/build.gradle.kts index db68d49d6..3abd4240e 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -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) + } +} + +