mirror of
https://github.com/sartoopjj/thefeed.git
synced 2026-05-19 08:44:34 +03:00
86 lines
2.9 KiB
Groovy
86 lines
2.9 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")
|
|
if (System.getenv("KEYSTORE_BASE64")) {
|
|
// CI decodes keystore from secret
|
|
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'
|
|
}
|