Files
Meshtastic-Android/docs/en/developer/codebase.md
James Rich 8346b18cc4 docs: veracity pass, screenshot enrichment, and screenshot pipeline split
Audit the user docs for accuracy against the code, enrich them with
component-level screenshots, and separate the doc-screenshot generation
path from the visual-regression gate so doc framing no longer churns test
baselines.

Veracity fixes (claims verified against code):
- connections: removed 3 screenshots that were from the unrelated mPWRD/nymea
  WiFi-provisioning app and rewrote the TCP/IP section to match the real
  Network transport flow (mDNS scan + manual IP:4403); replaced the BLE
  "scan" image (it was the wifi-provision splash) with the real device list.
- nodes: online window is 2h (not 15min); binary online/offline, no "away" tier.
- map: markers are identity-colored node chips, not online-status colors.
- node-metrics & signal-meter: signal quality is preset-relative SNR, not
  fixed thresholds.
- messages: max message length is 200 bytes (not 237/230).
- telemetry: CO2 bands aligned to Co2Severity (Good/Stuffy/Poor/Unsafe/Evacuate).
- translate: locale dirs use {lang}-r{REGION}.

New pages: Home Screen Widget, Help & In-App Docs (Chirpy on-device AI).

Screenshot enrichment + tighter framing: added IAQ scale, firmware verifying,
TAK local server, quick-chat dialog; cropped firmware states and connections
panes to component-level views instead of full-screen frames.

Pipeline split (new :docs-screenshots module, generate-only, not CI-gated):
holds doc-framed compositions so reframing a doc image never moves a regression
baseline; :screenshot-tests stays the gate. copyDocsScreenshots aggregates
both modules. Updated CI filter, governance advisories, dev docs, and the
testing-ci skill.

Translated docs re-sync from the English source via the scheduled Crowdin job.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-25 20:46:32 -05:00

148 lines
4.0 KiB
Markdown

---
title: Codebase
parent: Developer Guide
nav_order: 2
last_updated: 2026-06-11
aliases:
- repository-layout
- project-structure
- source-code
---
# Codebase
Repository layout, namespacing conventions, and build system overview.
## Repository Structure
```
Meshtastic-Android/
├── androidApp/ # Android application module
│ ├── src/main/ # Shared Android code
│ ├── src/google/ # Google Play flavor (Gemini, proprietary)
│ └── src/fdroid/ # F-Droid flavor (FOSS-only)
├── desktopApp/ # Desktop JVM application
├── feature/ # Feature modules (KMP)
│ ├── intro/
│ ├── messaging/
│ ├── connections/
│ ├── map/
│ ├── node/
│ ├── settings/
│ ├── firmware/
│ ├── docs/
│ ├── wifi-provision/
│ ├── widget/
│ ├── discovery/
│ └── car/
├── core/ # Core infrastructure modules (KMP)
│ ├── barcode/
│ ├── ble/
│ ├── common/
│ ├── data/
│ ├── database/
│ ├── datastore/
│ ├── di/
│ ├── domain/
│ ├── model/
│ ├── navigation/
│ ├── network/
│ ├── nfc/
│ ├── prefs/
│ ├── repository/
│ ├── resources/
│ ├── service/
│ ├── takserver/
│ ├── testing/
│ └── ui/
├── baselineprofile/ # Baseline Profile generation for :androidApp
├── screenshot-tests/ # Compose Preview screenshot tests (visual-regression gate)
├── docs-screenshots/ # Doc-framed composition screenshots (generate-only, not CI-gated)
├── build-logic/ # Convention plugins and build helpers
│ ├── convention/
│ └── flatpak/
├── docs/ # Documentation source (markdown)
│ ├── user/
│ └── developer/
├── gradle/ # Gradle wrapper and version catalog
│ └── libs.versions.toml
├── specs/ # Feature specifications
└── .github/workflows/ # CI/CD workflows
```
## Namespacing Convention
All Kotlin packages follow the pattern:
```
org.meshtastic.{layer}.{module}.{subpackage}
```
Examples:
- `org.meshtastic.core.navigation` — core navigation module
- `org.meshtastic.feature.docs.ui` — docs feature UI package
- `org.meshtastic.app.di` — app DI configuration
## Build System
### Gradle Kotlin DSL
All build files use Kotlin DSL (`.gradle.kts`). Configuration:
- **Version catalog:** `gradle/libs.versions.toml`
- **Convention plugins:** `build-logic/convention/`
- **Settings:** `settings.gradle.kts`
### Convention Plugins
Located in `build-logic/convention/src/main/kotlin/org/meshtastic/buildlogic/`:
| Plugin | Purpose |
|--------|---------|
| `meshtastic.kmp.feature` | Standard feature module setup |
| `meshtastic.kmp.jvm.android` | JVM + Android target configuration |
| `meshtastic.kotlinx.serialization` | Serialization plugin setup |
### Build Variants (Android)
| Flavor | Description |
|--------|-------------|
| `google` | Google Play distribution; includes proprietary APIs |
| `fdroid` | F-Droid distribution; FOSS-only dependencies |
### Key Gradle Tasks
```bash
# Compile check across all KMP targets
./gradlew kmpSmokeCompile
# Run all tests
./gradlew allTests
# Code quality
./gradlew spotlessCheck detekt
# Android build
./gradlew assembleGoogleDebug assembleFdroidDebug
# Desktop run
./gradlew :desktopApp:run
```
## Version Catalog Highlights
Key dependencies in `gradle/libs.versions.toml`:
| Category | Library |
|----------|---------|
| Compose | Compose Multiplatform (JetBrains) |
| Navigation | Navigation 3 |
| DI | Koin (annotations) |
| Serialization | kotlinx.serialization |
| Database | Room KMP |
| Networking | Ktor |
| Markdown | multiplatform-markdown-renderer |
| Testing | kotlin-test, compose-ui-test |
---