mirror of
https://github.com/meshtastic/Meshtastic-Android.git
synced 2026-05-12 08:42:01 -04:00
3.8 KiB
3.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 listed at the bottom.
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 :app: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 (app/,desktop/) wire DI and host UI. SeeAGENTS.mdand.skills/kmp-architecture/. - Flavors:
fdroid(OSS) /google(Maps + DataDog). Only one installable at a time (different signing keys). - Verify before push: Run
./gradlew spotlessApply detekt assembleDebug test allTests, then confirm CI withgh pr checks <PR>. - Strings:
stringResource(Res.string.key)— runpython3 scripts/sort-strings.pyafter adding strings. - Icons:
MeshtasticIcons(fromcore/ui/icon/), notmaterial.icons.Icons. - Error handling:
safeCatching {}(notrunCatching {}) in coroutine code. - Dispatchers:
org.meshtastic.core.common.util.ioDispatcher, notDispatchers.IO. - Navigation:
MeshtasticNavDisplay+NavigationBackHandler(not AndroidBackHandler). - Protos:
core/proto/is a read-only git submodule. Never modify proto files. - Branches: Must start with
feat/,fix/,chore/,docs/,build/,ci/,refactor/,test/,deps/, or a numeric spec prefix. Always branch offorigin/main.
Deeper Guidance
Consult .skills/ for detailed playbooks:
.skills/project-overview/— Full codebase map and bootstrap.skills/kmp-architecture/— Source-set rules, expect/actual.skills/compose-ui/— Adaptive UI, string resources.skills/navigation-and-di/— Nav 3 & Koin patterns.skills/testing-ci/— CI architecture, verification matrix.skills/implement-feature/— Feature development workflow.skills/code-review/— PR hygiene checklist.skills/speckit/— Spec Kit SDD workflow, slash commands, constitution