Files
thefeed/android/app/build.gradle
T

88 lines
3.0 KiB
Groovy

plugins {
id 'com.android.application'
id 'org.jetbrains.kotlin.android'
}
android {
namespace 'com.thefeed.android'
compileSdk 35
defaultConfig {
applicationId 'com.thefeed.android'
minSdk 26
targetSdk 35
// versionCode auto-increments from git commit count so each build can be installed over the previous one
versionCode = { ->
try {
"git rev-list --count HEAD".execute([], rootDir).text.trim().toInteger()
} catch (ignored) {
1
}
}()
versionName = { ->
try {
def tag = "git describe --tags --always --dirty".execute([], rootDir).text.trim()
tag ?: "dev"
} catch (ignored) {
"dev"
}
}()
testInstrumentationRunner 'androidx.test.runner.AndroidJUnitRunner'
}
signingConfigs {
// For CI: set env vars KEYSTORE_BASE64, KEYSTORE_PASSWORD, KEY_ALIAS, KEY_PASSWORD
// For local: put keystore.jks next to this file and set the same env vars
// If neither is set, falls back to the Android debug key so every build has a consistent signature.
release {
def ksFile = file("keystore.jks")
def ksBase64 = System.getenv("KEYSTORE_BASE64")
if (ksBase64) {
// Decode base64 keystore from env var and write it to disk for Gradle to use
ksFile.bytes = Base64.decoder.decode(ksBase64)
storeFile ksFile
storePassword System.getenv("KEYSTORE_PASSWORD") ?: ""
keyAlias System.getenv("KEY_ALIAS") ?: "thefeed"
keyPassword System.getenv("KEY_PASSWORD") ?: ""
} else if (ksFile.exists()) {
storeFile ksFile
storePassword System.getenv("KEYSTORE_PASSWORD") ?: ""
keyAlias System.getenv("KEY_ALIAS") ?: "thefeed"
keyPassword System.getenv("KEY_PASSWORD") ?: ""
} else {
// No release keystore available — use debug key for consistent local builds
def debugStore = new File(System.getProperty("user.home"), ".android/debug.keystore")
storeFile debugStore
storePassword "android"
keyAlias "androiddebugkey"
keyPassword "android"
}
}
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
signingConfig signingConfigs.release
}
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_17
targetCompatibility JavaVersion.VERSION_17
}
kotlinOptions {
jvmTarget = '17'
}
}
dependencies {
implementation 'androidx.core:core-ktx:1.15.0'
implementation 'androidx.appcompat:appcompat:1.7.0'
implementation 'com.google.android.material:material:1.12.0'
implementation 'androidx.activity:activity-ktx:1.10.1'
}