Files
Contacts/app/build.gradle.kts
Naveen Singh 5fa2c3abfe chore: ignore extra translations and update detekt rules
* chore: ignore extra translations in lint

Extra translations are removed automatically by Weblate

* chore: update detekt rules

More compose-friendly

* chore: update lint baselines
2025-07-03 21:16:21 +05:30

149 lines
4.6 KiB
Kotlin

import org.jetbrains.kotlin.gradle.dsl.JvmTarget
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
import org.jetbrains.kotlin.konan.properties.Properties
import java.io.FileInputStream
plugins {
alias(libs.plugins.android)
alias(libs.plugins.kotlinAndroid)
alias(libs.plugins.ksp)
alias(libs.plugins.detekt)
}
val keystorePropertiesFile: File = rootProject.file("keystore.properties")
val keystoreProperties = Properties()
if (keystorePropertiesFile.exists()) {
keystoreProperties.load(FileInputStream(keystorePropertiesFile))
}
fun hasSigningVars(): Boolean {
return providers.environmentVariable("SIGNING_KEY_ALIAS").orNull != null
&& providers.environmentVariable("SIGNING_KEY_PASSWORD").orNull != null
&& providers.environmentVariable("SIGNING_STORE_FILE").orNull != null
&& providers.environmentVariable("SIGNING_STORE_PASSWORD").orNull != null
}
android {
compileSdk = project.libs.versions.app.build.compileSDKVersion.get().toInt()
defaultConfig {
applicationId = project.property("APP_ID").toString()
minSdk = project.libs.versions.app.build.minimumSDK.get().toInt()
targetSdk = project.libs.versions.app.build.targetSDK.get().toInt()
versionName = project.property("VERSION_NAME").toString()
versionCode = project.property("VERSION_CODE").toString().toInt()
setProperty("archivesBaseName", "contacts-$versionCode")
ksp {
arg("room.schemaLocation", "$projectDir/schemas")
}
}
signingConfigs {
if (keystorePropertiesFile.exists()) {
register("release") {
keyAlias = keystoreProperties.getProperty("keyAlias")
keyPassword = keystoreProperties.getProperty("keyPassword")
storeFile = file(keystoreProperties.getProperty("storeFile"))
storePassword = keystoreProperties.getProperty("storePassword")
}
} else if (hasSigningVars()) {
register("release") {
keyAlias = providers.environmentVariable("SIGNING_KEY_ALIAS").get()
keyPassword = providers.environmentVariable("SIGNING_KEY_PASSWORD").get()
storeFile = file(providers.environmentVariable("SIGNING_STORE_FILE").get())
storePassword = providers.environmentVariable("SIGNING_STORE_PASSWORD").get()
}
} else {
logger.warn("Warning: No signing config found. Build will be unsigned.")
}
}
buildFeatures {
viewBinding = true
buildConfig = true
}
buildTypes {
debug {
applicationIdSuffix = ".debug"
}
release {
isMinifyEnabled = true
isShrinkResources = true
proguardFiles(
getDefaultProguardFile("proguard-android.txt"),
"proguard-rules.pro"
)
if (keystorePropertiesFile.exists() || hasSigningVars()) {
signingConfig = signingConfigs.getByName("release")
}
}
}
flavorDimensions.add("variants")
productFlavors {
register("core")
register("foss")
register("gplay")
}
sourceSets {
getByName("main").java.srcDirs("src/main/kotlin")
}
compileOptions {
val currentJavaVersionFromLibs = JavaVersion.valueOf(libs.versions.app.build.javaVersion.get())
sourceCompatibility = currentJavaVersionFromLibs
targetCompatibility = currentJavaVersionFromLibs
}
dependenciesInfo {
includeInApk = false
}
androidResources {
@Suppress("UnstableApiUsage")
generateLocaleConfig = true
}
tasks.withType<KotlinCompile> {
compilerOptions.jvmTarget.set(
JvmTarget.fromTarget(project.libs.versions.app.build.kotlinJVMTarget.get())
)
}
namespace = project.property("APP_ID").toString()
lint {
checkReleaseBuilds = false
abortOnError = true
warningsAsErrors = false
baseline = file("lint-baseline.xml")
lintConfig = rootProject.file("lint.xml")
}
bundle {
language {
enableSplit = false
}
}
}
detekt {
baseline = file("detekt-baseline.xml")
config.setFrom("$rootDir/detekt.yml")
buildUponDefaultConfig = true
allRules = false
}
dependencies {
implementation(libs.fossify.commons)
implementation(libs.androidx.swiperefreshlayout)
implementation(libs.autofittextview)
implementation(libs.ezvcard)
implementation(libs.indicatorfastscroll)
implementation(libs.bundles.room)
ksp(libs.androidx.room.compiler)
detektPlugins(libs.compose.detekt)
}