import com.android.build.gradle.internal.tasks.factory.dependsOn import org.jetbrains.kotlin.gradle.dsl.JvmTarget import org.jetbrains.kotlin.gradle.dsl.KotlinVersion plugins { alias(libs.plugins.android.application) alias(libs.plugins.kotlin.android) alias(libs.plugins.ksp) alias(libs.plugins.hilt) alias(libs.plugins.kotlin.serialization) alias(libs.plugins.kotlin.parcelize) } android { val latestVersionName = "0.6.6" namespace = "com.looker.droidify" buildToolsVersion = "35.0.0" compileSdk = 35 defaultConfig { minSdk = 23 targetSdk = 35 applicationId = "com.looker.droidify" versionCode = 660 versionName = latestVersionName vectorDrawables.useSupportLibrary = true testInstrumentationRunner = "com.looker.droidify.TestRunner" } compileOptions.isCoreLibraryDesugaringEnabled = true kotlinOptions.freeCompilerArgs = listOf("-opt-in=kotlin.RequiresOptIn", "-Xcontext-parameters") androidResources.generateLocaleConfig = true kotlin { jvmToolchain(17) compilerOptions { languageVersion.set(KotlinVersion.KOTLIN_2_2) apiVersion.set(KotlinVersion.KOTLIN_2_2) jvmTarget.set(JvmTarget.JVM_17) } } ksp { arg("room.schemaLocation", "$projectDir/schemas") arg("room.generateKotlin", "true") } buildTypes { debug { applicationIdSuffix = ".debug" resValue("string", "application_name", "Droid-ify-Debug") } release { isMinifyEnabled = true isShrinkResources = true resValue("string", "application_name", "Droid-ify") proguardFiles( getDefaultProguardFile("proguard-android-optimize.txt"), "proguard.pro", ) } create("alpha") { initWith(getByName("debug")) applicationIdSuffix = ".alpha" resValue("string", "application_name", "Droid-ify Alpha") proguardFiles( getDefaultProguardFile("proguard-android-optimize.txt"), "proguard.pro", ) isDebuggable = true isMinifyEnabled = true } all { buildConfigField( type = "String", name = "VERSION_NAME", value = "\"v$latestVersionName\"", ) } } packaging { resources { excludes += listOf( "/DebugProbesKt.bin", "/kotlin/**.kotlin_builtins", "/kotlin/**.kotlin_metadata", "/META-INF/**.kotlin_module", "/META-INF/**.pro", "/META-INF/**.version", "/META-INF/{AL2.0,LGPL2.1,LICENSE*}", "/META-INF/versions/9/previous-**.bin", ) } } buildFeatures { resValues = true viewBinding = true buildConfig = true } dependenciesInfo { includeInApk = false includeInBundle = false } } dependencies { coreLibraryDesugaring(libs.desugaring) implementation(libs.material) implementation(libs.core.ktx) implementation(libs.activity) implementation(libs.appcompat) implementation(libs.fragment.ktx) implementation(libs.lifecycle.viewModel) implementation(libs.recyclerview) implementation(libs.sqlite.ktx) implementation(libs.image.viewer) implementation(libs.bundles.coil) implementation(libs.datastore.core) implementation(libs.datastore.proto) implementation(libs.kotlin.stdlib) implementation(libs.datetime) implementation(libs.bundles.coroutines) implementation(libs.libsu.core) implementation(libs.bundles.shizuku) implementation(libs.jackson.core) implementation(libs.serialization) implementation(libs.bundles.ktor) implementation(libs.bundles.room) ksp(libs.room.compiler) implementation(libs.work.ktx) implementation(libs.hilt.core) implementation(libs.hilt.android) implementation(libs.hilt.ext.work) ksp(libs.hilt.compiler) ksp(libs.hilt.ext.compiler) testImplementation(platform(libs.junit.bom)) testImplementation(libs.bundles.test.unit) testRuntimeOnly(libs.junit.platform) androidTestImplementation(libs.hilt.test) androidTestImplementation(libs.room.test) androidTestImplementation(libs.bundles.test.android) kspAndroidTest(libs.hilt.compiler) // debugImplementation(libs.leakcanary) } // using a task as a preBuild dependency instead of a function that takes some time insures that it runs // in /res are (almost) all languages that have a translated string is saved. this is safer and saves some time task("detectAndroidLocals") { val langsList: MutableSet = HashSet() // in /res are (almost) all languages that have a translated string is saved. this is safer and saves some time fileTree("src/main/res").visit { if (this.file.path.endsWith("strings.xml") && this.file.canonicalFile.readText().contains("