All checks were successful
PR Checks / android-build (pull_request) Successful in 9m52s
Release-hardening pass (PLAN.md §9 M6, §10, §12). No architecture, data-flow, or endpoint changes; the app remains a pure API client. App icons (default brand assets): - New gateway-medallion launcher icon set (all densities, adaptive fg/bg, round, Play Store icon) + an RG notification icon staged for M7 push. - Replace the Image Asset wizard's default green-grid adaptive background with the deep-indigo brand fill (@color/ic_launcher_background #1B1033); recomposite the legacy square/round webps and the 512 Play icon over indigo so the whole set is coherent (the green never shipped). Restore the SPDX headers the wizard stripped; drop the orphaned placeholder foreground vector. No <monochrome> layer — the full-colour medallion has no clean silhouette, so themed mode falls back to the standard icon rather than a tinted blob. Version-mismatch guard (§3): - The connect probe now refuses a Runic Gateway backend whose API version this build can't speak (e.g. a future v2) with a clear "app out of date" message, instead of mis-rendering; lenient on a blank api (older backend). Decision logic extracted to a pure ConnectionRepository.evaluateVersion() with unit tests. Release build hardening (§7, §12): - Enable R8 full-mode minify + resource shrink for release (~31 MB debug -> 4.2 MB signed release). ProGuard keep-rules for kotlinx.serialization serializers + our wire DTOs, Retrofit service interfaces, and a -dontwarn for Tink's compile-only Error Prone annotations (EncryptedSharedPreferences). - Release signingConfig reads keystore material from a gitignored keystore.properties or env vars; absent -> unsigned (debug + PR gate unaffected). Keystore never in repo. - versionName/versionCode overridable via -P so the release tag + CI run number drive them (§10). CI: - release.yml: on a `v*` tag, build a SIGNED release APK (keystore from a base64 Gitea secret) and attach it + SHA256SUMS to a Gitea release; workflow_dispatch is a signing dry run. Mirrors pr-checks.yml's self-hosted-runner handling (apt JDK 17, explicit sdkmanager, in-step chmod +x gradlew). Co-Authored-By: Claude <noreply@anthropic.com>
160 lines
6.0 KiB
Plaintext
160 lines
6.0 KiB
Plaintext
// SPDX-License-Identifier: GPL-3.0-or-later
|
|
|
|
import java.io.FileInputStream
|
|
import java.util.Properties
|
|
|
|
plugins {
|
|
alias(libs.plugins.android.application)
|
|
alias(libs.plugins.kotlin.android)
|
|
alias(libs.plugins.kotlin.compose)
|
|
alias(libs.plugins.kotlin.serialization)
|
|
alias(libs.plugins.ksp)
|
|
alias(libs.plugins.hilt)
|
|
}
|
|
|
|
// Release signing material (PLAN.md §12) is never committed. It is read from, in
|
|
// order of precedence: a local gitignored `keystore.properties` at the repo root,
|
|
// then environment variables (how CI injects the decoded keystore + secrets). When
|
|
// none is present, the release build is simply left unsigned — `assembleDebug` and
|
|
// the PR gate are unaffected, so contributors without the keystore can still build.
|
|
val keystorePropsFile = rootProject.file("keystore.properties")
|
|
val keystoreProps = Properties().apply {
|
|
if (keystorePropsFile.exists()) FileInputStream(keystorePropsFile).use { load(it) }
|
|
}
|
|
fun signingValue(propKey: String, envKey: String): String? =
|
|
keystoreProps.getProperty(propKey) ?: System.getenv(envKey)
|
|
|
|
val ksStoreFilePath = signingValue("storeFile", "ANDROID_KEYSTORE_FILE")
|
|
val ksStorePassword = signingValue("storePassword", "ANDROID_KEYSTORE_PASSWORD")
|
|
val ksKeyAlias = signingValue("keyAlias", "ANDROID_KEY_ALIAS")
|
|
val ksKeyPassword = signingValue("keyPassword", "ANDROID_KEY_PASSWORD")
|
|
val hasReleaseSigning = ksStoreFilePath != null && ksStorePassword != null &&
|
|
ksKeyAlias != null && ksKeyPassword != null
|
|
|
|
android {
|
|
namespace = "com.runicgateway.app"
|
|
compileSdk = 35
|
|
|
|
defaultConfig {
|
|
// Target application id per docs/android/PLAN.md §13 (pending runicgateway.app domain).
|
|
applicationId = "com.runicgateway.app"
|
|
minSdk = 29
|
|
targetSdk = 35
|
|
// The release workflow drives these from the git tag (versionName) and a
|
|
// monotonic CI run number (versionCode) via -P overrides; local/PR builds
|
|
// fall back to the committed defaults. Keep the tag as the release's source
|
|
// of truth (PLAN.md §10: semantic versionName + monotonic versionCode).
|
|
versionCode = (project.findProperty("versionCode") as String?)?.toIntOrNull() ?: 1
|
|
versionName = (project.findProperty("versionName") as String?)?.takeIf { it.isNotBlank() } ?: "0.1.0"
|
|
|
|
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
|
|
}
|
|
|
|
signingConfigs {
|
|
if (hasReleaseSigning) {
|
|
create("release") {
|
|
storeFile = file(ksStoreFilePath!!)
|
|
storePassword = ksStorePassword
|
|
keyAlias = ksKeyAlias
|
|
keyPassword = ksKeyPassword
|
|
// Sign with both v1 (JAR) and v2 (APK) schemes for broad compatibility.
|
|
enableV1Signing = true
|
|
enableV2Signing = true
|
|
}
|
|
}
|
|
}
|
|
|
|
buildTypes {
|
|
release {
|
|
// R8 full-mode minify + resource shrink (§7: no offline cache, so a lean
|
|
// release APK). Keep rules live in proguard-rules.pro.
|
|
isMinifyEnabled = true
|
|
isShrinkResources = true
|
|
proguardFiles(
|
|
getDefaultProguardFile("proguard-android-optimize.txt"),
|
|
"proguard-rules.pro",
|
|
)
|
|
// Signed only when the keystore material is present (local or CI); an
|
|
// unsigned APK is produced otherwise. The direct-APK release (§10) runs
|
|
// through release.yml, which supplies the keystore from a Gitea secret.
|
|
if (hasReleaseSigning) {
|
|
signingConfig = signingConfigs.getByName("release")
|
|
}
|
|
}
|
|
}
|
|
|
|
compileOptions {
|
|
sourceCompatibility = JavaVersion.VERSION_17
|
|
targetCompatibility = JavaVersion.VERSION_17
|
|
}
|
|
|
|
kotlinOptions {
|
|
jvmTarget = "17"
|
|
}
|
|
|
|
buildFeatures {
|
|
compose = true
|
|
buildConfig = true
|
|
}
|
|
|
|
packaging {
|
|
resources {
|
|
excludes += "/META-INF/{AL2.0,LGPL2.1}"
|
|
}
|
|
}
|
|
}
|
|
|
|
dependencies {
|
|
// Core / lifecycle / activity
|
|
implementation(libs.androidx.core.ktx)
|
|
implementation(libs.androidx.lifecycle.runtime.ktx)
|
|
implementation(libs.androidx.lifecycle.runtime.compose)
|
|
implementation(libs.androidx.lifecycle.viewmodel.compose)
|
|
implementation(libs.androidx.activity.compose)
|
|
|
|
// Compose (BOM-managed versions)
|
|
implementation(platform(libs.androidx.compose.bom))
|
|
implementation(libs.androidx.compose.ui)
|
|
implementation(libs.androidx.compose.ui.graphics)
|
|
implementation(libs.androidx.compose.ui.tooling.preview)
|
|
implementation(libs.androidx.compose.material3)
|
|
implementation(libs.androidx.compose.material.icons.core)
|
|
implementation(libs.androidx.navigation.compose)
|
|
debugImplementation(libs.androidx.compose.ui.tooling)
|
|
debugImplementation(libs.androidx.compose.ui.test.manifest)
|
|
|
|
// DI
|
|
implementation(libs.hilt.android)
|
|
ksp(libs.hilt.compiler)
|
|
implementation(libs.androidx.hilt.navigation.compose)
|
|
|
|
// Networking (wired for M1+; declared now so the stack resolves)
|
|
implementation(libs.retrofit)
|
|
implementation(platform(libs.okhttp.bom))
|
|
implementation(libs.okhttp)
|
|
implementation(libs.okhttp.logging.interceptor)
|
|
implementation(libs.okhttp.sse)
|
|
implementation(libs.kotlinx.serialization.json)
|
|
implementation(libs.retrofit.kotlinx.serialization.converter)
|
|
|
|
// Storage
|
|
implementation(libs.androidx.datastore.preferences)
|
|
implementation(libs.androidx.security.crypto)
|
|
|
|
// Web hand-off (Chrome Custom Tabs) for register / invite / reset / SSO (§4.2)
|
|
implementation(libs.androidx.browser)
|
|
|
|
// Images
|
|
implementation(libs.coil.compose)
|
|
|
|
// Unit tests
|
|
testImplementation(libs.junit)
|
|
testImplementation(libs.kotlinx.coroutines.test)
|
|
|
|
// Instrumented tests
|
|
androidTestImplementation(libs.androidx.test.ext.junit)
|
|
androidTestImplementation(libs.androidx.espresso.core)
|
|
androidTestImplementation(platform(libs.androidx.compose.bom))
|
|
androidTestImplementation(libs.androidx.compose.ui.test.junit4)
|
|
}
|