plugins { alias(libs.plugins.android.application) alias(libs.plugins.kotlin.compose) } /** * Copies the sound packs of an installed TeamSpeak 3 client into the app's assets, as the * desktop client borrows them from the installation. They are TeamSpeak's and not in the * repository; a build without the client ships no packs. */ abstract class BundleSoundPacks : DefaultTask() { @get:InputFiles @get:PathSensitive(PathSensitivity.RELATIVE) abstract val packs: DirectoryProperty @get:OutputDirectory abstract val assets: DirectoryProperty @TaskAction fun copy() { val out = assets.get().asFile out.deleteRecursively() val source = packs.get().asFile if (!source.isDirectory) { logger.warn("No TeamSpeak 3 sound packs at $source; the app ships without sounds") return } source.copyRecursively(File(out, "sound")) } } val ts3ClientDir: String = providers.gradleProperty("ts3.client.dir") .orElse(providers.environmentVariable("TS3_CLIENT_DIR")) .getOrElse(rootDir.resolve("../TeamSpeak3-Client-linux_amd64").path) val bundleSoundPacks = tasks.register("bundleSoundPacks") { packs.set(File(ts3ClientDir, "sound")) assets.set(layout.buildDirectory.dir("generated/soundPacks")) } androidComponents { onVariants { variant -> variant.sources.assets?.addGeneratedSourceDirectory(bundleSoundPacks, BundleSoundPacks::assets) } } android { namespace = "com.ts3client.android" compileSdk = 37 ndkVersion = "30.0.16248370" defaultConfig { applicationId = "com.ts3client.android" minSdk = 33 targetSdk = 36 versionCode = 1 versionName = "0.1.0" ndk { abiFilters += listOf("arm64-v8a", "x86_64") } } buildTypes { release { isMinifyEnabled = true isShrinkResources = true proguardFiles(getDefaultProguardFile("proguard-android-optimize.txt"), "proguard-rules.pro") } } buildFeatures { compose = true } compileOptions { sourceCompatibility = JavaVersion.VERSION_17 targetCompatibility = JavaVersion.VERSION_17 } packaging { resources { // BouncyCastle ships Java 9+ module metadata Android has no use for. excludes += "META-INF/versions/9/OSGI-INF/MANIFEST.MF" } } } dependencies { implementation(project(":audio")) implementation(platform(libs.androidx.compose.bom)) implementation(libs.androidx.compose.ui) implementation(libs.androidx.compose.material3) implementation(libs.androidx.compose.material.icons) implementation(libs.androidx.activity.compose) implementation(libs.androidx.lifecycle.runtime.compose) implementation(libs.androidx.lifecycle.service) implementation(libs.androidsvg) }