From 228765a159b6f1498566d3fe6005f91b470761b4 Mon Sep 17 00:00:00 2001 From: James Rich <2199651+jamesarich@users.noreply.github.com> Date: Tue, 19 May 2026 13:00:45 -0500 Subject: [PATCH] fix(ci): unblock Dokka documentation generation (#5496) Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --- .gitignore | 6 +++--- .../org/meshtastic/app/di/GoogleAiModule.kt | 3 ++- .../src/main/kotlin/RootConventionPlugin.kt | 9 ++++++++- .../org/meshtastic/buildlogic/KotlinAndroid.kt | 16 ++++++++++++++++ .../core/takserver/TAKMeshIntegration.kt | 2 +- .../docs/translation/DocTranslationCache.kt | 2 +- 6 files changed, 31 insertions(+), 7 deletions(-) diff --git a/.gitignore b/.gitignore index 77738d14b..faa540dfa 100644 --- a/.gitignore +++ b/.gitignore @@ -70,9 +70,9 @@ firebase-debug.log /kable/ .opencode/ # Synced docs in composeResources (generated from docs/ source by syncDocsToComposeResources task) -feature/docs/src/commonMain/composeResources/files/docs/user/ -feature/docs/src/commonMain/composeResources/files/docs/developer/ -feature/docs/src/commonMain/composeResources/files/docs/assets/ +feature/docs/src/commonMain/composeResources/files/docs/ +# Synced translated docs (generated from docs/{locale}/ by syncTranslatedDocsToComposeResources task) +feature/docs/src/commonMain/composeResources/files/*/docs/ /desktop/bin/ /build-logic/convention/bin/ diff --git a/androidApp/src/google/kotlin/org/meshtastic/app/di/GoogleAiModule.kt b/androidApp/src/google/kotlin/org/meshtastic/app/di/GoogleAiModule.kt index 12e623599..a61c930ad 100644 --- a/androidApp/src/google/kotlin/org/meshtastic/app/di/GoogleAiModule.kt +++ b/androidApp/src/google/kotlin/org/meshtastic/app/di/GoogleAiModule.kt @@ -17,6 +17,7 @@ package org.meshtastic.app.di import android.content.Context +import okio.FileSystem import okio.Path.Companion.toOkioPath import org.koin.core.annotation.Module import org.koin.core.annotation.Single @@ -37,7 +38,7 @@ class GoogleAiModule { @Single fun docTranslationCache(context: Context): DocTranslationCache = - DocTranslationCache(cacheDir = context.cacheDir.toOkioPath()) + DocTranslationCache(cacheDir = context.cacheDir.toOkioPath(), fileSystem = FileSystem.SYSTEM) @Single fun docTranslationService(cache: DocTranslationCache): DocTranslationService = MlKitDocTranslator(cache) } diff --git a/build-logic/convention/src/main/kotlin/RootConventionPlugin.kt b/build-logic/convention/src/main/kotlin/RootConventionPlugin.kt index 140f3eaef..27014599f 100644 --- a/build-logic/convention/src/main/kotlin/RootConventionPlugin.kt +++ b/build-logic/convention/src/main/kotlin/RootConventionPlugin.kt @@ -37,7 +37,7 @@ class RootConventionPlugin : Plugin { val modules = allModules() apply(plugin = "org.jetbrains.dokka") - configureDokkaAggregation(modules) + configureDokkaAggregation(modules.filter { it !in DOKKA_EXCLUDED_MODULES }) apply(plugin = "org.jetbrains.kotlinx.kover") configureKover() @@ -117,6 +117,13 @@ private val ALL_MODULES_FULL = /** Android-only modules that don't apply the KMP plugin. */ private val ANDROID_ONLY_MODULES = setOf(":androidApp", ":core:api", ":core:barcode", ":feature:widget") +/** + * Modules excluded from Dokka aggregation. :core:proto contains only auto-generated Wire classes (no KDoc value) and + * its TAKPacket-SDK dependency doesn't publish iOS metadata JARs to JitPack, causing + * `transformCommonMainDependenciesMetadata` to fail during Dokka resolution. + */ +private val DOKKA_EXCLUDED_MODULES = setOf(":core:proto") + private fun allModules(): List = ALL_MODULES_FULL /** diff --git a/build-logic/convention/src/main/kotlin/org/meshtastic/buildlogic/KotlinAndroid.kt b/build-logic/convention/src/main/kotlin/org/meshtastic/buildlogic/KotlinAndroid.kt index 5229e42f1..735d5e79a 100644 --- a/build-logic/convention/src/main/kotlin/org/meshtastic/buildlogic/KotlinAndroid.kt +++ b/build-logic/convention/src/main/kotlin/org/meshtastic/buildlogic/KotlinAndroid.kt @@ -122,6 +122,22 @@ internal fun Project.configureKotlinMultiplatform() { } } + // TAKPacket-SDK doesn't publish iOS metadata JARs on JitPack (the .klib exists but + // the metadata .jar returns 404). iOS native compilation resolves fine via .klib, but + // `transformCommonMainDependenciesMetadata` (triggered by Dokka/publishing) fails. + // Exclude the SDK only from the CompilationDependenciesMetadata configs that feed + // the metadata transform — NOT from Implementation/Resolvable configs which feed the + // actual compiler classpath. + val iosMetadataConfigs = setOf( + "iosArm64CompilationDependenciesMetadata", + "iosSimulatorArm64CompilationDependenciesMetadata", + ) + configurations.configureEach { + if (name in iosMetadataConfigs) { + exclude(mapOf("group" to "com.github.meshtastic.TAKPacket-SDK", "module" to "takpacket-sdk")) + } + } + configureMokkery() configureKotlin() } diff --git a/core/takserver/src/commonMain/kotlin/org/meshtastic/core/takserver/TAKMeshIntegration.kt b/core/takserver/src/commonMain/kotlin/org/meshtastic/core/takserver/TAKMeshIntegration.kt index 4db83f5c3..ce14df9cd 100644 --- a/core/takserver/src/commonMain/kotlin/org/meshtastic/core/takserver/TAKMeshIntegration.kt +++ b/core/takserver/src/commonMain/kotlin/org/meshtastic/core/takserver/TAKMeshIntegration.kt @@ -509,7 +509,7 @@ class TAKMeshIntegration( """]*/>""", // iTAK camelCase variant """]*>.*?""", ) - .map { Regex(it, RegexOption.DOT_MATCHES_ALL) } + .map { Regex("(?s)$it") } // Strip any attribute with value "???" — unknown/placeholder metadata private val UNKNOWN_ATTR_PATTERN = Regex("""\s+\w+\s*=\s*"[?]{3}"""") diff --git a/feature/docs/src/commonMain/kotlin/org/meshtastic/feature/docs/translation/DocTranslationCache.kt b/feature/docs/src/commonMain/kotlin/org/meshtastic/feature/docs/translation/DocTranslationCache.kt index 690a03810..51f74047f 100644 --- a/feature/docs/src/commonMain/kotlin/org/meshtastic/feature/docs/translation/DocTranslationCache.kt +++ b/feature/docs/src/commonMain/kotlin/org/meshtastic/feature/docs/translation/DocTranslationCache.kt @@ -33,7 +33,7 @@ import okio.buffer */ class DocTranslationCache( private val cacheDir: Path, - private val fileSystem: FileSystem = FileSystem.SYSTEM, + private val fileSystem: FileSystem, private val maxCacheSizeBytes: Long = MAX_CACHE_SIZE_BYTES, ) { companion object {