feat: upgrade build environment to JDK 21 and centralize CI configuration

- Create a composite GitHub Action `gradle-setup` to encapsulate code checkout, wrapper validation, JDK 21 setup, and Gradle caching logic.
- Update all GitHub workflows (`publish-core`, `codeql`, `scheduled-updates`, `release`, etc.) to utilize the new centralized `gradle-setup` action.
- Upgrade the project's primary JDK requirement from 17 to 21 across `jitpack.yml`, workflow files, and build-logic conventions.
- Refactor `KotlinAndroid.kt` and `build.gradle.kts` to target JVM 21 for the application while maintaining JVM 17 compatibility for published library modules (`api`, `model`, `proto`).
- Introduce a new `build-desktop` job in `reusable-check.yml` to verify desktop artifact assembly during CI.
- Implement dynamic `cache_read_only` detection in workflows to optimize Gradle cache usage across different branch types and merge groups.
- Update project documentation (`GEMINI.md`, `AGENTS.md`, `CONTRIBUTING.md`) to reflect the JDK 21 requirement and provide guidance on Robolectric configuration for the new version.
This commit is contained in:
James Rich 2026-03-27 09:25:33 -05:00
parent 9c9a1d7567
commit 8eb5970ca8
15 changed files with 130 additions and 167 deletions

View file

@ -8,7 +8,7 @@ For execution-focused recipes, see `docs/agent-playbooks/README.md`.
Meshtastic-Android is a Kotlin Multiplatform (KMP) application for off-grid, decentralized mesh networks. The goal is to decouple business logic from the Android framework, enabling future expansion to iOS and other platforms while maintaining a high-performance native Android experience.
- **Language:** Kotlin (primary), AIDL.
- **Build System:** Gradle (Kotlin DSL). JDK 17 is REQUIRED.
- **Build System:** Gradle (Kotlin DSL). JDK 21 is REQUIRED.
- **Target SDK:** API 36. Min SDK: API 26 (Android 8.0).
- **Flavors:**
- `fdroid`: Open source only, no tracking/analytics.
@ -99,7 +99,7 @@ Meshtastic-Android is a Kotlin Multiplatform (KMP) application for off-grid, dec
## 4. Execution Protocol
### A. Environment Setup
1. **JDK 17 MUST be used** to prevent Gradle sync/build failures.
1. **JDK 21 MUST be used** to prevent Gradle sync/build failures.
2. **Secrets:** You must copy `secrets.defaults.properties` to `local.properties`:
```properties
MAPS_API_KEY=dummy_key
@ -128,7 +128,7 @@ Always run commands in the following order to ensure reliability. Do not attempt
./gradlew testFdroidDebug testGoogleDebug # Flavor-specific unit tests
./gradlew lintFdroidDebug lintGoogleDebug # Flavor-specific lint checks
```
*Note: If testing Compose UI on the JVM (Robolectric) with Java 17, pin your tests to `@Config(sdk = [34])` to avoid SDK 35 compatibility crashes.*
*Note: If testing Compose UI on the JVM (Robolectric) with Java 21, pin your tests to `@Config(sdk = [34])` to avoid SDK 35 compatibility crashes.*
**CI workflow conventions (GitHub Actions):**
- Reusable CI is split into a host job and an Android matrix job in `.github/workflows/reusable-check.yml`.
@ -154,6 +154,6 @@ Update documentation continuously as part of the same change. If you modify arch
## 5. Troubleshooting
- **Build Failures:** Check `gradle/libs.versions.toml` for dependency conflicts.
- **Missing Secrets:** Check `local.properties`.
- **JDK Version:** JDK 17 is required.
- **JDK Version:** JDK 21 is required.
- **Configuration Cache:** Add `--no-configuration-cache` flag if cache-related issues persist.
- **Koin Injection Failures:** Verify the KMP component is included in `app` root module wiring (`AppKoinModule`).