2.8 KiB
Meshtastic Android — Copilot Instructions
Full rules:
AGENTS.mdis the source of truth. This file is a compact quick-reference for build commands and task naming. For architecture, conventions, and workflow details, consultAGENTS.mdand the.skills/playbooks.
Build, Test & Lint
Requires: JDK 21, ANDROID_HOME set, proto submodule initialized.
# Bootstrap (run once per fresh clone)
git submodule update --init
[ -f local.properties ] || cp secrets.defaults.properties local.properties
# Full local verification (formatting → lint → compile → tests)
./gradlew spotlessApply detekt assembleDebug test allTests
# Single module tests (KMP module)
./gradlew :core:data:allTests
# Single module tests (Android-only module like :app)
./gradlew :androidApp:testFdroidDebugUnitTest
# Cross-platform compilation check (no tests)
./gradlew kmpSmokeCompile
# Flavor-specific lint
./gradlew lintFdroidDebug lintGoogleDebug
Both
testANDallTestsare needed.allTestscovers KMP modules;testcovers pure-Android modules. Neither alone catches everything.
Gradle task naming (KMP vs Android-only)
KMP modules have different task names than pure-Android modules. Using the wrong name silently skips tests or fails resolution.
| Intent | KMP modules (core:*, feature:*) |
Android-only (app, core:api, core:barcode) |
|---|---|---|
| Run tests | :module:allTests |
:module:testFdroidDebugUnitTest |
| Detekt | :module:detekt (lifecycle task) |
:module:detekt |
| Compile check | :module:compileKotlinJvm |
:module:compileFdroidDebugKotlin |
Common mistakes:
- ❌
:core:network:detektMain— does not exist in KMP; variants aredetektJvmMain,detektMetadataCommonMain, etc. Use:core:network:detektinstead. - ❌
:feature:connections:testDebugUnitTest— ambiguous in KMP modules. Use:feature:connections:allTests. - ❌
:feature:connections:compileFdroidDebugKotlin— wrong for KMP. Use:feature:connections:compileKotlinJvmorkmpSmokeCompile.
Quick Reference
- Architecture: KMP project (Android, Desktop, iOS). Business logic in
commonMain; platform shells (androidApp/,desktopApp/) wire DI and host UI. - Flavors:
fdroid(OSS) /google(Maps + DataDog). Only one installable at a time (different signing keys).
See
AGENTS.mdfor full rules (verify before push, branch naming, protos, coding conventions). Contextual.github/instructions/files enforce conventions scoped to relevant source sets.
For additional context about technologies to be used, project structure, shell commands, and other important information, read the current plan