Files
Avtex/apps/mobile/app/build.gradle.kts
T

138 lines
4.2 KiB
Kotlin

plugins {
alias(libs.plugins.android.application)
alias(libs.plugins.compose.compiler)
alias(libs.plugins.kotlin.serialization)
}
android {
namespace = "com.example.avtex"
compileSdk = 36
defaultConfig {
applicationId = "com.example.avtex"
minSdk = 26
targetSdk = 36
versionCode = 5
versionName = "1.4"
}
signingConfigs {
create("release") {
storeFile = file("release.keystore")
storePassword = "avtex_release_key"
keyAlias = "avtex"
keyPassword = "avtex_release_key"
enableV1Signing = true
enableV2Signing = true
}
}
buildTypes {
release {
isMinifyEnabled = false
signingConfig = signingConfigs.getByName("release")
proguardFiles(getDefaultProguardFile("proguard-android-optimize.txt"), "proguard-rules.pro")
}
}
compileOptions {
sourceCompatibility = JavaVersion.VERSION_17
targetCompatibility = JavaVersion.VERSION_17
}
buildFeatures {
compose = true
aidl = false
buildConfig = true
shaders = false
}
packaging {
resources {
excludes += "/META-INF/{AL2.0,LGPL2.1}"
}
}
lint {
abortOnError = false
checkReleaseBuilds = false
}
}
kotlin {
jvmToolchain(17)
}
dependencies {
val composeBom = platform(libs.androidx.compose.bom)
implementation(composeBom)
androidTestImplementation(composeBom)
// Core Android dependencies
implementation(libs.androidx.core.ktx)
implementation(libs.androidx.lifecycle.runtime.ktx)
implementation(libs.androidx.activity.compose)
// Arch Components
implementation(libs.androidx.lifecycle.runtime.compose)
implementation(libs.androidx.lifecycle.viewmodel.compose)
// Compose
implementation(libs.androidx.compose.ui)
implementation(libs.androidx.compose.ui.tooling.preview)
implementation(libs.androidx.compose.material3)
implementation(libs.androidx.compose.material.icons.extended)
// Tooling
debugImplementation(libs.androidx.compose.ui.tooling)
// Instrumented tests
androidTestImplementation(libs.androidx.compose.ui.test.junit4)
debugImplementation(libs.androidx.compose.ui.test.manifest)
// Local tests: jUnit, coroutines, Android runner
testImplementation(libs.junit)
testImplementation(libs.kotlinx.coroutines.test)
// Instrumented tests: jUnit rules and runners
androidTestImplementation(libs.androidx.test.core)
androidTestImplementation(libs.androidx.test.ext.junit)
androidTestImplementation(libs.androidx.test.runner)
androidTestImplementation(libs.androidx.test.espresso.core)
// Navigation
implementation(libs.androidx.navigation3.ui)
implementation(libs.androidx.navigation3.runtime)
implementation(libs.androidx.lifecycle.viewmodel.navigation3)
// Sleep API & Location
implementation(libs.play.services.location)
// Home Assistant HTTP client
implementation(libs.okhttp)
// DataStore for settings
implementation(libs.androidx.datastore.preferences)
}
// Автоматическое копирование релизного APK на рабочий стол пользователя после сборки
val desktopDir = File(System.getProperty("user.home"), "Desktop")
tasks.register("copyReleaseApkToDesktop") {
notCompatibleWithConfigurationCache("Copies APK to user Desktop")
doLast {
val userHome = System.getProperty("user.home")
val desktopDir = File(userHome, "Desktop")
if (desktopDir.exists() && desktopDir.isDirectory) {
val apkFile = layout.buildDirectory.file("outputs/apk/release/app-release.apk").get().asFile
if (apkFile.exists()) {
val vName = android.defaultConfig.versionName ?: "release"
apkFile.copyTo(File(desktopDir, "Avtex-v${vName}.apk"), overwrite = true)
apkFile.copyTo(File(desktopDir, "Avtex-release.apk"), overwrite = true)
println(">>> [AUTO-DEPLOY] Релизный APK скопирован на Рабочий стол: Avtex-v${vName}.apk и Avtex-release.apk")
}
}
}
}
afterEvaluate {
tasks.findByName("assembleRelease")?.finalizedBy("copyReleaseApkToDesktop")
}