feat: füge Wasm/JS-Feature-Toggle hinzu, optimiere Gradle-Build-Zeit durch bedingte Task-Deaktivierung
Signed-off-by: StefanMoCoAt <stefan.mo.co@gmail.com>
This commit is contained in:
parent
0426d4ee9a
commit
cfc412878f
|
|
@ -38,6 +38,8 @@ plugins {
|
||||||
// ### ALLPROJECTS CONFIGURATION ###
|
// ### ALLPROJECTS CONFIGURATION ###
|
||||||
// ##################################################################
|
// ##################################################################
|
||||||
|
|
||||||
|
val isWasmEnabled = findProperty("enableWasm")?.toString()?.toBoolean() ?: false
|
||||||
|
|
||||||
// ---------------------------------------------------------------
|
// ---------------------------------------------------------------
|
||||||
// Zentrale Versionierung — liest version.properties (SemVer)
|
// Zentrale Versionierung — liest version.properties (SemVer)
|
||||||
// ---------------------------------------------------------------
|
// ---------------------------------------------------------------
|
||||||
|
|
@ -92,7 +94,7 @@ subprojects {
|
||||||
minHeapSize = "512m"
|
minHeapSize = "512m"
|
||||||
maxHeapSize = "2g"
|
maxHeapSize = "2g"
|
||||||
// Parallel test execution for better performance
|
// Parallel test execution for better performance
|
||||||
maxParallelForks = (Runtime.getRuntime().availableProcessors() / 2).coerceAtLeast(1)
|
maxParallelForks = (Runtime.getRuntime().availableProcessors() / 4).coerceAtLeast(1)
|
||||||
}
|
}
|
||||||
|
|
||||||
// ---------------------------------------------------------------------------
|
// ---------------------------------------------------------------------------
|
||||||
|
|
@ -111,7 +113,28 @@ subprojects {
|
||||||
// (A) Source map configuration is handled via `gradle.properties` (global Kotlin/JS settings)
|
// (A) Source map configuration is handled via `gradle.properties` (global Kotlin/JS settings)
|
||||||
// to avoid compiler-flag incompatibilities across toolchains.
|
// to avoid compiler-flag incompatibilities across toolchains.
|
||||||
|
|
||||||
// (B) JS test executable compilation/sync is currently very noisy (duplicate resource copying from jsMain + jsTest).
|
// (B) Conditional Wasm/JS Target handling based on `enableWasm` property
|
||||||
|
// This significantly reduces build times during Desktop development.
|
||||||
|
// Flag is defined at the beginning of the script.
|
||||||
|
|
||||||
|
// If Wasm is disabled, we skip the intensive JS/WASM compilation tasks
|
||||||
|
// for modules that are not strictly JVM-only.
|
||||||
|
if (!isWasmEnabled) {
|
||||||
|
tasks.matching {
|
||||||
|
val n = it.name
|
||||||
|
n.contains("wasmJs", ignoreCase = true) ||
|
||||||
|
n.contains("KotlinJs", ignoreCase = true) ||
|
||||||
|
n.contains("JsIr", ignoreCase = true) ||
|
||||||
|
n.contains("packageJsUpper", ignoreCase = true) ||
|
||||||
|
n.contains("jsProcessResources", ignoreCase = true) ||
|
||||||
|
n.contains("wasmJsProcessResources", ignoreCase = true)
|
||||||
|
}.configureEach {
|
||||||
|
enabled = false
|
||||||
|
group = "disabled"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// (C) JS test executable compilation/sync is currently very noisy (duplicate resource copying from jsMain + jsTest).
|
||||||
// We disable JS/WASM JS test executables in CI/build to keep output warning-free.
|
// We disable JS/WASM JS test executables in CI/build to keep output warning-free.
|
||||||
tasks.matching {
|
tasks.matching {
|
||||||
val n = it.name
|
val n = it.name
|
||||||
|
|
|
||||||
42
docs/99_Journal/2026-04-16_Gradle-Performance-Fix.md
Normal file
42
docs/99_Journal/2026-04-16_Gradle-Performance-Fix.md
Normal file
|
|
@ -0,0 +1,42 @@
|
||||||
|
# 📓 Journal-Eintrag: 2026-04-16 - Gradle Build-Performance Optimierung
|
||||||
|
|
||||||
|
## 🏗️ Status Quo
|
||||||
|
|
||||||
|
Die Build-Zeiten stiegen nach der Integration von `wasmJs` auf bis zu 32 Minuten an. Dies lag primär daran, dass für
|
||||||
|
fast alle Module (Backend-Domains, Core, Frontend) bei jedem Build auch die JS- und WASM-Targets kompiliert wurden,
|
||||||
|
obwohl diese für die Desktop-Entwicklung nicht benötigt werden.
|
||||||
|
|
||||||
|
## 🚀 Optimierungen
|
||||||
|
|
||||||
|
### 1. Wasm/JS Feature Toggle (`enableWasm`)
|
||||||
|
|
||||||
|
- **Neues Flag**: In der `gradle.properties` wurde das Flag `enableWasm=false` eingeführt.
|
||||||
|
- **Root build.gradle.kts**: Wenn `enableWasm=false` ist, werden alle Tasks, die `wasmJs`, `KotlinJs` oder `JsIr` im
|
||||||
|
Namen tragen, global deaktiviert.
|
||||||
|
- **Web-Shell Optimierung**: Das Modul `:frontend:shells:meldestelle-web` wurde so angepasst, dass die Targets `js` und
|
||||||
|
`wasmJs` sowie deren Abhängigkeiten nur dann konfiguriert werden, wenn das Flag aktiv ist.
|
||||||
|
|
||||||
|
### 2. Ressourcen-Management & Stabilität
|
||||||
|
|
||||||
|
- **Memory Settings**: Die JVM-Argumente für den Gradle-Daemon und den Kotlin-Daemon wurden auf 8GB (`-Xmx8g`)
|
||||||
|
vereinheitlicht, um OOM-Fehler bei intensiven JS-Kompilierungen zu vermeiden.
|
||||||
|
- **Parallelisierung**: `maxParallelForks` für Tests wurde auf `CPU/4` reduziert, um dem Gradle-Daemon in
|
||||||
|
Ressourcen-kritischen Phasen mehr Spielraum zu geben und Swapping zu verhindern.
|
||||||
|
- **Worker-Limits**: `org.gradle.workers.max=8` sorgt für eine kontrollierte Auslastung der CPU-Kerne.
|
||||||
|
|
||||||
|
### 3. Build-Hygiene
|
||||||
|
|
||||||
|
- Zusätzliche Deaktivierung von redundanten Resource-Processing Tasks (`jsProcessResources`, `wasmJsProcessResources`),
|
||||||
|
wenn Wasm deaktiviert ist.
|
||||||
|
- Unterdrückung von Node.js Deprecation Warnings in allen Exec-Tasks.
|
||||||
|
|
||||||
|
## 📈 Erwartetes Resultat
|
||||||
|
|
||||||
|
- **Desktop-Entwicklung**: Reduzierung der Build-Zeit um ca. 60-80%, da die kompletten JS/WASM Compiler-Pipelines
|
||||||
|
übersprungen werden.
|
||||||
|
- **Web-Entwicklung**: Stabilere Builds durch erhöhte Heap-Limits und kontrollierte Parallelisierung.
|
||||||
|
|
||||||
|
---
|
||||||
|
**🏗️ [Lead Architect]**: Gradle-Infrastruktur auf modulares Target-Handling umgestellt.
|
||||||
|
**🐧 [DevOps Engineer]**: Ressourcen-Limits für lokale Entwicklung und CI harmonisiert.
|
||||||
|
**🧹 [Curator]**: Build-Performance Strategie dokumentiert.
|
||||||
|
|
@ -9,63 +9,71 @@ plugins {
|
||||||
alias(libs.plugins.kotlinSerialization)
|
alias(libs.plugins.kotlinSerialization)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
val isWasmEnabled = findProperty("enableWasm")?.toString()?.toBoolean() ?: false
|
||||||
|
|
||||||
kotlin {
|
kotlin {
|
||||||
jvm()
|
jvm()
|
||||||
|
|
||||||
js(IR) {
|
if (isWasmEnabled) {
|
||||||
binaries.library()
|
js(IR) {
|
||||||
browser {
|
binaries.library()
|
||||||
testTask {
|
browser {
|
||||||
enabled = false
|
testTask {
|
||||||
|
enabled = false
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
wasmJs {
|
wasmJs {
|
||||||
browser {
|
browser {
|
||||||
testTask {
|
testTask {
|
||||||
enabled = false
|
enabled = false
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
binaries.executable()
|
||||||
}
|
}
|
||||||
binaries.executable()
|
|
||||||
}
|
}
|
||||||
|
|
||||||
sourceSets {
|
sourceSets {
|
||||||
wasmJsMain.dependencies {
|
commonMain.dependencies {}
|
||||||
// Core-Module
|
|
||||||
implementation(projects.frontend.core.domain)
|
|
||||||
implementation(projects.frontend.core.designSystem)
|
|
||||||
implementation(projects.frontend.core.navigation)
|
|
||||||
implementation(projects.frontend.core.network)
|
|
||||||
implementation(projects.frontend.core.auth)
|
|
||||||
|
|
||||||
// Feature-Module (die öffentlich sein dürfen)
|
if (isWasmEnabled) {
|
||||||
implementation(projects.frontend.features.veranstaltungFeature)
|
wasmJsMain.dependencies {
|
||||||
implementation(projects.frontend.features.turnierFeature)
|
// Core-Module
|
||||||
implementation(projects.frontend.features.nennungFeature)
|
implementation(projects.frontend.core.domain)
|
||||||
implementation(projects.frontend.features.billingFeature)
|
implementation(projects.frontend.core.designSystem)
|
||||||
|
implementation(projects.frontend.core.navigation)
|
||||||
|
implementation(projects.frontend.core.network)
|
||||||
|
implementation(projects.frontend.core.auth)
|
||||||
|
|
||||||
// Compose Multiplatform
|
// Feature-Module (die öffentlich sein dürfen)
|
||||||
implementation(compose.runtime)
|
implementation(projects.frontend.features.veranstaltungFeature)
|
||||||
implementation(compose.foundation)
|
implementation(projects.frontend.features.turnierFeature)
|
||||||
implementation(compose.material3)
|
implementation(projects.frontend.features.nennungFeature)
|
||||||
implementation(compose.ui)
|
implementation(projects.frontend.features.billingFeature)
|
||||||
implementation(compose.components.resources)
|
|
||||||
implementation(libs.compose.materialIconsExtended)
|
|
||||||
|
|
||||||
// DI (Koin)
|
// Compose Multiplatform
|
||||||
implementation(libs.koin.core)
|
implementation(compose.runtime)
|
||||||
implementation(libs.koin.compose)
|
implementation(compose.foundation)
|
||||||
implementation(libs.koin.compose.viewmodel)
|
implementation(compose.material3)
|
||||||
|
implementation(compose.ui)
|
||||||
|
implementation(compose.components.resources)
|
||||||
|
implementation(libs.compose.materialIconsExtended)
|
||||||
|
|
||||||
// Bundles
|
// DI (Koin)
|
||||||
implementation(libs.bundles.kmp.common)
|
implementation(libs.koin.core)
|
||||||
implementation(libs.bundles.compose.common)
|
implementation(libs.koin.compose)
|
||||||
}
|
implementation(libs.koin.compose.viewmodel)
|
||||||
|
|
||||||
wasmJsTest.dependencies {
|
// Bundles
|
||||||
// Core-Module
|
implementation(libs.bundles.kmp.common)
|
||||||
implementation(projects.frontend.core.domain)
|
implementation(libs.bundles.compose.common)
|
||||||
|
}
|
||||||
|
|
||||||
|
wasmJsTest.dependencies {
|
||||||
|
// Core-Module
|
||||||
|
implementation(projects.frontend.core.domain)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -68,6 +68,11 @@ org.gradle.java.installations.auto-detect=true
|
||||||
dev.port.offset=0
|
dev.port.offset=0
|
||||||
# Set dev.port.offset=100 for second developer
|
# Set dev.port.offset=100 for second developer
|
||||||
# Set dev.port.offset=200 for the third developer
|
# Set dev.port.offset=200 for the third developer
|
||||||
|
# ------------------------------------------------------------------
|
||||||
|
# Wasm/JS Feature Toggle
|
||||||
|
# ------------------------------------------------------------------
|
||||||
|
# Setze enableWasm=true, um die Web-App zu bauen oder Web-spezifische
|
||||||
|
# Module zu testen. Default=false spart massiv Zeit beim Desktop-Build.
|
||||||
enableWasm=false
|
enableWasm=false
|
||||||
|
|
||||||
# Dokka Gradle plugin V2 mode (with helpers for V1 compatibility)
|
# Dokka Gradle plugin V2 mode (with helpers for V1 compatibility)
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user