mirror of
https://github.com/meshtastic/Meshtastic-Android.git
synced 2026-04-20 22:23:37 +00:00
chore(build): enable AboutLibraries offlineMode by default (#5054)
This commit is contained in:
parent
520fa717a9
commit
77e30b60e1
5 changed files with 22 additions and 19 deletions
2
.github/workflows/release.yml
vendored
2
.github/workflows/release.yml
vendored
|
|
@ -285,7 +285,7 @@ jobs:
|
|||
env:
|
||||
ORG_GRADLE_PROJECT_appVersionName: ${{ needs.prepare-build-info.outputs.APP_VERSION_NAME }}
|
||||
APPIMAGE_EXTRACT_AND_RUN: 1
|
||||
run: ./gradlew :desktop:packageReleaseDistributionForCurrentOS --no-daemon
|
||||
run: ./gradlew :desktop:packageReleaseDistributionForCurrentOS -PaboutLibraries.release=true --no-daemon
|
||||
|
||||
- name: List Desktop Binaries
|
||||
if: runner.os == 'Linux'
|
||||
|
|
|
|||
|
|
@ -92,6 +92,7 @@ Meshtastic-Android is a Kotlin Multiplatform (KMP) application for off-grid, dec
|
|||
- **Networking:** Pure **Ktor** — no OkHttp anywhere. Engines: `ktor-client-android` for Android, `ktor-client-java` for desktop/JVM. Use Ktor `Logging` plugin for HTTP debug logging (not OkHttp interceptors). `HttpClient` is provided via Koin in `app/di/NetworkModule` and `core:network/di/CoreNetworkAndroidModule`.
|
||||
- **Image Loading (Coil):** Use `coil-network-ktor3` with `KtorNetworkFetcherFactory` on **all** platforms. `ImageLoader` is configured in host modules only (`app` via Koin `@Single`, `desktop` via `setSingletonImageLoaderFactory`). Feature modules depend only on `libs.coil` (coil-compose) for `AsyncImage` — never add `coil-network-*` or `coil-svg` to feature modules.
|
||||
- **Dependencies:** Check `gradle/libs.versions.toml` before assuming a library is available.
|
||||
- **AboutLibraries:** Runs in `offlineMode` by default (no GitHub/SPDX API calls). Release builds pass `-PaboutLibraries.release=true` via Fastlane properties (Android) or Gradle CLI (desktop) to enable remote license/funding fetching. Do NOT re-gate on `CI` or `GITHUB_TOKEN` alone — that burns API calls on every PR check.
|
||||
- **JetBrains fork aliases:** Version catalog aliases for JetBrains-forked AndroidX artifacts use the `jetbrains-*` prefix (e.g., `jetbrains-lifecycle-runtime-compose`, `jetbrains-navigation3-ui`). Plain `androidx-*` aliases are true Google AndroidX artifacts. Never mix them up in `commonMain`.
|
||||
- **Compose Multiplatform:** Version catalog aliases for Compose Multiplatform artifacts use the `compose-multiplatform-*` prefix (e.g., `compose-multiplatform-material3`, `compose-multiplatform-foundation`). Never use plain `androidx.compose` dependencies in common Main.
|
||||
- **Room KMP:** Always use `factory = { MeshtasticDatabaseConstructor.initialize() }` in `Room.databaseBuilder` and `inMemoryDatabaseBuilder`. DAOs and Entities reside in `commonMain`.
|
||||
|
|
|
|||
|
|
@ -316,16 +316,16 @@ dependencies {
|
|||
}
|
||||
|
||||
aboutLibraries {
|
||||
// Fetch full license text + funding info from GitHub API when on CI with a token
|
||||
val isCi =
|
||||
providers
|
||||
.gradleProperty("ci")
|
||||
.map { it.toBoolean() }
|
||||
.getOrElse(providers.environmentVariable("CI").map { it.toBoolean() }.getOrElse(false))
|
||||
// Run offline by default to avoid burning GitHub API calls on every build.
|
||||
// Release builds pass -PaboutLibraries.release=true to fetch full license text + funding info.
|
||||
val isReleaseBuild = providers.gradleProperty("aboutLibraries.release").map { it.toBoolean() }.getOrElse(false)
|
||||
val ghToken = providers.environmentVariable("GITHUB_TOKEN")
|
||||
|
||||
offlineMode = !isReleaseBuild
|
||||
|
||||
collect {
|
||||
fetchRemoteLicense = isCi && ghToken.isPresent
|
||||
fetchRemoteFunding = isCi && ghToken.isPresent
|
||||
fetchRemoteLicense = isReleaseBuild && ghToken.isPresent
|
||||
fetchRemoteFunding = isReleaseBuild && ghToken.isPresent
|
||||
if (ghToken.isPresent) {
|
||||
gitHubApiToken = ghToken.get()
|
||||
}
|
||||
|
|
|
|||
|
|
@ -227,16 +227,16 @@ dependencies {
|
|||
}
|
||||
|
||||
aboutLibraries {
|
||||
// Fetch full license text + funding info from GitHub API when on CI with a token
|
||||
val isCi =
|
||||
providers
|
||||
.gradleProperty("ci")
|
||||
.map { it.toBoolean() }
|
||||
.getOrElse(providers.environmentVariable("CI").map { it.toBoolean() }.getOrElse(false))
|
||||
// Run offline by default to avoid burning GitHub API calls on every build.
|
||||
// Release builds pass -PaboutLibraries.release=true to fetch full license text + funding info.
|
||||
val isReleaseBuild = providers.gradleProperty("aboutLibraries.release").map { it.toBoolean() }.getOrElse(false)
|
||||
val ghToken = providers.environmentVariable("GITHUB_TOKEN")
|
||||
|
||||
offlineMode = !isReleaseBuild
|
||||
|
||||
collect {
|
||||
fetchRemoteLicense = isCi && ghToken.isPresent
|
||||
fetchRemoteFunding = isCi && ghToken.isPresent
|
||||
fetchRemoteLicense = isReleaseBuild && ghToken.isPresent
|
||||
fetchRemoteFunding = isReleaseBuild && ghToken.isPresent
|
||||
if (ghToken.isPresent) {
|
||||
gitHubApiToken = ghToken.get()
|
||||
}
|
||||
|
|
|
|||
|
|
@ -38,7 +38,8 @@ platform :android do
|
|||
task: "assembleFdroidRelease",
|
||||
properties: {
|
||||
"android.injected.version.name" => ENV['VERSION_NAME'],
|
||||
"android.injected.version.code" => ENV['VERSION_CODE']
|
||||
"android.injected.version.code" => ENV['VERSION_CODE'],
|
||||
"aboutLibraries.release" => "true"
|
||||
}
|
||||
)
|
||||
end
|
||||
|
|
@ -50,7 +51,8 @@ platform :android do
|
|||
print_command: false,
|
||||
properties: {
|
||||
"android.injected.version.name" => ENV['VERSION_NAME'],
|
||||
"android.injected.version.code" => ENV['VERSION_CODE']
|
||||
"android.injected.version.code" => ENV['VERSION_CODE'],
|
||||
"aboutLibraries.release" => "true"
|
||||
}
|
||||
)
|
||||
lane_context[SharedValues::GRADLE_AAB_OUTPUT_PATH]
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue