feat(build): Refactor infrastructure modules and establish single source of truth

This commit introduces a major refactoring of the build system and the core infrastructure modules. The primary goal is to establish a strict "Single Source of Truth" for all dependencies using Gradle Version Catalogs and to create a clean, maintainable, and scalable foundation for all current and future services.

### 1. Centralized Dependency Management (`libs.versions.toml`)

- **Established Single Source of Truth:** All dependency versions are now exclusively managed in `gradle/libs.versions.toml`. Hardcoded versions have been removed from all build scripts.
- **Introduced Gradle Bundles:** To simplify module dependencies, several bundles have been created (e.g., `testing-jvm`, `redis-cache`, `spring-cloud-gateway`, `monitoring-client`). This drastically reduces boilerplate in the `build.gradle.kts` files and improves readability.
- **Cleaned up Aliases:** All library and plugin aliases have been standardized for consistency.

### 2. Infrastructure Module Refactoring

All infrastructure modules (`core`, `platform`, `auth`, `cache`, `event-store`, `messaging`, `monitoring`, `gateway`) have been refactored to align with the new dependency management strategy.

- **Simplified Build Scripts:** The `build.gradle.kts` for each module now uses the new bundles and aliases, making them significantly cleaner and easier to understand.
- **Consistent Structure:** The architecture of each module now clearly follows the Port-Adapter pattern where applicable (e.g., `cache-api`/`redis-cache`).
- **Standardized `platform-bom`:** The project's own Bill of Materials (`platform-bom`) now also includes the Spring Cloud BOM, ensuring version consistency for all Spring-related dependencies.

### 3. Added Infrastructure Documentation

To improve onboarding and architectural understanding, a dedicated `README-*.md` file has been created for each refactored infrastructure module:
- `README-CORE.md`
- `README-PLATFORM.md`
- `README-INFRA-AUTH.md`
- `README-INFRA-CACHE.md`
- `README-INFRA-EVENT-STORE.md`
- `README-INFRA-MESSAGING.md`
- `README-INFRA-MONITORING.md`
- `README-INFRA-GATEWAY.md`

These documents explain the purpose, architecture, and usage of each component within the system. This lays the groundwork for our "Tracer Bullet" development approach.
This commit is contained in:
stefan
2025-07-31 14:09:22 +02:00
parent 81cb4582d6
commit df5919fac8
27 changed files with 882 additions and 356 deletions
+5 -105
View File
@@ -1,124 +1,24 @@
/*
import java.util.Locale
// Defines plugins that are available to all subprojects.
// `apply false` means the plugin is not applied to the root project itself.
plugins {
kotlin("jvm") version "2.1.21" apply false
kotlin("plugin.spring") version "2.1.21" apply false
id("org.springframework.boot") version "3.2.3" apply false
id("io.spring.dependency-management") version "1.1.4" apply false
base
}
allprojects {
group = "at.mocode.meldestelle"
version = "0.1.0-SNAPSHOT"
}
subprojects {
repositories {
mavenCentral()
}
// Enable dependency locking for all configurations
dependencyLocking {
lockAllConfigurations()
}
// Add task to write lock files
tasks.register("resolveAndLockAll") {
doFirst {
require(gradle.startParameter.isWriteDependencyLocks)
}
doLast {
configurations.filter {
// Only lock configurations that can be resolved
it.isCanBeResolved
}.forEach { it.resolve() }
}
}
// Configure Kotlin compiler options
tasks.withType<org.jetbrains.kotlin.gradle.tasks.KotlinCompile>().configureEach {
compilerOptions {
jvmTarget.set(org.jetbrains.kotlin.gradle.dsl.JvmTarget.JVM_21)
freeCompilerArgs.add("-Xjsr305=strict")
}
}
// Configure parallel test execution
tasks.withType<Test>().configureEach {
useJUnitPlatform()
// Enable parallel test execution
maxParallelForks = (Runtime.getRuntime().availableProcessors() / 2).takeIf { it > 0 } ?: 1
// Optimize JVM args for tests
jvmArgs = listOf("-Xmx512m", "-XX:+UseG1GC")
}
// Define a custom integrationTest task
tasks.register<Test>("integrationTest") {
description = "Runs integration tests."
group = "verification"
// Use the same configuration as the test task
useJUnitPlatform()
maxParallelForks = (Runtime.getRuntime().availableProcessors() / 2).takeIf { it > 0 } ?: 1
jvmArgs = listOf("-Xmx512m", "-XX:+UseG1GC")
// Include all tests that have "Integration" in their name
include("** / *Integration*Test.kt")
// Exclude unit tests (but keep integration tests)
exclude("** / *Test.kt")
include("** / *IntegrationTest.kt")
// Set system properties for integration tests
systemProperty("spring.profiles.active", "integration-test")
systemProperty("redis.host", "localhost")
systemProperty("redis.port", "6379")
// Generate reports in a separate directory
reports {
html.required.set(true)
junitXml.required.set(true)
}
// This task should run after the regular test task
// We don't use mustRunAfter here to avoid reference issues
}
}
*/
import java.util.Locale
plugins {
// KORREKTUR: Wir entfernen die hartcodierten Versionen und verwenden stattdessen
// die Aliase aus dem Version Catalog. `apply false` bleibt, da die Plugins
// hier nur für die Unterprojekte deklariert werden.
alias(libs.plugins.kotlin.jvm) apply false
alias(libs.plugins.kotlin.multiplatform) apply false
alias(libs.plugins.compose.multiplatform) apply false
alias(libs.plugins.compose.compiler) apply false
base
}
//allprojects {
// group = "at.mocode.meldestelle"
// version = "0.1.0-SNAPSHOT"
//
// repositories {
// mavenCentral()
// google() // Wichtig für Compose-Abhängigkeiten
// }
//}
// Common configuration for all subprojects in this build.
subprojects {
// Konfigurationen, die für alle Untermodule gelten.
// Enforce Java 21 for all Kotlin compilation tasks.
tasks.withType<org.jetbrains.kotlin.gradle.tasks.KotlinCompile>().configureEach {
compilerOptions {
jvmTarget.set(org.jetbrains.kotlin.gradle.dsl.JvmTarget.JVM_21)
}
}
// Configure all test tasks to use the JUnit Platform (for JUnit 5).
tasks.withType<Test>().configureEach {
useJUnitPlatform()
}