chore: refactor Gradle config, standardize Kotlin MPP plugin usage, and update dependencies

- Unified plugin application across modules using `alias(libs.plugins.*)` instead of hardcoded IDs.
- Removed redundant JVM/JS source map tasks, improving Gradle and Docker build consistency.
- Updated dependencies, including `logback` and Webpack `copy-webpack-plugin`, and added contextual documentation.
- Added frontend architecture diagram in PlantUML (`docs/01_Architecture/Reference`), standardizing feature-core-shell dependencies.
This commit is contained in:
2026-02-03 22:11:31 +01:00
parent c613acb91d
commit 03e1484dd3
24 changed files with 246 additions and 377 deletions
+2 -17
View File
@@ -1,8 +1,5 @@
import org.jetbrains.kotlin.gradle.dsl.JvmTarget
plugins {
// Fix for "Plugin loaded multiple times": Apply plugin by ID without version (inherited from root)
id("org.jetbrains.kotlin.multiplatform")
alias(libs.plugins.kotlinMultiplatform)
alias(libs.plugins.composeMultiplatform)
alias(libs.plugins.composeCompiler)
alias(libs.plugins.kotlinSerialization)
@@ -13,11 +10,9 @@ version = "1.0.0"
kotlin {
jvm()
js {
binaries.library()
// CHANGED: Use nodejs() instead of browser() to minimize NodeJsRootPlugin conflicts in Docker
// while still satisfying the "configured for JS usage" requirement.
// Use nodejs() to minimize NodeJsRootPlugin conflicts in Docker
nodejs()
}
@@ -70,13 +65,3 @@ kotlin {
}
}
}
tasks.withType<org.jetbrains.kotlin.gradle.tasks.KotlinCompile> {
compilerOptions {
jvmTarget.set(JvmTarget.JVM_25)
freeCompilerArgs.addAll(
"-opt-in=kotlin.RequiresOptIn",
"-Xexpect-actual-classes"
)
}
}
+6 -14
View File
@@ -1,21 +1,15 @@
plugins {
// Fix for "Plugin loaded multiple times": Apply plugin by ID without version (inherited from root)
id("org.jetbrains.kotlin.multiplatform")
alias(libs.plugins.composeMultiplatform)
alias(libs.plugins.composeCompiler)
alias(libs.plugins.kotlinMultiplatform)
alias(libs.plugins.kotlinSerialization)
alias(libs.plugins.composeCompiler)
alias(libs.plugins.composeMultiplatform)
}
kotlin {
jvm()
js(IR) {
js {
binaries.library()
// Re-enabled browser environment after Root NodeJs fix
browser {
testTask {
enabled = false
}
}
browser()
}
sourceSets {
@@ -25,9 +19,7 @@ kotlin {
implementation(compose.material3)
implementation(compose.ui)
implementation(compose.components.resources)
implementation(libs.kotlinx.coroutines.core)
implementation(libs.kotlinx.serialization.json)
implementation(libs.kotlinx.datetime)
implementation(libs.bundles.kmp.common)
}
}
}
+4 -10
View File
@@ -1,7 +1,6 @@
@file:OptIn(ExperimentalKotlinGradlePluginApi::class)
import org.jetbrains.kotlin.gradle.ExperimentalKotlinGradlePluginApi
import org.jetbrains.kotlin.gradle.dsl.JvmTarget
plugins {
alias(libs.plugins.kotlinMultiplatform)
@@ -14,9 +13,9 @@ kotlin {
binaries.library()
// Re-enabled browser environment after Root NodeJs fix
browser {
testTask {
enabled = false
}
testTask {
enabled = false
}
}
}
@@ -27,9 +26,4 @@ kotlin {
}
}
tasks.withType<org.jetbrains.kotlin.gradle.tasks.KotlinCompile> {
compilerOptions {
jvmTarget.set(JvmTarget.JVM_25)
freeCompilerArgs.addAll("-opt-in=kotlin.RequiresOptIn")
}
}
// KMP Compile-Optionen sind jetzt zentral in der Root build.gradle.kts definiert
+3 -9
View File
@@ -3,8 +3,7 @@
import org.jetbrains.kotlin.gradle.ExperimentalKotlinGradlePluginApi
plugins {
// Fix for "Plugin loaded multiple times": Apply plugin by ID without version (inherited from root)
id("org.jetbrains.kotlin.multiplatform")
alias(libs.plugins.kotlinMultiplatform)
alias(libs.plugins.kotlinSerialization)
alias(libs.plugins.sqldelight)
}
@@ -13,12 +12,7 @@ kotlin {
jvm()
js {
binaries.library()
// Re-enabled browser environment after Root NodeJs fix
browser {
testTask {
enabled = false
}
}
browser()
}
sourceSets {
@@ -35,7 +29,7 @@ kotlin {
jsMain.dependencies {
implementation(libs.sqldelight.driver.web)
implementation(npm("@sqlite.org/sqlite-wasm", "3.51.1-build2"))
implementation(npm("@sqlite.org/sqlite-wasm", libs.versions.sqliteWasm.get()))
}
commonTest.dependencies {
+3 -10
View File
@@ -1,10 +1,8 @@
/**
* Dieses Modul definiert nur die Navigationsrouten.
* Es ist noch simpler.
*/
plugins {
// Fix for "Plugin loaded multiple times": Apply plugin by ID without version (inherited from root)
id("org.jetbrains.kotlin.multiplatform")
alias(libs.plugins.kotlinMultiplatform)
}
group = "at.mocode.clients.shared"
@@ -14,18 +12,13 @@ kotlin {
jvm()
js {
binaries.library()
// Re-enabled browser environment after Root NodeJs fix
browser {
testTask {
enabled = false
}
}
browser()
}
sourceSets {
commonMain.dependencies {
// Depend on core domain for User/Role types used by navigation API
implementation(project(":frontend:core:domain"))
implementation(projects.frontend.core.domain)
}
commonTest.dependencies {
implementation(libs.kotlin.test)
+2 -16
View File
@@ -1,11 +1,9 @@
@file:OptIn(ExperimentalKotlinGradlePluginApi::class)
import org.jetbrains.kotlin.gradle.ExperimentalKotlinGradlePluginApi
import org.jetbrains.kotlin.gradle.dsl.JvmTarget
plugins {
// Fix for "Plugin loaded multiple times": Apply plugin by ID without version (inherited from root)
id("org.jetbrains.kotlin.multiplatform")
alias(libs.plugins.kotlinMultiplatform)
alias(libs.plugins.kotlinSerialization)
}
@@ -13,12 +11,7 @@ kotlin {
jvm()
js {
binaries.library()
// Re-enabled browser environment after Root NodeJs fix
browser {
testTask {
enabled = false
}
}
browser()
}
sourceSets {
@@ -41,10 +34,3 @@ kotlin {
}
}
}
tasks.withType<org.jetbrains.kotlin.gradle.tasks.KotlinCompile> {
compilerOptions {
jvmTarget.set(JvmTarget.JVM_25)
freeCompilerArgs.addAll("-opt-in=kotlin.RequiresOptIn")
}
}
+3 -9
View File
@@ -1,19 +1,13 @@
plugins {
// Fix for "Plugin loaded multiple times": Apply plugin by ID without version (inherited from root)
id("org.jetbrains.kotlin.multiplatform")
alias(libs.plugins.kotlinMultiplatform)
alias(libs.plugins.kotlinSerialization)
}
kotlin {
jvm()
js(IR) {
js {
binaries.library()
// Re-enabled browser environment after Root NodeJs fix
browser {
testTask {
enabled = false
}
}
browser()
}
sourceSets {
@@ -1,11 +1,8 @@
import org.jetbrains.kotlin.gradle.dsl.JvmTarget
/**
* Dieses Modul kapselt die gesamte UI und Logik für das Ping-Feature.
*/
plugins {
// Fix for "Plugin loaded multiple times": Apply plugin by ID without version (inherited from root)
id("org.jetbrains.kotlin.multiplatform")
alias(libs.plugins.kotlinMultiplatform)
alias(libs.plugins.composeMultiplatform)
alias(libs.plugins.composeCompiler)
alias(libs.plugins.kotlinSerialization)
@@ -18,12 +15,7 @@ kotlin {
jvm()
js {
binaries.library()
// Re-enabled browser environment after Root NodeJs fix
browser {
testTask {
enabled = false
}
}
browser()
}
sourceSets {
@@ -70,12 +62,3 @@ kotlin {
}
}
}
tasks.withType<org.jetbrains.kotlin.gradle.tasks.KotlinCompile> {
compilerOptions {
jvmTarget.set(JvmTarget.JVM_25)
freeCompilerArgs.addAll(
"-opt-in=kotlin.RequiresOptIn"
)
}
}
@@ -3,7 +3,6 @@
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.targets.js.webpack.KotlinWebpackConfig
/**
@@ -11,16 +10,13 @@ import org.jetbrains.kotlin.gradle.targets.js.webpack.KotlinWebpackConfig
* setzt sie zu einer lauffähigen Anwendung zusammen.
*/
plugins {
// Fix for "Plugin loaded multiple times": Apply plugin by ID without version (inherited from root)
id("org.jetbrains.kotlin.multiplatform")
alias(libs.plugins.kotlinMultiplatform)
alias(libs.plugins.composeCompiler)
alias(libs.plugins.composeMultiplatform)
alias(libs.plugins.kotlinSerialization)
}
kotlin {
// Toolchain is now handled centrally in the root build.gradle.kts
// JVM Target für Desktop
jvm {
binaries {
@@ -31,7 +27,7 @@ kotlin {
}
// JavaScript Target für Web
js(IR) {
js {
browser {
commonWebpackConfig {
cssSupport { enabled = true }
@@ -43,7 +39,7 @@ kotlin {
// Source Maps Optimierung für Docker Builds
if (project.hasProperty("noSourceMaps")) {
sourceMaps = false
sourceMaps = false
}
}
@@ -55,13 +51,6 @@ kotlin {
runTask {
mainOutputFileName.set("web-app.js")
}
// Browser-Tests komplett deaktivieren (Configuration Cache kompatibel)
testTask {
useKarma {
useChromeHeadless()
environment("CHROME_BIN", "/usr/bin/google-chrome-stable")
}
}
}
binaries.executable()
}
@@ -69,7 +58,6 @@ kotlin {
sourceSets {
commonMain.dependencies {
// Shared modules
// implementation(projects.frontend.shared) // REMOVED: Shared module deleted
implementation(projects.frontend.core.domain)
implementation(projects.frontend.core.designSystem)
implementation(projects.frontend.core.navigation)
@@ -92,7 +80,7 @@ kotlin {
implementation(compose.components.resources)
implementation(compose.materialIconsExtended)
// Bundles (Cleaned up dependencies)
// Bundles
implementation(libs.bundles.kmp.common) // Coroutines, Serialization, DateTime
implementation(libs.bundles.compose.common) // ViewModel & Lifecycle
}
@@ -106,7 +94,7 @@ kotlin {
jsMain.dependencies {
implementation(compose.html.core)
// Benötigt für custom webpack config (wasm.js)
implementation(devNpm("copy-webpack-plugin", "11.0.0"))
implementation(devNpm("copy-webpack-plugin", libs.versions.copyWebpackPlugin.get()))
}
commonTest.dependencies {
@@ -115,25 +103,7 @@ kotlin {
}
}
// KMP Compile-Optionen
tasks.withType<org.jetbrains.kotlin.gradle.tasks.KotlinCompile> {
compilerOptions {
jvmTarget.set(JvmTarget.JVM_25)
freeCompilerArgs.addAll(
"-opt-in=kotlin.RequiresOptIn",
"-Xskip-metadata-version-check", // Für bleeding-edge Versionen
// Suppress beta warning for expect/actual declarations used in this module
"-Xexpect-actual-classes"
)
}
}
// ---------------------------------------------------------------------------
// Kotlin/JS source maps
// ---------------------------------------------------------------------------
// Production source maps must remain enabled for browser debugging.
// Configure a duplicate handling strategy for distribution tasks
// Duplicate-Handling für Distribution (Zentralisiert in Root build.gradle.kts, aber hier spezifisch für Distribution Tasks)
tasks.withType<Tar> {
duplicatesStrategy = DuplicatesStrategy.EXCLUDE
}
@@ -142,15 +112,6 @@ tasks.withType<Zip> {
duplicatesStrategy = DuplicatesStrategy.EXCLUDE
}
// Duplicate-Handling für Distribution
tasks.withType<Copy> {
duplicatesStrategy = DuplicatesStrategy.EXCLUDE
}
tasks.withType<Sync> {
duplicatesStrategy = DuplicatesStrategy.EXCLUDE
}
// Desktop Application Configuration
compose.desktop {
application {