import org.jetbrains.kotlin.gradle.dsl.JvmTarget plugins { kotlin("jvm") version "2.1.20" kotlin("plugin.serialization") version "2.1.20" application id("com.gradleup.shadow") version "8.3.6" } group = "win.taptap" version = "0.1.0" repositories { mavenCentral() } kotlin { jvmToolchain(21) compilerOptions { jvmTarget.set(JvmTarget.JVM_21) } } application { mainClass.set("win.taptap.musicmanager.ApplicationKt") } dependencies { // Ktor implementation("io.ktor:ktor-server-core-jvm:3.1.2") implementation("io.ktor:ktor-server-netty-jvm:3.1.2") implementation("io.ktor:ktor-server-content-negotiation-jvm:3.1.2") implementation("io.ktor:ktor-serialization-kotlinx-json-jvm:3.1.2") implementation("io.ktor:ktor-server-partial-content-jvm:3.1.2") implementation("io.ktor:ktor-server-status-pages-jvm:3.1.2") implementation("io.ktor:ktor-server-call-logging-jvm:3.1.2") implementation("io.ktor:ktor-server-auto-head-response-jvm:3.1.2") implementation("io.ktor:ktor-server-cors-jvm:3.1.2") implementation("io.ktor:ktor-server-call-id-jvm:3.1.2") // Database implementation("org.jetbrains.exposed:exposed-core:0.60.0") implementation("org.jetbrains.exposed:exposed-jdbc:0.60.0") implementation("org.jetbrains.exposed:exposed-java-time:0.60.0") implementation("org.xerial:sqlite-jdbc:3.49.1.0") implementation("com.zaxxer:HikariCP:6.2.1") implementation("org.flywaydb:flyway-core:11.8.2") // Media implementation("net.jthink:jaudiotagger:3.0.1") implementation("net.coobird:thumbnailator:0.4.20") // Config & logging implementation("org.yaml:snakeyaml:2.7") implementation("ch.qos.logback:logback-classic:1.5.17") implementation("io.github.oshai:kotlin-logging-jvm:7.0.0") implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core:1.10.1") // Tests testImplementation("io.ktor:ktor-server-test-host-jvm:3.1.2") testImplementation(kotlin("test-junit5")) testImplementation("org.junit.jupiter:junit-jupiter:5.11.4") } tasks.test { useJUnitPlatform() testLogging { events("passed", "skipped", "failed") } } /** * Prepares a local development checkout: creates the data/media directories and * copies the example users file when it is missing. Existing files are never * overwritten. */ val setupLocal by tasks.registering { group = "application" description = "Create local data folders and copy the example users config if missing." doLast { project.mkdir("data/media") project.mkdir("data/downloads") val target = project.file("config/users.yaml") val example = project.file("config/users.example.yaml") if (!target.exists()) { target.parentFile.mkdirs() example.copyTo(target) println("Created config/users.yaml from config/users.example.yaml") } else { println("Keeping existing config/users.yaml") } } } tasks.named("run") { dependsOn(setupLocal) } tasks.withType().configureEach { options.encoding = "UTF-8" } tasks.shadowJar { archiveClassifier.set("all") mergeServiceFiles() } tasks.build { dependsOn(tasks.shadowJar) }