Java/Kotlin sources move from com.ts3client to eu.lixko.ts3j.client, and the Android application id becomes eu.lixko.ts3j.client. The product name shows as "TeamSpook TS3j" in window titles, the tray, the launcher entries, notifications and PipeWire streams. The desktop profile directory, WM_CLASS and ts3j.* system properties keep their names so existing settings and launchers carry on working. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
160 lines
5.0 KiB
Kotlin
160 lines
5.0 KiB
Kotlin
import java.util.Properties
|
|
|
|
plugins {
|
|
alias(libs.plugins.android.application)
|
|
alias(libs.plugins.kotlin.compose)
|
|
}
|
|
|
|
/**
|
|
* Puts the sound packs of an installed TeamSpeak 3 client into the app's assets, as the
|
|
* desktop client borrows them from the installation, with the sounds encoded as Opus
|
|
* (a fifteenth of the WAVs). 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
|
|
|
|
/** The desktop code whose libopus does the encoding. */
|
|
@get:Classpath
|
|
abstract val encoder: ConfigurableFileCollection
|
|
|
|
@get:OutputDirectory
|
|
abstract val assets: DirectoryProperty
|
|
|
|
@get:Inject
|
|
abstract val exec: ExecOperations
|
|
|
|
@TaskAction
|
|
fun encode() {
|
|
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
|
|
}
|
|
exec.javaexec {
|
|
classpath = encoder
|
|
mainClass.set("eu.lixko.ts3j.client.audio.desktop.EncodeSoundPacks")
|
|
jvmArgs("--enable-native-access=ALL-UNNAMED")
|
|
args(source.path, File(out, "sound").path)
|
|
}
|
|
}
|
|
}
|
|
|
|
val soundPackEncoder: Configuration by configurations.creating {
|
|
isCanBeConsumed = false
|
|
attributes {
|
|
attribute(Usage.USAGE_ATTRIBUTE, objects.named(Usage.JAVA_RUNTIME))
|
|
attribute(LibraryElements.LIBRARY_ELEMENTS_ATTRIBUTE, objects.named(LibraryElements.JAR))
|
|
}
|
|
}
|
|
|
|
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>("bundleSoundPacks") {
|
|
packs.set(File(ts3ClientDir, "sound"))
|
|
encoder.from(soundPackEncoder)
|
|
assets.set(layout.buildDirectory.dir("generated/soundPacks"))
|
|
}
|
|
|
|
androidComponents {
|
|
onVariants { variant ->
|
|
variant.sources.assets?.addGeneratedSourceDirectory(bundleSoundPacks, BundleSoundPacks::assets)
|
|
}
|
|
}
|
|
|
|
/**
|
|
* Release signing from keystore.properties (storeFile, storePassword, keyAlias, keyPassword),
|
|
* kept out of the repository; without it the release APK is left unsigned.
|
|
*/
|
|
val releaseKeystore = rootDir.resolve("keystore.properties").takeIf { it.isFile }?.let { file ->
|
|
Properties().apply { file.inputStream().use(::load) }
|
|
}
|
|
|
|
android {
|
|
namespace = "eu.lixko.ts3j.client.android"
|
|
compileSdk = 37
|
|
ndkVersion = "30.0.16248370"
|
|
|
|
defaultConfig {
|
|
applicationId = "eu.lixko.ts3j.client"
|
|
minSdk = 33
|
|
targetSdk = 36
|
|
versionCode = 1
|
|
versionName = "0.1.0"
|
|
}
|
|
|
|
signingConfigs {
|
|
if (releaseKeystore != null) {
|
|
create("release") {
|
|
storeFile = file(releaseKeystore.getProperty("storeFile"))
|
|
storePassword = releaseKeystore.getProperty("storePassword")
|
|
keyAlias = releaseKeystore.getProperty("keyAlias")
|
|
keyPassword = releaseKeystore.getProperty("keyPassword")
|
|
}
|
|
}
|
|
}
|
|
|
|
// One APK per ABI for releases; debug builds stay a single APK for both.
|
|
splits {
|
|
abi {
|
|
isEnable = gradle.startParameter.taskNames.any { it.contains("Release") }
|
|
reset()
|
|
include("arm64-v8a", "x86_64")
|
|
isUniversalApk = false
|
|
}
|
|
}
|
|
|
|
buildTypes {
|
|
release {
|
|
signingConfig = signingConfigs.findByName("release")
|
|
isMinifyEnabled = true
|
|
isShrinkResources = true
|
|
proguardFiles(getDefaultProguardFile("proguard-android-optimize.txt"), "proguard-rules.pro")
|
|
}
|
|
}
|
|
|
|
androidResources {
|
|
// The app is English only; drops the libraries' translations.
|
|
localeFilters += "en"
|
|
}
|
|
|
|
buildFeatures {
|
|
compose = true
|
|
}
|
|
|
|
compileOptions {
|
|
sourceCompatibility = JavaVersion.VERSION_17
|
|
targetCompatibility = JavaVersion.VERSION_17
|
|
}
|
|
|
|
packaging {
|
|
// Compressed in the APK, which then is smaller to send; extracted on install.
|
|
dex.useLegacyPackaging = true
|
|
jniLibs.useLegacyPackaging = true
|
|
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"))
|
|
soundPackEncoder(project(":desktop"))
|
|
|
|
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)
|
|
}
|