105 lines
3.2 KiB
Kotlin
105 lines
3.2 KiB
Kotlin
import java.util.Properties
|
|
import groovy.json.JsonSlurper
|
|
|
|
plugins {
|
|
id("com.android.application")
|
|
id("org.jetbrains.kotlin.android")
|
|
id("rust")
|
|
}
|
|
|
|
val tauriProperties = Properties().apply {
|
|
val propFile = file("tauri.properties")
|
|
if (propFile.exists()) {
|
|
propFile.inputStream().use { load(it) }
|
|
}
|
|
}
|
|
|
|
android {
|
|
compileSdk = 36
|
|
namespace = "com.che.ewa_mobile"
|
|
defaultConfig {
|
|
manifestPlaceholders["usesCleartextTraffic"] = "false"
|
|
applicationId = "com.che.ewa_mobile"
|
|
minSdk = 24
|
|
targetSdk = 36
|
|
versionCode = tauriProperties.getProperty("tauri.android.versionCode", "1").toInt()
|
|
versionName = tauriProperties.getProperty("tauri.android.versionName", "1.0")
|
|
}
|
|
buildTypes {
|
|
getByName("debug") {
|
|
manifestPlaceholders["usesCleartextTraffic"] = "true"
|
|
isDebuggable = true
|
|
isJniDebuggable = true
|
|
isMinifyEnabled = false
|
|
packaging { jniLibs.keepDebugSymbols.add("*/arm64-v8a/*.so")
|
|
jniLibs.keepDebugSymbols.add("*/armeabi-v7a/*.so")
|
|
jniLibs.keepDebugSymbols.add("*/x86/*.so")
|
|
jniLibs.keepDebugSymbols.add("*/x86_64/*.so")
|
|
}
|
|
}
|
|
getByName("release") {
|
|
isMinifyEnabled = true
|
|
proguardFiles(
|
|
*fileTree(".") { include("**/*.pro") }
|
|
.plus(getDefaultProguardFile("proguard-android-optimize.txt"))
|
|
.toList().toTypedArray()
|
|
)
|
|
}
|
|
}
|
|
kotlinOptions {
|
|
jvmTarget = "1.8"
|
|
}
|
|
buildFeatures {
|
|
buildConfig = true
|
|
}
|
|
}
|
|
|
|
repositories {
|
|
maven {
|
|
url = uri(rustlsPlatformVerifierMavenDir())
|
|
metadataSources.artifact()
|
|
}
|
|
}
|
|
|
|
rust {
|
|
rootDirRel = "../../../"
|
|
}
|
|
|
|
dependencies {
|
|
implementation("rustls:rustls-platform-verifier:latest.release")
|
|
implementation("androidx.webkit:webkit:1.14.0")
|
|
implementation("androidx.appcompat:appcompat:1.7.1")
|
|
implementation("androidx.activity:activity-ktx:1.10.1")
|
|
implementation("com.google.android.material:material:1.12.0")
|
|
implementation("androidx.lifecycle:lifecycle-process:2.10.0")
|
|
testImplementation("junit:junit:4.13.2")
|
|
androidTestImplementation("androidx.test.ext:junit:1.1.4")
|
|
androidTestImplementation("androidx.test.espresso:espresso-core:3.5.0")
|
|
}
|
|
|
|
apply(from = "tauri.build.gradle.kts")
|
|
|
|
fun rustlsPlatformVerifierMavenDir(): String {
|
|
val manifestPath = providers.exec {
|
|
commandLine(
|
|
"cargo",
|
|
"metadata",
|
|
"--format-version",
|
|
"1",
|
|
"--filter-platform",
|
|
"aarch64-linux-android",
|
|
"--manifest-path",
|
|
rootProject.file("../../Cargo.toml").absolutePath,
|
|
)
|
|
}.standardOutput.asText.get()
|
|
|
|
val metadata = JsonSlurper().parseText(manifestPath) as Map<*, *>
|
|
val packages = metadata["packages"] as List<*>
|
|
val rustlsAndroidPackage = packages
|
|
.map { it as Map<*, *> }
|
|
.first { it["name"] == "rustls-platform-verifier-android" }
|
|
val rustlsManifest = file(rustlsAndroidPackage["manifest_path"] as String)
|
|
|
|
return File(rustlsManifest.parentFile, "maven").path
|
|
}
|