Integrate shared C transport with desktop and Android frontends, add radio probes and detailed Windows diagnostics, and fix GUI build dependencies and early configuration startup errors.
124 lines
5.2 KiB
Kotlin
124 lines
5.2 KiB
Kotlin
plugins {
|
||
id("com.android.application")
|
||
id("org.jetbrains.kotlin.android")
|
||
id("org.jetbrains.kotlin.plugin.compose")
|
||
}
|
||
|
||
// Фон берём из desktop-чатгуи; drawable-nodpi сохраняет исходный размер плитки.
|
||
val prepareChatBackground by tasks.registering(Copy::class) {
|
||
from("../../chatgui/resources/bg.png")
|
||
into(layout.buildDirectory.dir("generated/chatBackground/res/drawable-nodpi"))
|
||
rename { "chat_background.png" }
|
||
}
|
||
tasks.named("preBuild") { dependsOn(prepareChatBackground) }
|
||
|
||
// Общий комплект лицензий ядра и встроенных библиотек включается в каждый APK.
|
||
val prepareLicenses by tasks.registering(Sync::class) {
|
||
from("../../..") { include("LICENSE", "LICENSING", "THIRD_PARTY_NOTICES") }
|
||
into(layout.buildDirectory.dir("generated/licenses/assets/licenses"))
|
||
doLast { logger.lifecycle("uTun license documents prepared for APK assets/licenses") }
|
||
}
|
||
tasks.named("preBuild") { dependsOn(prepareLicenses) }
|
||
|
||
android {
|
||
namespace = "com.utun.chat"
|
||
compileSdk = 36
|
||
ndkVersion = "29.0.14206865"
|
||
|
||
compileOptions {
|
||
sourceCompatibility = JavaVersion.VERSION_17
|
||
targetCompatibility = JavaVersion.VERSION_17
|
||
}
|
||
|
||
kotlinOptions {
|
||
jvmTarget = "17"
|
||
}
|
||
|
||
defaultConfig {
|
||
applicationId = "com.utun.chat"
|
||
testInstrumentationRunner = "com.utun.chat.BlePeerProbe"
|
||
minSdk = 26
|
||
targetSdk = 36
|
||
versionCode = 1
|
||
versionName = "0.1.0"
|
||
|
||
externalNativeBuild {
|
||
cmake {
|
||
arguments("-DANDROID_STL=c++_static")
|
||
}
|
||
}
|
||
ndk {
|
||
abiFilters += listOf("arm64-v8a", "x86_64")
|
||
}
|
||
}
|
||
|
||
buildFeatures {
|
||
compose = true
|
||
buildConfig = true
|
||
}
|
||
|
||
// Общие TGS-анимации с desktop-чатгуи, без копирования ресурсов.
|
||
sourceSets["main"].assets.srcDir("../../chatgui/resources/animations")
|
||
sourceSets["main"].assets.srcDir(layout.buildDirectory.dir("generated/licenses/assets"))
|
||
sourceSets["main"].res.srcDir(layout.buildDirectory.dir("generated/chatBackground/res"))
|
||
|
||
externalNativeBuild {
|
||
cmake {
|
||
path = file("src/main/cpp/CMakeLists.txt")
|
||
}
|
||
}
|
||
|
||
buildTypes {
|
||
release {
|
||
isMinifyEnabled = false
|
||
}
|
||
}
|
||
}
|
||
|
||
// Настоящий JNI callback с отказами JVM; Linux host нужен для ELF --gc-sections, NDK ABI отдельно проверяет сборка APK.
|
||
val testJniLog by tasks.registering(Exec::class) {
|
||
onlyIf("JNI host test requires Linux") { System.getProperty("os.name").startsWith("Linux") }
|
||
workingDir(rootProject.projectDir)
|
||
commandLine("python3", rootProject.file("tests/jni_log/run.py"), "--java-home", System.getProperty("java.home"))
|
||
}
|
||
|
||
// Зависимость только между задачами: host-модели не входят в classpath приложения/APK.
|
||
tasks.withType<org.gradle.api.tasks.testing.Test>().configureEach {
|
||
dependsOn(":router-tests:test", ":capture-tests:test", ":language-tests:test", testJniLog)
|
||
val messageLinkCases = rootProject.file("../chatgui/tests/message_links_cases.tsv")
|
||
inputs.file(messageLinkCases)
|
||
systemProperty("utun.messageLinkCases", messageLinkCases.absolutePath)
|
||
val eventHeader = rootProject.file("../../src/chat/chat_event.h")
|
||
val bridgeSource = rootProject.file("jni_bridge/android_jni_bridge.c")
|
||
inputs.files(eventHeader, bridgeSource)
|
||
systemProperty("utun.chatEventHeader", eventHeader.absolutePath)
|
||
systemProperty("utun.androidBridgeSource", bridgeSource.absolutePath)
|
||
}
|
||
|
||
dependencies {
|
||
testImplementation("junit:junit:4.13.2")
|
||
testImplementation("org.json:json:20240303") // Реальный JSON для проверки границы JNI, без Android mock stubs.
|
||
implementation(platform("androidx.compose:compose-bom:2024.02.00"))
|
||
implementation("androidx.compose.ui:ui")
|
||
implementation("androidx.compose.ui:ui-tooling-preview")
|
||
implementation("androidx.compose.material3:material3")
|
||
implementation("androidx.compose.material:material-icons-extended")
|
||
implementation("androidx.compose.foundation:foundation")
|
||
implementation("com.airbnb.android:lottie-compose:6.3.0")
|
||
implementation("androidx.activity:activity-compose:1.8.2")
|
||
implementation("androidx.appcompat:appcompat:1.7.1")
|
||
implementation("androidx.core:core-ktx:1.15.0")
|
||
implementation("androidx.lifecycle:lifecycle-viewmodel-compose:2.7.0")
|
||
implementation("androidx.lifecycle:lifecycle-runtime-compose:2.7.0")
|
||
implementation("androidx.datastore:datastore-preferences:1.0.0")
|
||
implementation("org.jetbrains.kotlinx:kotlinx-coroutines-android:1.7.3")
|
||
implementation("com.google.code.gson:gson:2.10.1")
|
||
implementation("com.google.mlkit:barcode-scanning:17.3.0")
|
||
implementation("com.google.zxing:core:3.5.3")
|
||
val cameraXVersion = "1.7.0-rc01"
|
||
implementation("androidx.camera:camera-camera2:$cameraXVersion")
|
||
implementation("androidx.camera:camera-lifecycle:$cameraXVersion")
|
||
implementation("androidx.camera:camera-view:$cameraXVersion")
|
||
implementation("androidx.camera:camera-video:$cameraXVersion")
|
||
}
|