ci: Update Dokka configuration and unify AboutLibraries JSON generation (#4767)

Signed-off-by: James Rich <2199651+jamesarich@users.noreply.github.com>
This commit is contained in:
James Rich 2026-03-12 20:49:11 -05:00 committed by GitHub
parent 629d80ec65
commit 3321c47200
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
14 changed files with 43 additions and 79 deletions

View file

@ -29,7 +29,6 @@ import org.koin.compose.viewmodel.koinViewModel
import org.meshtastic.app.settings.AndroidDebugViewModel
import org.meshtastic.app.settings.AndroidRadioConfigViewModel
import org.meshtastic.app.settings.AndroidSettingsViewModel
import org.meshtastic.app.util.AboutLibrariesJsonProvider
import org.meshtastic.core.navigation.NodesRoutes
import org.meshtastic.core.navigation.Route
import org.meshtastic.core.navigation.SettingsRoutes
@ -185,10 +184,7 @@ fun EntryProviderScope<NavKey>.settingsGraph(backStack: NavBackStack<NavKey>) {
entry<SettingsRoutes.About> {
AboutScreen(
onNavigateUp = { backStack.removeLastOrNull() },
jsonProvider = {
// Load from AboutLibraries asset/classpath resource
AboutLibrariesJsonProvider.getJson()
},
jsonProvider = { SettingsRoutes::class.java.getResource("/aboutlibraries.json")?.readText() ?: "" },
)
}

View file

@ -1,59 +0,0 @@
/*
* Copyright (c) 2025-2026 Meshtastic LLC
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
package org.meshtastic.app.util
import co.touchlab.kermit.Logger
import java.io.IOException
/**
* Provides the AboutLibraries JSON data for the About screen.
*
* The JSON is generated by the AboutLibraries Gradle plugin during the build process. For Android, we load it from the
* application's assets or classpath resource.
*/
object AboutLibrariesJsonProvider {
private val logger = Logger.withTag("AboutLibrariesJsonProvider")
/**
* Returns the AboutLibraries JSON string.
*
* Since the AboutLibraries Gradle plugin generates the JSON at build time, we attempt to load it from the
* classpath. If that fails, we return an empty object to allow the app to gracefully degrade.
*/
suspend fun getJson(): String = try {
val resource = AboutLibrariesJsonProvider::class.java.classLoader?.getResource("aboutlibraries.json")
if (resource != null) {
resource.readText()
} else {
// Fallback: return an empty libraries object
logger.w("AboutLibraries JSON resource not found in classpath")
"""{"libraries":[]}"""
}
} catch (e: SecurityException) {
// Security exception when accessing resources - return fallback
logger.w("SecurityException loading AboutLibraries JSON: ${e.message}")
"""{"libraries":[]}"""
} catch (e: IllegalStateException) {
// Libraries not generated/available - return fallback
logger.w("IllegalStateException loading AboutLibraries JSON: ${e.message}")
"""{"libraries":[]}"""
} catch (e: IOException) {
// I/O exception when reading resource - return fallback
logger.w("IOException loading AboutLibraries JSON: ${e.message}")
"""{"libraries":[]}"""
}
}