Files
Trafero/app/build.gradle.kts
nick f99a68532f
dev / Build debug APK (push) Successful in 39s
release / Build & attach release APK (push) Successful in 1m3s
chore: release v0.2.1 (versionCode 4) with changelog section
2026-09-21 19:00:19 +12:00

98 lines
3.2 KiB
Kotlin

plugins {
alias(libs.plugins.androidApplication)
alias(libs.plugins.kotlinAndroid)
alias(libs.plugins.kotlinCompose)
alias(libs.plugins.kotlinSerialization)
}
android {
namespace = "com.trafero.app"
compileSdk = 35
defaultConfig {
applicationId = "com.trafero.app"
minSdk = 26
targetSdk = 35
versionCode = 4
versionName = "0.2.1"
}
signingConfigs {
create("release") {
storeFile = rootProject.file("keystore/release.jks")
storePassword = "trafero_dev_keystore"
keyAlias = "trafero"
keyPassword = "trafero_dev_keystore"
}
}
buildTypes {
debug {
isMinifyEnabled = false
}
release {
isMinifyEnabled = false
signingConfig = signingConfigs.getByName("release")
}
}
compileOptions {
sourceCompatibility = JavaVersion.VERSION_17
targetCompatibility = JavaVersion.VERSION_17
}
kotlinOptions {
jvmTarget = "17"
}
buildFeatures {
compose = true
}
packaging {
resources.excludes += "META-INF/DEPENDENCIES"
}
}
// Fail fast with an actionable message only when assembleRelease actually
// runs and the keystore is missing - not during project configuration.
tasks.register("validateReleaseKeystore") {
group = "build"
description = "Validates that keystore/release.jks exists before assembleRelease runs"
doFirst {
val f = rootProject.file("keystore/release.jks")
if (!f.exists()) {
throw GradleException(
"Missing ${f.absolutePath}.\n" +
"Generate the dev keystore documented in keystore/README.md:\n" +
" keytool -genkey -noprompt -v \\\n" +
" -keystore keystore/release.jks \\\n" +
" -keyalg RSA -keysize 2048 -validity 10000 \\\n" +
" -alias trafero \\\n" +
" -storepass trafero_dev_keystore \\\n" +
" -keypass trafero_dev_keystore \\\n" +
" -dname \"CN=Trafero, OU=Local, O=Trafero, L=Local, ST=Local, C=NZ\""
)
}
}
}
tasks.matching { it.name == "validateReleaseSigningConfig" || it.name.startsWith("assembleRelease") || it.name.startsWith("bundleRelease") }
.configureEach { dependsOn("validateReleaseKeystore") }
dependencies {
implementation(libs.androidx.core.ktx)
implementation(libs.androidx.activity.compose)
implementation(libs.androidx.lifecycle.runtime.compose)
implementation(libs.androidx.lifecycle.runtime.ktx)
implementation(libs.androidx.lifecycle.viewmodel.compose)
implementation(libs.androidx.navigation.compose)
implementation(libs.androidx.datastore.preferences)
implementation(platform(libs.composeBom))
implementation(libs.compose.ui)
implementation(libs.compose.material3)
implementation(libs.compose.material.icons.extended)
implementation(libs.compose.ui.tooling.preview)
debugImplementation(libs.compose.ui.tooling)
implementation(libs.kotlinx.serialization.json)
implementation(libs.kotlinx.coroutines.android)
implementation(libs.okhttp)
}