mirror of
https://github.com/amnezia-vpn/amnezia-client.git
synced 2026-05-08 14:33:23 +00:00
Move to gradle kotlin DSL Use gradle version catalog All android build parameters are set via cmake files Use gradle abi split to build APKs Improve local development in the android project folder
93 lines
2.6 KiB
Plaintext
93 lines
2.6 KiB
Plaintext
plugins {
|
|
alias(libs.plugins.android.application)
|
|
alias(libs.plugins.kotlin.android)
|
|
id("property-delegate")
|
|
}
|
|
|
|
kotlin {
|
|
jvmToolchain(17)
|
|
}
|
|
|
|
// get values from gradle or local properties
|
|
val qtTargetSdkVersion: String by gradleProperties
|
|
val qtTargetAbiList: String by gradleProperties
|
|
val qtAndroidDir: String by gradleProperties
|
|
|
|
android {
|
|
namespace = "org.amnezia.vpn"
|
|
|
|
buildFeatures {
|
|
buildConfig = true
|
|
viewBinding = true
|
|
}
|
|
|
|
androidResources {
|
|
// don't compress Qt binary resources file
|
|
noCompress += "rcc"
|
|
}
|
|
|
|
packaging {
|
|
// compress .so binary libraries
|
|
jniLibs.useLegacyPackaging = true
|
|
}
|
|
|
|
defaultConfig {
|
|
applicationId = "org.amnezia.vpn"
|
|
targetSdk = qtTargetSdkVersion.toInt()
|
|
|
|
// keeps language resources for only the locales specified below
|
|
resourceConfigurations += listOf("en", "ru", "b+zh+Hans")
|
|
}
|
|
|
|
sourceSets {
|
|
getByName("main") {
|
|
manifest.srcFile("AndroidManifest.xml")
|
|
java.setSrcDirs(listOf("$qtAndroidDir/src", "src"))
|
|
res.setSrcDirs(listOf("$qtAndroidDir/res", "res"))
|
|
assets.setSrcDirs(listOf("assets"))
|
|
jniLibs.setSrcDirs(listOf("libs"))
|
|
}
|
|
}
|
|
|
|
signingConfigs {
|
|
register("release") {
|
|
storeFile = providers.environmentVariable("ANDROID_KEYSTORE_PATH").orNull?.let { file(it) }
|
|
storePassword = providers.environmentVariable("ANDROID_KEYSTORE_KEY_PASS").orNull
|
|
keyAlias = providers.environmentVariable("ANDROID_KEYSTORE_KEY_ALIAS").orNull
|
|
keyPassword = providers.environmentVariable("ANDROID_KEYSTORE_KEY_PASS").orNull
|
|
}
|
|
}
|
|
|
|
buildTypes {
|
|
release {
|
|
// exclude coroutine debug resource from release build
|
|
packaging {
|
|
resources.excludes += "DebugProbesKt.bin"
|
|
}
|
|
signingConfig = signingConfigs["release"]
|
|
}
|
|
}
|
|
|
|
splits {
|
|
abi {
|
|
isEnable = true
|
|
reset()
|
|
include(*qtTargetAbiList.split(',').toTypedArray())
|
|
isUniversalApk = false
|
|
}
|
|
}
|
|
}
|
|
|
|
dependencies {
|
|
implementation(fileTree(mapOf("dir" to "libs", "include" to listOf("*.jar", "*.aar"))))
|
|
implementation(libs.androidx.core)
|
|
implementation(libs.androidx.appcompat)
|
|
implementation(libs.androidx.security.crypto)
|
|
implementation(libs.kotlinx.coroutines)
|
|
implementation(libs.bundles.androidx.camera)
|
|
implementation(libs.google.mlkit)
|
|
implementation(project(":shadowsocks"))
|
|
// todo: remove after finish refactoring
|
|
implementation(libs.androidx.constraintlayout)
|
|
}
|