2025-07-04 16:51:17 +02:00
|
|
|
import org.jetbrains.compose.desktop.application.dsl.TargetFormat
|
|
|
|
|
import org.jetbrains.kotlin.gradle.ExperimentalKotlinGradlePluginApi
|
|
|
|
|
import org.jetbrains.kotlin.gradle.dsl.JvmTarget
|
|
|
|
|
import org.jetbrains.kotlin.gradle.plugin.KotlinSourceSet
|
2026-03-17 11:29:44 +03:00
|
|
|
import java.util.Properties
|
2025-07-04 16:51:17 +02:00
|
|
|
|
|
|
|
|
plugins {
|
|
|
|
|
alias(libs.plugins.kotlinMultiplatform)
|
|
|
|
|
alias(libs.plugins.androidApplication)
|
|
|
|
|
alias(libs.plugins.composeMultiplatform)
|
|
|
|
|
alias(libs.plugins.composeCompiler)
|
2026-02-02 14:44:04 +03:00
|
|
|
//alias(libs.plugins.composeHotReload)
|
2025-07-07 15:11:51 +02:00
|
|
|
alias(libs.plugins.kotlinSerialization)
|
2025-07-04 16:51:17 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
kotlin {
|
2026-03-17 11:29:44 +03:00
|
|
|
/*linuxX64 {
|
2026-01-09 08:43:24 +01:00
|
|
|
binaries {
|
|
|
|
|
executable {
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
}
|
2026-03-17 11:29:44 +03:00
|
|
|
}*/
|
2025-07-04 16:51:17 +02:00
|
|
|
androidTarget {
|
|
|
|
|
@OptIn(ExperimentalKotlinGradlePluginApi::class)
|
|
|
|
|
compilerOptions {
|
|
|
|
|
jvmTarget.set(JvmTarget.JVM_11)
|
|
|
|
|
}
|
|
|
|
|
}
|
2026-04-24 11:37:57 +03:00
|
|
|
|
2025-07-04 16:51:17 +02:00
|
|
|
jvm("desktop")
|
2026-01-09 08:43:24 +01:00
|
|
|
|
|
|
|
|
afterEvaluate {
|
|
|
|
|
afterEvaluate {
|
|
|
|
|
tasks.configureEach {
|
|
|
|
|
if (
|
|
|
|
|
name.startsWith("compile")
|
|
|
|
|
&& name.endsWith("KotlinMetadata")
|
|
|
|
|
) {
|
|
|
|
|
println("disabling $name")
|
|
|
|
|
enabled = false
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
2025-07-04 16:51:17 +02:00
|
|
|
sourceSets {
|
|
|
|
|
val desktopMain by getting
|
2026-04-24 11:37:57 +03:00
|
|
|
|
2025-07-04 16:51:17 +02:00
|
|
|
androidMain.dependencies {
|
|
|
|
|
implementation(compose.preview)
|
|
|
|
|
implementation(libs.androidx.activity.compose)
|
|
|
|
|
implementation(libs.koin.android) // Koin Android-specific extensions
|
2025-07-08 11:58:49 +02:00
|
|
|
implementation(libs.koin.androidx.compose)
|
2026-01-09 08:43:24 +01:00
|
|
|
implementation("com.google.zxing:core:3.5.4")
|
2026-03-17 11:29:44 +03:00
|
|
|
implementation("com.github.billthefarmer:mididriver:1.25")
|
2026-04-03 11:30:19 +03:00
|
|
|
implementation("com.tom-roush:pdfbox-android:2.0.27.0")
|
2025-07-04 16:51:17 +02:00
|
|
|
}
|
|
|
|
|
commonMain.dependencies {
|
2026-02-02 14:44:04 +03:00
|
|
|
// implementation(compose.components.resources)
|
2025-07-04 16:51:17 +02:00
|
|
|
implementation(compose.runtime)
|
|
|
|
|
implementation(compose.foundation)
|
|
|
|
|
implementation(compose.material3)
|
|
|
|
|
implementation(compose.ui)
|
|
|
|
|
implementation(compose.components.resources)
|
|
|
|
|
implementation(compose.components.uiToolingPreview)
|
|
|
|
|
implementation(libs.androidx.lifecycle.viewmodel)
|
|
|
|
|
implementation(libs.androidx.lifecycle.runtimeCompose)
|
|
|
|
|
implementation(libs.koin.core) // Koin core for shared logic
|
|
|
|
|
implementation(libs.koin.compose) // Koin for Compose Multiplatform UI
|
2026-02-02 14:44:04 +03:00
|
|
|
implementation(libs.koin.compose.viewmodel) // Koin for KMP ViewModels
|
|
|
|
|
|
2025-07-07 15:11:51 +02:00
|
|
|
implementation(libs.kotlinx.serialization.json)
|
2025-07-09 13:40:23 +02:00
|
|
|
implementation(libs.bundles.voyager)
|
|
|
|
|
implementation(libs.cafe.voyager.koin)
|
2026-06-22 17:31:55 +03:00
|
|
|
implementation(libs.multiplatform.settings)
|
2026-02-02 14:44:04 +03:00
|
|
|
implementation(compose.materialIconsExtended)
|
|
|
|
|
//implementation(kotlin("stdlib-jdk8"))
|
2026-01-09 08:43:24 +01:00
|
|
|
//implementation("org.jetbrains.compose.foundation:foundation-desktop")
|
2026-01-22 11:01:59 +03:00
|
|
|
implementation("com.russhwolf:multiplatform-settings-no-arg:1.3.0")
|
2026-02-02 14:44:04 +03:00
|
|
|
implementation("io.github.pdvrieze.xmlutil:serialization:0.91.3") // Dépendance sous-jacente pour XML
|
2025-09-15 10:37:56 +02:00
|
|
|
//implementation(libs.ktmidi)
|
2025-07-04 16:51:17 +02:00
|
|
|
}
|
|
|
|
|
commonTest.dependencies {
|
|
|
|
|
implementation(libs.kotlin.test)
|
|
|
|
|
}
|
|
|
|
|
desktopMain.dependencies {
|
|
|
|
|
implementation(compose.desktop.currentOs)
|
|
|
|
|
implementation(libs.kotlinx.coroutinesSwing)
|
2026-01-09 08:43:24 +01:00
|
|
|
implementation("com.google.zxing:core:3.5.4")
|
|
|
|
|
implementation("com.google.zxing:javase:3.5.4")
|
2026-04-03 11:30:19 +03:00
|
|
|
implementation("org.apache.pdfbox:pdfbox:3.0.7")
|
2025-07-04 16:51:17 +02:00
|
|
|
}
|
|
|
|
|
}
|
2026-01-28 16:08:50 +03:00
|
|
|
targets.all {
|
|
|
|
|
compilations.all {
|
|
|
|
|
compileTaskProvider.configure {
|
|
|
|
|
compilerOptions {
|
|
|
|
|
freeCompilerArgs.add("-Xexpect-actual-classes")
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
2025-07-04 16:51:17 +02:00
|
|
|
}
|
|
|
|
|
|
2026-07-10 15:19:32 +03:00
|
|
|
compose.resources {
|
|
|
|
|
publicResClass = true
|
|
|
|
|
}
|
2025-07-04 16:51:17 +02:00
|
|
|
android {
|
|
|
|
|
namespace = "mg.dot.feufaro"
|
|
|
|
|
compileSdk = libs.versions.android.compileSdk.get().toInt()
|
|
|
|
|
|
|
|
|
|
defaultConfig {
|
|
|
|
|
applicationId = "mg.dot.feufaro"
|
|
|
|
|
minSdk = libs.versions.android.minSdk.get().toInt()
|
|
|
|
|
targetSdk = libs.versions.android.targetSdk.get().toInt()
|
|
|
|
|
versionCode = 1
|
|
|
|
|
versionName = "1.0"
|
|
|
|
|
}
|
|
|
|
|
packaging {
|
|
|
|
|
resources {
|
|
|
|
|
excludes += "/META-INF/{AL2.0,LGPL2.1}"
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
buildTypes {
|
|
|
|
|
getByName("release") {
|
|
|
|
|
isMinifyEnabled = false
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
compileOptions {
|
|
|
|
|
sourceCompatibility = JavaVersion.VERSION_11
|
|
|
|
|
targetCompatibility = JavaVersion.VERSION_11
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
dependencies {
|
|
|
|
|
debugImplementation(compose.uiTooling)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
compose.desktop {
|
|
|
|
|
application {
|
|
|
|
|
mainClass = "mg.dot.feufaro.MainKt"
|
|
|
|
|
|
|
|
|
|
nativeDistributions {
|
2026-02-02 14:44:04 +03:00
|
|
|
targetFormats(TargetFormat.Exe, TargetFormat.Dmg, TargetFormat.Msi, TargetFormat.Deb)
|
|
|
|
|
packageName = "Feufaro"
|
2025-07-04 16:51:17 +02:00
|
|
|
packageVersion = "1.0.0"
|
2026-02-02 14:44:04 +03:00
|
|
|
modules("java.base", "java.desktop", "jdk.unsupported", "java.naming")
|
|
|
|
|
|
2026-08-11 14:25:33 +03:00
|
|
|
windows {
|
|
|
|
|
iconFile.set(project.file("icons/icon.ico"))
|
|
|
|
|
}
|
|
|
|
|
linux {
|
|
|
|
|
iconFile.set(project.file("icons/icon-linux.png"))
|
|
|
|
|
}
|
2026-02-02 14:44:04 +03:00
|
|
|
buildTypes.release.proguard {
|
|
|
|
|
isEnabled.set(false)
|
|
|
|
|
}
|
2025-07-04 16:51:17 +02:00
|
|
|
}
|
|
|
|
|
}
|
2026-04-24 11:37:57 +03:00
|
|
|
}
|
|
|
|
|
val generateFilesIndex = tasks.register("generateFilesIndex") {
|
|
|
|
|
val resourcesDir = file("src/commonMain/composeResources/files")
|
|
|
|
|
val outputFile = file("src/commonMain/composeResources/files/feuList.json")
|
|
|
|
|
|
|
|
|
|
inputs.dir(resourcesDir)
|
|
|
|
|
outputs.file(outputFile)
|
|
|
|
|
|
|
|
|
|
doLast {
|
|
|
|
|
if (resourcesDir.exists()) {
|
|
|
|
|
val files = resourcesDir.listFiles()
|
|
|
|
|
?.filter { it.extension == "txt" && it.name != "feuList.json" }
|
|
|
|
|
?.sortedBy { it.name } ?: emptyList()
|
|
|
|
|
|
|
|
|
|
val jsonContent = buildString {
|
|
|
|
|
append("{\n")
|
|
|
|
|
append(" \"internalFeu\": [\n")
|
|
|
|
|
|
|
|
|
|
files.forEachIndexed { index, file ->
|
|
|
|
|
var title = "Sans titre"
|
|
|
|
|
file.useLines { lines ->
|
|
|
|
|
for (l in lines) {
|
|
|
|
|
if (l.contains("|t:")) {
|
|
|
|
|
title = l.substringAfter("|t:").substringBefore("|").trim()
|
|
|
|
|
title = title.replace("\"", "\\\"")
|
|
|
|
|
break
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
append(" {\n")
|
|
|
|
|
append(" \"id\": ${index + 1},\n")
|
|
|
|
|
append(" \"fileName\": \"${file.name}\",\n")
|
|
|
|
|
append(" \"title\": \"$title\",\n")
|
|
|
|
|
append(" \"path\": \"assets://${file.name}\"\n")
|
|
|
|
|
append(" }${if (index < files.size - 1) "," else ""}\n")
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
append(" ]\n")
|
|
|
|
|
append("}")
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
outputFile.writeText(jsonContent)
|
|
|
|
|
println("Index JSON généré : ${files.size} fichiers.")
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
tasks.configureEach {
|
|
|
|
|
if (name.startsWith("copyNonXmlValueResources") ||
|
|
|
|
|
name.startsWith("generateComposeResClass")) {
|
|
|
|
|
dependsOn(generateFilesIndex)
|
|
|
|
|
}
|
2026-05-09 17:56:36 +02:00
|
|
|
}
|
|
|
|
|
tasks.register<Copy>("exportLibs") {
|
|
|
|
|
group = "distribution"
|
|
|
|
|
description = "Copie les bibliothèques partagées pour le Thin JAR"
|
|
|
|
|
|
|
|
|
|
// On utilise named("...") pour éviter l'erreur de compilation du script
|
|
|
|
|
// Dans un projet KMP, la configuration s'appelle généralement "desktopRuntimeClasspath"
|
|
|
|
|
// ou "jvmRuntimeClasspath" selon le nom de votre cible.
|
|
|
|
|
|
|
|
|
|
val configName = if (configurations.findByName("desktopRuntimeClasspath") != null) {
|
|
|
|
|
"desktopRuntimeClasspath"
|
|
|
|
|
} else {
|
|
|
|
|
"jvmRuntimeClasspath"
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
from(configurations.named(configName))
|
|
|
|
|
into(layout.buildDirectory.dir("libs/shared"))
|
|
|
|
|
|
|
|
|
|
duplicatesStrategy = DuplicatesStrategy.EXCLUDE
|
|
|
|
|
}
|