97 lines
2.9 KiB
Kotlin
97 lines
2.9 KiB
Kotlin
import java.io.File
|
|
import java.util.Properties
|
|
import org.jetbrains.kotlin.gradle.dsl.JvmTarget
|
|
|
|
plugins {
|
|
alias(libs.plugins.android.application)
|
|
alias(libs.plugins.kotlin.android)
|
|
}
|
|
|
|
val releaseSigningProperties = Properties()
|
|
val releaseSigningPropertiesFile = File(
|
|
System.getProperty("user.home"),
|
|
".config/android/release-signing.properties",
|
|
)
|
|
if (releaseSigningPropertiesFile.isFile) {
|
|
releaseSigningPropertiesFile.inputStream().use(releaseSigningProperties::load)
|
|
}
|
|
|
|
val releaseKeystorePath = releaseSigningProperties.getProperty("storeFile")
|
|
val releaseKeyAlias = releaseSigningProperties.getProperty("keyAlias")
|
|
val releaseStorePassword = providers.gradleProperty("androidReleaseStorePassword").orNull
|
|
val releaseKeyPassword = providers.gradleProperty("androidReleaseKeyPassword").orNull
|
|
val hasReleaseSigning = !releaseKeystorePath.isNullOrBlank() &&
|
|
!releaseKeyAlias.isNullOrBlank() &&
|
|
!releaseStorePassword.isNullOrBlank() &&
|
|
!releaseKeyPassword.isNullOrBlank()
|
|
val releaseBuildRequested = gradle.startParameter.taskNames.any { it.contains("release", ignoreCase = true) }
|
|
|
|
if (releaseBuildRequested && !hasReleaseSigning) {
|
|
error(
|
|
"Release signing is not configured. Configure storeFile and keyAlias in " +
|
|
"~/.config/android/release-signing.properties and passwords in ~/.gradle/gradle.properties.",
|
|
)
|
|
}
|
|
|
|
android {
|
|
namespace = "se.ajpanton.notificationlog"
|
|
compileSdk = 36
|
|
|
|
defaultConfig {
|
|
applicationId = "se.ajpanton.notificationlog"
|
|
minSdk = 34
|
|
targetSdk = 36
|
|
versionCode = project.findProperty("notificationLogVersionCode")?.toString()?.toIntOrNull() ?: 1
|
|
versionName = project.findProperty("notificationLogVersionName")?.toString() ?: "0.1"
|
|
|
|
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
|
|
}
|
|
|
|
buildFeatures {
|
|
viewBinding = true
|
|
}
|
|
|
|
signingConfigs {
|
|
if (hasReleaseSigning) {
|
|
create("release") {
|
|
storeFile = file(releaseKeystorePath!!)
|
|
storePassword = releaseStorePassword
|
|
keyAlias = releaseKeyAlias
|
|
keyPassword = releaseKeyPassword
|
|
}
|
|
}
|
|
}
|
|
|
|
buildTypes {
|
|
getByName("release") {
|
|
if (hasReleaseSigning) {
|
|
signingConfig = signingConfigs.getByName("release")
|
|
}
|
|
}
|
|
}
|
|
|
|
compileOptions {
|
|
sourceCompatibility = JavaVersion.VERSION_17
|
|
targetCompatibility = JavaVersion.VERSION_17
|
|
}
|
|
|
|
kotlin {
|
|
compilerOptions {
|
|
jvmTarget.set(JvmTarget.JVM_17)
|
|
}
|
|
}
|
|
}
|
|
|
|
dependencies {
|
|
implementation(libs.appcompat)
|
|
implementation(libs.core.ktx)
|
|
implementation(libs.fragment.ktx)
|
|
implementation(libs.material)
|
|
implementation(libs.drawerlayout)
|
|
implementation(libs.recyclerview)
|
|
implementation(libs.swiperefreshlayout)
|
|
implementation(libs.lifecycle.runtime.ktx)
|
|
|
|
testImplementation(libs.junit)
|
|
}
|