diff --git a/.gitignore b/.gitignore index f1d1b863..1e40480c 100644 --- a/.gitignore +++ b/.gitignore @@ -1,81 +1,5 @@ ### JetBrains template -# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio, WebStorm and Rider -# Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839 - -# User-specific stuff -.idea/**/workspace.xml -.idea/**/tasks.xml -.idea/**/usage.statistics.xml -.idea/**/dictionaries -.idea/**/shelf - -# AWS User-specific -.idea/**/aws.xml - -# Generated files -.idea/**/contentModel.xml - -# Sensitive or high-churn files -.idea/**/dataSources/ -.idea/**/dataSources.ids -.idea/**/dataSources.local.xml -.idea/**/sqlDataSources.xml -.idea/**/dynamic.xml -.idea/**/uiDesigner.xml -.idea/**/dbnavigator.xml - -# Gradle -.idea/**/gradle.xml -.idea/**/libraries - -# Gradle and Maven with auto-import -# When using Gradle or Maven with auto-import, you should exclude module files, -# since they will be recreated, and may cause churn. Uncomment if using -# auto-import. -.idea/artifacts -.idea/compiler.xml -.idea/jarRepositories.xml -.idea/modules.xml -.idea/*.iml -.idea/modules -*.iml -*.ipr - -# CMake -cmake-build-*/ - -# Mongo Explorer plugin -.idea/**/mongoSettings.xml - -# File-based project format -*.iws - -# IntelliJ -out/ - -# mpeltonen/sbt-idea plugin -.idea_modules/ - -# JIRA plugin -atlassian-ide-plugin.xml - -# Cursive Clojure plugin -.idea/replstate.xml - -# SonarLint plugin -.idea/sonarlint/ - -# Crashlytics plugin (for Android Studio and IntelliJ) -com_crashlytics_export_strings.xml -crashlytics.properties -crashlytics-build.properties -fabric.properties - -# Editor-based Rest Client -.idea/httpRequests - -# Android studio 3.1+ serialized cache file -.idea/caches/build_file_checksums.ser +.idea/ ### Gradle template .gradle diff --git a/.idea/.gitignore b/.idea/.gitignore deleted file mode 100644 index a9d7db9c..00000000 --- a/.idea/.gitignore +++ /dev/null @@ -1,10 +0,0 @@ -# Default ignored files -/shelf/ -/workspace.xml -# Editor-based HTTP Client requests -/httpRequests/ -# Datasource local storage ignored files -/dataSources/ -/dataSources.local.xml -# GitHub Copilot persisted chat sessions -/copilot/chatSessions diff --git a/.idea/dataSources.xml b/.idea/dataSources.xml deleted file mode 100644 index a71d1e4c..00000000 --- a/.idea/dataSources.xml +++ /dev/null @@ -1,22 +0,0 @@ - - - - - postgresql - true - org.postgresql.Driver - jdbc:postgresql://localhost:5432/postgres - $ProjectFileDir$ - - - sqlite.xerial - true - org.sqlite.JDBC - jdbc:sqlite:$PROJECT_DIR$/docker/grafana/grafana.db - - - - $ProjectFileDir$ - - - \ No newline at end of file diff --git a/.idea/icon.svg b/.idea/icon.svg deleted file mode 100644 index 8a014b26..00000000 --- a/.idea/icon.svg +++ /dev/null @@ -1,104 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/.idea/kotlinc.xml b/.idea/kotlinc.xml deleted file mode 100644 index 5815a4a6..00000000 --- a/.idea/kotlinc.xml +++ /dev/null @@ -1,6 +0,0 @@ - - - - - \ No newline at end of file diff --git a/.idea/sqldialects.xml b/.idea/sqldialects.xml deleted file mode 100644 index 6df4889b..00000000 --- a/.idea/sqldialects.xml +++ /dev/null @@ -1,6 +0,0 @@ - - - - - - \ No newline at end of file diff --git a/.idea/vcs.xml b/.idea/vcs.xml deleted file mode 100644 index 35eb1ddf..00000000 --- a/.idea/vcs.xml +++ /dev/null @@ -1,6 +0,0 @@ - - - - - - \ No newline at end of file diff --git a/.sdkmanrc b/.sdkmanrc index 14cd6711..8a924c8a 100644 --- a/.sdkmanrc +++ b/.sdkmanrc @@ -1,4 +1,4 @@ # Enable auto-env through the sdkman_auto_env config # Add key=value pairs of SDKs to use below java=21.0.4-librca -gradle=8.9 +gradle=8.10 diff --git a/Dockerfile b/Dockerfile index aab3ecfc..0f570615 100644 --- a/Dockerfile +++ b/Dockerfile @@ -27,7 +27,7 @@ USER spring:spring WORKDIR /home/spring # copy jar and run it ARG BUILD_ROOT=/usr/src/app -ARG BOOT_JAR=$BUILD_ROOT/server/build/libs/*.jar +ARG BOOT_JAR=$BUILD_ROOT/server/build/libs/*boot.jar COPY --from=build $BOOT_JAR ./app.jar ENTRYPOINT ["java","-jar","./app.jar"] diff --git a/buildSrc/build.gradle.kts b/buildSrc/build.gradle.kts index 944c94cc..aacfdd3c 100644 --- a/buildSrc/build.gradle.kts +++ b/buildSrc/build.gradle.kts @@ -1,5 +1,6 @@ plugins { `kotlin-dsl` + alias(libs.plugins.spotless) } repositories { @@ -17,3 +18,48 @@ dependencies { implementation(kotlin("stdlib-jdk8", "2.0.20")) implementation(kotlin("noarg", "2.0.20")) } + +spotless { + kotlin { + ktlint() + } +} + +gradlePlugin { + val dependencyManagement by plugins.creating { + id = "hu.bsstudio.dependency-management" + implementationClass = "hu.bsstudio.DependencyManagement" + } + val integrationTestingConventions by plugins.creating { + id = "hu.bsstudio.integration-testing-conventions" + implementationClass = "hu.bsstudio.IntegrationTestingConventions" + } + val javaConventions by plugins.creating { + id = "hu.bsstudio.java-conventions" + implementationClass = "hu.bsstudio.JavaConventions" + } + val kotlinConventions by plugins.creating { + id = "hu.bsstudio.kotlin-conventions" + implementationClass = "hu.bsstudio.KotlinConventions" + } + val kotlinTestingConventions by plugins.creating { + id = "hu.bsstudio.kotlin-testing-conventions" + implementationClass = "hu.bsstudio.KotlinTestingConventions" + } + val spotlessConventions by plugins.creating { + id = "hu.bsstudio.spotless-conventions" + implementationClass = "hu.bsstudio.SpotlessConventions" + } + val springAppConventions by plugins.creating { + id = "hu.bsstudio.spring-app-conventions" + implementationClass = "hu.bsstudio.SpringAppConventions" + } + val springModuleConventions by plugins.creating { + id = "hu.bsstudio.spring-module-conventions" + implementationClass = "hu.bsstudio.SpringModuleConventions" + } + val testingConventions by plugins.creating { + id = "hu.bsstudio.testing-conventions" + implementationClass = "hu.bsstudio.TestingConventions" + } +} diff --git a/buildSrc/src/main/kotlin/dependency-management.gradle.kts b/buildSrc/src/main/kotlin/dependency-management.gradle.kts deleted file mode 100644 index ec75d261..00000000 --- a/buildSrc/src/main/kotlin/dependency-management.gradle.kts +++ /dev/null @@ -1,14 +0,0 @@ -plugins { - id("java-conventions") - id("io.spring.dependency-management") -} - -repositories { - mavenCentral() -} - -dependencies { - api(enforcedPlatform(org.springframework.boot.gradle.plugin.SpringBootPlugin.BOM_COORDINATES)) - api(enforcedPlatform("org.springframework.shell:spring-shell-dependencies:3.3.2")) - api(enforcedPlatform("org.springframework.cloud:spring-cloud-dependencies:2023.0.3")) -} diff --git a/buildSrc/src/main/kotlin/hu/bsstudio/DependencyManagement.kt b/buildSrc/src/main/kotlin/hu/bsstudio/DependencyManagement.kt new file mode 100644 index 00000000..0ee9e46c --- /dev/null +++ b/buildSrc/src/main/kotlin/hu/bsstudio/DependencyManagement.kt @@ -0,0 +1,25 @@ +package hu.bsstudio + +import io.spring.gradle.dependencymanagement.DependencyManagementPlugin +import org.gradle.api.Plugin +import org.gradle.api.Project +import org.gradle.kotlin.dsl.apply +import org.gradle.kotlin.dsl.dependencies +import org.gradle.kotlin.dsl.repositories + +class DependencyManagement : Plugin { + override fun apply(project: Project) { + project.pluginManager.apply(JavaConventions::class) + project.pluginManager.apply(DependencyManagementPlugin::class) + + project.repositories { + add(mavenCentral()) + } + + project.dependencies { + add("api", enforcedPlatform("org.springframework.boot:spring-boot-dependencies:3.3.3")) + add("api", enforcedPlatform("org.springframework.shell:spring-shell-dependencies:3.3.2")) + add("api", enforcedPlatform("org.springframework.cloud:spring-cloud-dependencies:2023.0.3")) + } + } +} diff --git a/buildSrc/src/main/kotlin/hu/bsstudio/IntegrationTestingConventions.kt b/buildSrc/src/main/kotlin/hu/bsstudio/IntegrationTestingConventions.kt new file mode 100644 index 00000000..dca6d74c --- /dev/null +++ b/buildSrc/src/main/kotlin/hu/bsstudio/IntegrationTestingConventions.kt @@ -0,0 +1,55 @@ +package hu.bsstudio + +import org.gradle.api.Plugin +import org.gradle.api.Project +import org.gradle.api.tasks.SourceSetContainer +import org.gradle.api.tasks.testing.Test +import org.gradle.kotlin.dsl.add +import org.gradle.kotlin.dsl.apply +import org.gradle.kotlin.dsl.configure +import org.gradle.kotlin.dsl.dependencies +import org.gradle.kotlin.dsl.exclude +import org.gradle.kotlin.dsl.get +import org.gradle.kotlin.dsl.register +import org.gradle.kotlin.dsl.the + +class IntegrationTestingConventions : Plugin { + override fun apply(project: Project) { + project.pluginManager.apply(TestingConventions::class) + + project.extensions.configure { + create("intTest") { + compileClasspath += getByName("main").output + runtimeClasspath += getByName("main").output + } + } + + project.configurations["intTestImplementation"].extendsFrom(project.configurations["implementation"]) + + project.configurations["intTestRuntimeOnly"].extendsFrom(project.configurations["runtimeOnly"]) + + project.dependencies { + add("intTestImplementation", "org.springframework.boot:spring-boot-starter-test") { + exclude(module = "hamcrest") // require developers to use KoTest + exclude(module = "org.assertj") // require developers to use KoTest + } + add("intTestImplementation", "io.kotest:kotest-runner-junit5:5.9.1") + add("intTestImplementation", "io.kotest:kotest-assertions-core-jvm:5.9.1") + } + + val integrationTest = + project.tasks.register("integrationTest", Test::class) { + description = "Runs integration tests." + group = "verification" + + val intTest = project.the()["intTest"] + testClassesDirs = intTest.output.classesDirs + classpath = intTest.runtimeClasspath + shouldRunAfter("test") + + useJUnitPlatform() + } + + project.tasks.named("check") { dependsOn(integrationTest) } + } +} diff --git a/buildSrc/src/main/kotlin/hu/bsstudio/JavaConventions.kt b/buildSrc/src/main/kotlin/hu/bsstudio/JavaConventions.kt new file mode 100644 index 00000000..3e1e2d16 --- /dev/null +++ b/buildSrc/src/main/kotlin/hu/bsstudio/JavaConventions.kt @@ -0,0 +1,24 @@ +package hu.bsstudio + +import org.gradle.api.Plugin +import org.gradle.api.Project +import org.gradle.api.plugins.JavaLibraryPlugin +import org.gradle.api.plugins.JavaPluginExtension +import org.gradle.jvm.toolchain.JavaLanguageVersion +import org.gradle.kotlin.dsl.apply +import org.gradle.kotlin.dsl.configure +import org.gradle.kotlin.dsl.get + +class JavaConventions : Plugin { + override fun apply(project: Project) { + project.pluginManager.apply(JavaLibraryPlugin::class) + + project.extensions.configure(JavaPluginExtension::class) { + toolchain { + languageVersion.set(JavaLanguageVersion.of(21)) + } + } + + project.configurations["compileOnly"].extendsFrom(project.configurations["annotationProcessor"]) + } +} diff --git a/buildSrc/src/main/kotlin/hu/bsstudio/KotlinConventions.kt b/buildSrc/src/main/kotlin/hu/bsstudio/KotlinConventions.kt new file mode 100644 index 00000000..2ac906c5 --- /dev/null +++ b/buildSrc/src/main/kotlin/hu/bsstudio/KotlinConventions.kt @@ -0,0 +1,26 @@ +package hu.bsstudio + +import org.gradle.api.Plugin +import org.gradle.api.Project +import org.gradle.kotlin.dsl.apply +import org.gradle.kotlin.dsl.withType +import org.jetbrains.kotlin.gradle.dsl.JvmTarget +import org.jetbrains.kotlin.gradle.tasks.KotlinCompile + +class KotlinConventions : Plugin { + override fun apply(project: Project) { + project.pluginManager.apply { + apply(JavaConventions::class) + apply("org.jetbrains.kotlin.jvm") + apply("org.jetbrains.kotlin.plugin.spring") + apply("org.jetbrains.kotlin.plugin.jpa") + } + + project.tasks.withType { + compilerOptions { + jvmTarget.set(JvmTarget.JVM_21) + freeCompilerArgs.set(listOf("-Xjsr305=strict")) + } + } + } +} diff --git a/buildSrc/src/main/kotlin/hu/bsstudio/KotlinTestingConventions.kt b/buildSrc/src/main/kotlin/hu/bsstudio/KotlinTestingConventions.kt new file mode 100644 index 00000000..657a0f22 --- /dev/null +++ b/buildSrc/src/main/kotlin/hu/bsstudio/KotlinTestingConventions.kt @@ -0,0 +1,17 @@ +package hu.bsstudio + +import org.gradle.api.Plugin +import org.gradle.api.Project +import org.gradle.kotlin.dsl.apply +import org.gradle.kotlin.dsl.dependencies + +class KotlinTestingConventions : Plugin { + override fun apply(project: Project) { + project.pluginManager.apply(TestingConventions::class) + project.dependencies { + add("testImplementation", "io.mockk:mockk-jvm:1.13.12") + add("testImplementation", "com.ninja-squad:springmockk:4.0.2") + add("testImplementation", "io.kotest:kotest-assertions-core-jvm:5.9.1") + } + } +} diff --git a/buildSrc/src/main/kotlin/hu/bsstudio/SpotlessConventions.kt b/buildSrc/src/main/kotlin/hu/bsstudio/SpotlessConventions.kt new file mode 100644 index 00000000..20611196 --- /dev/null +++ b/buildSrc/src/main/kotlin/hu/bsstudio/SpotlessConventions.kt @@ -0,0 +1,40 @@ +package hu.bsstudio + +import com.diffplug.gradle.spotless.SpotlessExtension +import com.diffplug.gradle.spotless.SpotlessPlugin +import org.gradle.api.Plugin +import org.gradle.api.Project +import org.gradle.kotlin.dsl.apply +import org.gradle.kotlin.dsl.configure + +class SpotlessConventions : Plugin { + override fun apply(project: Project) { + project.pluginManager.apply(SpotlessPlugin::class) + + project.extensions.configure { + kotlin { + ktlint() + toggleOffOn() + } + java { + importOrder() + removeUnusedImports() + cleanthat() + googleJavaFormat() + } + kotlinGradle { + ktlint() + } + flexmark { + target("**/*.md") + flexmark() + } + yaml { + target("**/*.yml", "**/*.yaml") + jackson() + .yamlFeature("WRITE_DOC_START_MARKER", false) + .yamlFeature("MINIMIZE_QUOTES", true) + } + } + } +} diff --git a/buildSrc/src/main/kotlin/hu/bsstudio/SpringAppConventions.kt b/buildSrc/src/main/kotlin/hu/bsstudio/SpringAppConventions.kt new file mode 100644 index 00000000..c1f21088 --- /dev/null +++ b/buildSrc/src/main/kotlin/hu/bsstudio/SpringAppConventions.kt @@ -0,0 +1,41 @@ +package hu.bsstudio + +import org.gradle.api.Plugin +import org.gradle.api.Project +import org.gradle.api.plugins.TestReportAggregationPlugin +import org.gradle.api.tasks.testing.Test +import org.gradle.kotlin.dsl.apply +import org.gradle.kotlin.dsl.dependencies +import org.gradle.kotlin.dsl.named +import org.gradle.kotlin.dsl.withType +import org.gradle.testing.jacoco.plugins.JacocoReportAggregationPlugin +import org.springframework.boot.gradle.plugin.SpringBootPlugin +import org.springframework.boot.gradle.tasks.bundling.BootJar + +class SpringAppConventions : Plugin { + override fun apply(project: Project) { + project.pluginManager.apply { + apply(SpringModuleConventions::class) + apply(SpringBootPlugin::class) + apply(JacocoReportAggregationPlugin::class) + apply(TestReportAggregationPlugin::class) + } + + project.tasks.withType { + archiveClassifier.value("boot") + } + + project.tasks.named("test") { + finalizedBy( + project.tasks.named("testAggregateTestReport"), + project.tasks.named("testCodeCoverageReport"), + ) + } + + project.dependencies { + add("annotationProcessor", "org.springframework.boot:spring-boot-configuration-processor") + add("developmentOnly", "org.springframework.boot:spring-boot-devtools") + add("implementation", "org.springframework.boot:spring-boot-starter") + } + } +} diff --git a/buildSrc/src/main/kotlin/hu/bsstudio/SpringModuleConventions.kt b/buildSrc/src/main/kotlin/hu/bsstudio/SpringModuleConventions.kt new file mode 100644 index 00000000..2842b794 --- /dev/null +++ b/buildSrc/src/main/kotlin/hu/bsstudio/SpringModuleConventions.kt @@ -0,0 +1,12 @@ +package hu.bsstudio + +import org.gradle.api.Plugin +import org.gradle.api.Project +import org.gradle.kotlin.dsl.apply + +class SpringModuleConventions : Plugin { + override fun apply(project: Project) { + project.pluginManager.apply(DependencyManagement::class) + project.pluginManager.apply(SpotlessConventions::class) + } +} diff --git a/buildSrc/src/main/kotlin/hu/bsstudio/TestingConventions.kt b/buildSrc/src/main/kotlin/hu/bsstudio/TestingConventions.kt new file mode 100644 index 00000000..4c7943d7 --- /dev/null +++ b/buildSrc/src/main/kotlin/hu/bsstudio/TestingConventions.kt @@ -0,0 +1,87 @@ +package hu.bsstudio + +import org.gradle.api.Plugin +import org.gradle.api.Project +import org.gradle.api.tasks.testing.Test +import org.gradle.kotlin.dsl.apply +import org.gradle.kotlin.dsl.dependencies +import org.gradle.kotlin.dsl.withType +import org.gradle.testing.jacoco.plugins.JacocoPlugin +import org.gradle.testing.jacoco.tasks.JacocoCoverageVerification +import org.gradle.testing.jacoco.tasks.JacocoReport +import java.math.BigDecimal + +class TestingConventions : Plugin { + override fun apply(project: Project) { + project.pluginManager.apply { + apply(DependencyManagement::class) + apply(JacocoPlugin::class) + } + + project.dependencies { + add("testImplementation", "org.springframework.boot:spring-boot-starter-test") + } + + val excluded = + setOf( + "**/entity/**", + "**/exception/**", + "**/**Config**", + ) + + val jacocoTestReport = + project.tasks.withType { + // require xml report + reports { + xml.required.set(true) + } + // exclude excluded packages from test report + classDirectories.setFrom( + project.files( + classDirectories.files.map { + project.fileTree(it) { + exclude(excluded) + } + }, + ), + ) + } + + val jacocoTestCoverageVerification = + project.tasks.withType { + // set required coverage to 100% + violationRules { + rule { + limit { + minimum = BigDecimal("1.00") + } + } + } + // exclude excluded packages from test coverage verification + classDirectories.setFrom( + project.files( + classDirectories.files.map { + project.fileTree(it) { + exclude(excluded) + } + }, + ), + ) + } + + project.tasks.named("check") { + // coverage is part of check + finalizedBy(jacocoTestCoverageVerification) + } + + val test = + project.tasks.withType { + useJUnitPlatform() + // generate report after tests run + finalizedBy(jacocoTestReport) + } + + jacocoTestReport.configureEach { dependsOn(test) } + jacocoTestCoverageVerification.configureEach { dependsOn(test) } + } +} diff --git a/buildSrc/src/main/kotlin/integration-testing-conventions.gradle.kts b/buildSrc/src/main/kotlin/integration-testing-conventions.gradle.kts deleted file mode 100644 index 9d29dc2e..00000000 --- a/buildSrc/src/main/kotlin/integration-testing-conventions.gradle.kts +++ /dev/null @@ -1,42 +0,0 @@ -plugins { - id("testing-conventions") -} - -sourceSets { - create("intTest") { - compileClasspath += sourceSets.main.get().output - runtimeClasspath += sourceSets.main.get().output - } -} - -val intTestImplementation by configurations.getting { - extendsFrom(configurations.implementation.get()) -} -val intTestRuntimeOnly by configurations.getting - -configurations["intTestRuntimeOnly"].extendsFrom(configurations.runtimeOnly.get()) - -dependencies { - intTestImplementation("org.springframework.boot:spring-boot-starter-test") { - exclude(module = "hamcrest") // require developers to use KoTest - exclude(module = "org.assertj") // require developers to use KoTest - } - intTestImplementation("io.kotest:kotest-runner-junit5:5.9.1") -} - -val integrationTest = task("integrationTest") { - description = "Runs integration tests." - group = "verification" - - testClassesDirs = sourceSets["intTest"].output.classesDirs - classpath = sourceSets["intTest"].runtimeClasspath - shouldRunAfter("test") - - useJUnitPlatform() - - testLogging { - showStandardStreams = true - } -} - -tasks.check { dependsOn(integrationTest) } diff --git a/buildSrc/src/main/kotlin/java-conventions.gradle.kts b/buildSrc/src/main/kotlin/java-conventions.gradle.kts deleted file mode 100644 index c4428183..00000000 --- a/buildSrc/src/main/kotlin/java-conventions.gradle.kts +++ /dev/null @@ -1,14 +0,0 @@ -plugins { - `java-library` -} - -java { - targetCompatibility = JavaVersion.VERSION_21 - sourceCompatibility = JavaVersion.VERSION_21 -} - -configurations { - compileOnly { - extendsFrom(configurations.annotationProcessor.get()) - } -} diff --git a/buildSrc/src/main/kotlin/kotlin-conventions.gradle.kts b/buildSrc/src/main/kotlin/kotlin-conventions.gradle.kts deleted file mode 100644 index 9adec4ea..00000000 --- a/buildSrc/src/main/kotlin/kotlin-conventions.gradle.kts +++ /dev/null @@ -1,15 +0,0 @@ -import org.jetbrains.kotlin.gradle.dsl.JvmTarget - -plugins { - kotlin("jvm") - kotlin("plugin.spring") - kotlin("plugin.jpa") - id("java-conventions") -} - -tasks.withType { - compilerOptions { - freeCompilerArgs = listOf("-Xjsr305=strict") - jvmTarget.set(JvmTarget.JVM_21) - } -} diff --git a/buildSrc/src/main/kotlin/kotlin-testing-conventions.gradle.kts b/buildSrc/src/main/kotlin/kotlin-testing-conventions.gradle.kts deleted file mode 100644 index b97e0c44..00000000 --- a/buildSrc/src/main/kotlin/kotlin-testing-conventions.gradle.kts +++ /dev/null @@ -1,9 +0,0 @@ -plugins { - id("testing-conventions") -} - -dependencies { - testImplementation("io.mockk:mockk-jvm:1.13.12") - testImplementation("com.ninja-squad:springmockk:4.0.2") - testImplementation("io.kotest:kotest-assertions-core-jvm:5.9.1") -} diff --git a/buildSrc/src/main/kotlin/spotless-conventions.gradle.kts b/buildSrc/src/main/kotlin/spotless-conventions.gradle.kts deleted file mode 100644 index e05bcdfc..00000000 --- a/buildSrc/src/main/kotlin/spotless-conventions.gradle.kts +++ /dev/null @@ -1,29 +0,0 @@ -plugins { - id("com.diffplug.spotless") -} - -spotless { - kotlin { - ktlint() - toggleOffOn() - } - java { - importOrder() - removeUnusedImports() - cleanthat() - googleJavaFormat() - } - kotlinGradle{ - ktlint() - } - flexmark { - target("**/*.md") - flexmark() - } - yaml { - target("**/*.yml", "**/*.yaml") - jackson() - .yamlFeature("WRITE_DOC_START_MARKER", false) - .yamlFeature("MINIMIZE_QUOTES", true) - } -} diff --git a/buildSrc/src/main/kotlin/spring-app-conventions.gradle.kts b/buildSrc/src/main/kotlin/spring-app-conventions.gradle.kts deleted file mode 100644 index 1544e600..00000000 --- a/buildSrc/src/main/kotlin/spring-app-conventions.gradle.kts +++ /dev/null @@ -1,23 +0,0 @@ -plugins { - id("org.springframework.boot") - id("spring-module-conventions") - id("jacoco-report-aggregation") - id("test-report-aggregation") -} - -tasks.jar { - // if this convention is used we only expect bootJars to be built - // it will disable the default jar task - enabled = false -} - -tasks.test { - finalizedBy(tasks.named("testAggregateTestReport")) - finalizedBy(tasks.named("testCodeCoverageReport")) -} - -dependencies { - annotationProcessor("org.springframework.boot:spring-boot-configuration-processor") - developmentOnly("org.springframework.boot:spring-boot-devtools") - implementation("org.springframework.boot:spring-boot-starter") -} diff --git a/buildSrc/src/main/kotlin/spring-module-conventions.gradle.kts b/buildSrc/src/main/kotlin/spring-module-conventions.gradle.kts deleted file mode 100644 index 348dcdcb..00000000 --- a/buildSrc/src/main/kotlin/spring-module-conventions.gradle.kts +++ /dev/null @@ -1,3 +0,0 @@ -plugins { - id("dependency-management") -} diff --git a/buildSrc/src/main/kotlin/testing-conventions.gradle.kts b/buildSrc/src/main/kotlin/testing-conventions.gradle.kts deleted file mode 100644 index e05ad922..00000000 --- a/buildSrc/src/main/kotlin/testing-conventions.gradle.kts +++ /dev/null @@ -1,71 +0,0 @@ -plugins { - id("dependency-management") - jacoco -} - -dependencies { - testImplementation("org.springframework.boot:spring-boot-starter-test") - // kotlin related dependencies should move to kotlin-testing-conventions - testImplementation("io.mockk:mockk-jvm:1.13.12") - testImplementation("com.ninja-squad:springmockk:4.0.2") - testImplementation("io.kotest:kotest-assertions-core-jvm:5.9.1") -} - -tasks.test { - useJUnitPlatform() - // generate report after tests run - finalizedBy(tasks.jacocoTestReport) -} - -tasks.check { - // coverage is part of check - finalizedBy(tasks.jacocoTestCoverageVerification) -} - -val excluded = setOf( - "**/entity/**", - "**/exception/**", - "**/**Config**", -) - -tasks.jacocoTestReport { - // tests are required to run before generating the report - dependsOn(tasks.test) - // require xml report - reports { - xml.required.set(true) - } - // exclude excluded packages from test report - classDirectories.setFrom( - files( - classDirectories.files.map { - fileTree(it) { - exclude(excluded) - } - } - ) - ) -} - -tasks.jacocoTestCoverageVerification { - // tests are required to run before generating the coverage verification - dependsOn(tasks.test) - // set required coverage to 100% - violationRules { - rule { - limit { - minimum = BigDecimal("1.00") - } - } - } - // exclude excluded packages from test coverage verification - classDirectories.setFrom( - files( - classDirectories.files.map { - fileTree(it) { - exclude(excluded) - } - } - ) - ) -} diff --git a/client/build.gradle.kts b/client/build.gradle.kts index 167ebeee..d7bb9d3e 100644 --- a/client/build.gradle.kts +++ b/client/build.gradle.kts @@ -1,7 +1,7 @@ plugins { - id("spotless-conventions") - id("kotlin-conventions") - id("spring-module-conventions") + id("hu.bsstudio.spotless-conventions") + id("hu.bsstudio.kotlin-conventions") + id("hu.bsstudio.spring-module-conventions") } dependencies { diff --git a/gradle.properties b/gradle.properties index 7cfaeb7b..f4fe0fa2 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,5 +1,4 @@ org.gradle.caching=true -org.gradle.configuration-cache=true org.gradle.configureondemand=true org.gradle.parallel=true org.gradle.welcome=never diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index 5ab46329..b3b02e51 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -5,6 +5,9 @@ springDependencyManagementPlugin = "1.1.6" kotest = "5.9.1" spotless = "6.25.0" +[plugins] +spotless = { id = "com.diffplug.spotless", version.ref = "spotless" } + [libraries] springdocOpenapiStarterWebmvcUi = { module = "org.springdoc:springdoc-openapi-starter-webmvc-ui", version.ref = "springdoc" } kotestAssertionsJson = { module = "io.kotest:kotest-assertions-json", version.ref = "kotest" } diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index 9355b415..0aaefbca 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,6 +1,6 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-8.10-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-8.10.1-bin.zip networkTimeout=10000 validateDistributionUrl=true zipStoreBase=GRADLE_USER_HOME diff --git a/integration/build.gradle.kts b/integration/build.gradle.kts index d577c939..b3bb8901 100644 --- a/integration/build.gradle.kts +++ b/integration/build.gradle.kts @@ -1,7 +1,7 @@ plugins { - id("spotless-conventions") - id("kotlin-conventions") - id("integration-testing-conventions") + id("hu.bsstudio.spotless-conventions") + id("hu.bsstudio.kotlin-conventions") + id("hu.bsstudio.integration-testing-conventions") } dependencies { diff --git a/server/build.gradle.kts b/server/build.gradle.kts index 32f53558..70da7fa2 100644 --- a/server/build.gradle.kts +++ b/server/build.gradle.kts @@ -1,7 +1,6 @@ plugins { - id("spotless-conventions") - id("kotlin-conventions") - id("spring-app-conventions") + id("hu.bsstudio.kotlin-conventions") + id("hu.bsstudio.spring-app-conventions") } dependencies { diff --git a/server/client/build.gradle.kts b/server/client/build.gradle.kts index ffdf89bc..796c099e 100644 --- a/server/client/build.gradle.kts +++ b/server/client/build.gradle.kts @@ -1,8 +1,7 @@ plugins { - id("spotless-conventions") - id("kotlin-conventions") - id("spring-module-conventions") - id("kotlin-testing-conventions") + id("hu.bsstudio.kotlin-conventions") + id("hu.bsstudio.spring-module-conventions") + id("hu.bsstudio.kotlin-testing-conventions") } dependencies { diff --git a/server/common/build.gradle.kts b/server/common/build.gradle.kts index 676a3c35..3e264bd6 100644 --- a/server/common/build.gradle.kts +++ b/server/common/build.gradle.kts @@ -1,5 +1,4 @@ plugins { - id("spotless-conventions") - id("kotlin-conventions") - id("spring-module-conventions") + id("hu.bsstudio.kotlin-conventions") + id("hu.bsstudio.spring-module-conventions") } diff --git a/server/data/build.gradle.kts b/server/data/build.gradle.kts index 718e0705..0d0071c0 100644 --- a/server/data/build.gradle.kts +++ b/server/data/build.gradle.kts @@ -1,8 +1,7 @@ plugins { - id("spotless-conventions") - id("kotlin-conventions") - id("spring-module-conventions") - id("kotlin-testing-conventions") + id("hu.bsstudio.kotlin-conventions") + id("hu.bsstudio.spring-module-conventions") + id("hu.bsstudio.kotlin-testing-conventions") } dependencies { diff --git a/server/model/build.gradle.kts b/server/model/build.gradle.kts index 5dd76b75..d2eb56cb 100644 --- a/server/model/build.gradle.kts +++ b/server/model/build.gradle.kts @@ -1,8 +1,7 @@ plugins { - id("spotless-conventions") - id("kotlin-conventions") - id("spring-module-conventions") - id("kotlin-testing-conventions") + id("hu.bsstudio.kotlin-conventions") + id("hu.bsstudio.spring-module-conventions") + id("hu.bsstudio.kotlin-testing-conventions") } dependencies { api(project(":server:common")) diff --git a/server/operation/build.gradle.kts b/server/operation/build.gradle.kts index 61fb288d..37228f7e 100644 --- a/server/operation/build.gradle.kts +++ b/server/operation/build.gradle.kts @@ -1,8 +1,7 @@ plugins { - id("spotless-conventions") - id("kotlin-conventions") - id("spring-module-conventions") - id("kotlin-testing-conventions") + id("hu.bsstudio.kotlin-conventions") + id("hu.bsstudio.spring-module-conventions") + id("hu.bsstudio.kotlin-testing-conventions") } dependencies { diff --git a/server/service/build.gradle.kts b/server/service/build.gradle.kts index 40dda490..a421be80 100644 --- a/server/service/build.gradle.kts +++ b/server/service/build.gradle.kts @@ -1,8 +1,7 @@ plugins { - id("spotless-conventions") - id("kotlin-conventions") - id("spring-module-conventions") - id("kotlin-testing-conventions") + id("hu.bsstudio.kotlin-conventions") + id("hu.bsstudio.spring-module-conventions") + id("hu.bsstudio.kotlin-testing-conventions") } dependencies { diff --git a/server/web/build.gradle.kts b/server/web/build.gradle.kts index 30a1097d..84a69005 100644 --- a/server/web/build.gradle.kts +++ b/server/web/build.gradle.kts @@ -1,8 +1,7 @@ plugins { - id("spotless-conventions") - id("kotlin-conventions") - id("spring-module-conventions") - id("kotlin-testing-conventions") + id("hu.bsstudio.kotlin-conventions") + id("hu.bsstudio.spring-module-conventions") + id("hu.bsstudio.kotlin-testing-conventions") } dependencies {