mirror of
https://github.com/meshtastic/Meshtastic-Android.git
synced 2026-09-23 20:25:08 -04:00
Isolated the exact trigger of the previously-blocking "IllegalStateException:
:core:common is not configured for JS usage" error empirically: it's
webApp's binaries.executable() specifically, not wasmJs { browser() } in
general. Once any module in a multi-project build declares an executable
Kotlin/Wasm binary, KGP's root npm resolver (kotlinWasmNpmInstall)
requires EVERY module reachable from that binary's dependency graph to
also declare browser()/nodejs() -- bare wasmJs() no longer satisfies it.
Retrofitted wasmJs { browser() } onto all 18 wasmJs-enabled modules
(every core:* and feature:* module that previously stayed at bare
wasmJs()). An earlier attempt at this exact retrofit was reverted after
finding it arms wasmJsBrowserTest repo-wide with no karma/headless-Chrome
runner configured -- this time paired with a central disable in
KotlinAndroid.kt's configureKotlinMultiplatform() instead of reverting
the fix that actually solves the resolver conflict.
Two further, adjacent bugs surfaced once wasmJsBrowserTest's runtime
classpath actually existed for the first time (bare wasmJs() never
created one, so neither bug had ever fired before):
- ProjectExtensions.kt's configureTestOptions() was unconditionally
injecting the JVM-only junit-platform-launcher into every
"*TestRuntimeClasspath" configuration, including wasmJs's -- excluded
wasmJs* configurations from that injection.
- Compose Multiplatform's plugin registers
checkComposeUiTestConfigurationForWasmJs unconditionally on every
Compose-enabled module with wasmJs { browser() }, regardless of
whether it has real Compose UI tests (none of ours do) -- disabled
centrally alongside wasmJsBrowserTest.
:webApp:wasmJsBrowserDistribution -- previously never even attempted in
the live build -- now succeeds and produces a real, loadable browser
bundle (webApp/build/dist/wasmJs/productionExecutable/). Getting there
also required relaxing settings.gradle.kts's repositoriesMode from
FAIL_ON_PROJECT_REPOS to PREFER_SETTINGS (a deliberate supply-chain
policy change, not incidental config) plus three settings-level,
content-filtered ivy repos for Kotlin/Wasm's NodeJs/Yarn/Binaryen setup
tasks (nodejs.org/dist, yarnpkg releases, WebAssembly/binaryen releases)
-- those setup tasks register their own project-level ivy repos, which
PREFER_SETTINGS ignores in favor of a settings-declared equivalent
rather than erroring outright the way FAIL_ON_PROJECT_REPOS does. The
content filters on each repo (includeModule) are what preserve
FAIL_ON_PROJECT_REPOS's original centralization intent: every repository
a build can pull from is still declared in exactly one place.
kotlin-js-store/wasm/yarn.lock is KGP's own generated lockfile for the
resolved npm/yarn dependency versions, committed per upstream convention
for reproducible builds.
Full repo baseline gate (spotlessCheck detekt assembleDebug test
allTests) passes clean with :webApp present in the build graph.
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
:core:common
Overview
Targets: Android · JVM (Desktop) · iOS
The :core:common module contains low-level utility functions, extensions, and common data structures that do not depend on any other Meshtastic-specific modules. It is designed to be highly reusable across the project.
Key Components
1. util package
Contains general-purpose extensions and helpers:
- Coroutines: Helpers for structured concurrency and Flow transformations.
- Time: Utilities for handling timestamps and durations, plus
DateFormatterfor display dates. - Exceptions: Standardized exception types for common error scenarios.
NumberFormatter: Locale-aware number formatting (pre-format floats before Compose display).UrlUtils/CommonUri: URL helpers and a multiplatform URI abstraction.
2. MetricFormatter.kt
Centralized utility for display strings — temperature, voltage, current, percent, humidity, pressure, SNR, RSSI. Ensures consistent unit spacing and formatting across all UI surfaces.
3. BuildConfigProvider.kt
An interface for accessing build-time configuration in a multiplatform-friendly way.
Dependency Graph
graph TB
:core:common[common]:::kmp-library
classDef android-application fill:#CAFFBF,stroke:#000,stroke-width:2px,color:#000;
classDef android-application-compose fill:#CAFFBF,stroke:#000,stroke-width:2px,color:#000;
classDef compose-desktop-application fill:#CAFFBF,stroke:#000,stroke-width:2px,color:#000;
classDef android-feature fill:#FFD6A5,stroke:#000,stroke-width:2px,color:#000;
classDef android-library fill:#9BF6FF,stroke:#000,stroke-width:2px,color:#000;
classDef android-library-compose fill:#9BF6FF,stroke:#000,stroke-width:2px,color:#000;
classDef android-test fill:#A0C4FF,stroke:#000,stroke-width:2px,color:#000;
classDef jvm-library fill:#BDB2FF,stroke:#000,stroke-width:2px,color:#000;
classDef kmp-feature fill:#FFD6A5,stroke:#000,stroke-width:2px,color:#000;
classDef kmp-library-compose fill:#FFC1CC,stroke:#000,stroke-width:2px,color:#000;
classDef kmp-library fill:#FFC1CC,stroke:#000,stroke-width:2px,color:#000;
classDef unknown fill:#FFADAD,stroke:#000,stroke-width:2px,color:#000;