Files
EdgeX_change/app/build.gradle.kts
DelLevin-Home a9085ad83f 首次提交
2026-08-16 13:44:35 +08:00

120 lines
4.0 KiB
Kotlin

import java.util.Properties
plugins {
alias(libs.plugins.android.application)
alias(libs.plugins.kotlin.android)
alias(libs.plugins.kotlin.compose)
}
val localProperties = Properties().apply {
val file = rootProject.file("local.properties")
if (file.exists()) {
file.inputStream().use(::load)
}
}
fun buildConfigString(value: String): String =
"\"" + value.replace("\\", "\\\\").replace("\"", "\\\"") + "\""
val premiumApiUrls = localProperties.getProperty("PREMIUM_API_URLS")
?: System.getenv("PREMIUM_API_URLS")
?: "https://activation-server-production-29da.up.railway.app"
android {
namespace = Configs.namespace
compileSdk = Configs.compileSdk
buildFeatures {
buildConfig = true
aidl = true
compose = true
}
defaultConfig {
applicationId = Configs.applicationId
minSdk = Configs.minSdk
targetSdk = Configs.targetSdk
versionCode = System.getenv("VERSION_CODE")?.toIntOrNull() ?: Configs.versionCode
versionName = System.getenv("VERSION_NAME") ?: Configs.versionName
buildConfigField(
"String",
"PREMIUM_API_URLS",
buildConfigString(premiumApiUrls)
)
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
}
signingConfigs {
getByName("debug") {
enableV1Signing = true
enableV2Signing = true
enableV3Signing = true
enableV4Signing = true
}
create("release") {
val keyPath = localProperties.getProperty("RELEASE_STORE_FILE")
if (keyPath != null) {
storeFile = file(keyPath)
storePassword = localProperties.getProperty("RELEASE_STORE_PASSWORD")
keyAlias = localProperties.getProperty("RELEASE_KEY_ALIAS")
keyPassword = localProperties.getProperty("RELEASE_KEY_PASSWORD")
} else {
// Fallback to debug signature for community contributors building a release
storeFile = getByName("debug").storeFile
storePassword = getByName("debug").storePassword
keyAlias = getByName("debug").keyAlias
keyPassword = getByName("debug").keyPassword
}
enableV1Signing = true
enableV2Signing = true
enableV3Signing = true
enableV4Signing = true
}
}
buildTypes {
release {
signingConfig = signingConfigs.getByName("release")
isMinifyEnabled = true
isShrinkResources = true
proguardFiles(
getDefaultProguardFile("proguard-android-optimize.txt"),
"proguard-rules.pro"
)
}
}
compileOptions {
sourceCompatibility = Configs.javaVersion
targetCompatibility = Configs.javaVersion
}
kotlinOptions {
jvmTarget = Configs.jvmTarget
}
}
dependencies {
compileOnly("de.robv.android.xposed:api:82")
implementation(project(":premium-api"))
implementation("com.github.topjohnwu.libsu:core:6.0.0")
implementation(libs.androidx.core.ktx)
implementation(libs.androidx.activity.compose)
implementation(platform(libs.androidx.compose.bom))
implementation(libs.androidx.compose.foundation)
implementation(libs.androidx.compose.material3)
implementation(libs.androidx.compose.ui)
implementation(libs.androidx.compose.ui.tooling.preview)
implementation(libs.androidx.appcompat)
implementation(libs.material)
debugImplementation(libs.androidx.compose.ui.tooling)
debugImplementation(libs.androidx.compose.ui.test.manifest)
testImplementation(libs.junit)
androidTestImplementation(libs.androidx.junit)
androidTestImplementation(libs.androidx.test.runner)
androidTestImplementation(libs.androidx.test.rules)
androidTestImplementation(libs.androidx.espresso.core)
androidTestImplementation(platform(libs.androidx.compose.bom))
androidTestImplementation(libs.androidx.compose.ui.test.junit4)
}