diff --git a/.github/dependabot.yml b/.github/dependabot.yml deleted file mode 100644 index 10eea56b..00000000 --- a/.github/dependabot.yml +++ /dev/null @@ -1,23 +0,0 @@ -version: 2 - -updates: - - package-ecosystem: gradle - directory: "/" - schedule: - interval: daily - time: "09:00" - timezone: "Europe/Paris" - pull-request-branch-name: - separator: "-" - open-pull-requests-limit: 50 - rebase-strategy: disabled - - - package-ecosystem: "github-actions" - directory: "/" - schedule: - interval: daily - time: "09:00" - timezone: "Europe/Paris" - pull-request-branch-name: - separator: "-" - open-pull-requests-limit: 50 \ No newline at end of file diff --git a/.github/workflows/check-branch.yml b/.github/workflows/check-branch.yml index 078e65bf..de83fd11 100644 --- a/.github/workflows/check-branch.yml +++ b/.github/workflows/check-branch.yml @@ -12,7 +12,31 @@ concurrency: cancel-in-progress: true jobs: + validation: + name: Validate Gradle Wrapper + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + + - uses: gradle/actions/wrapper-validation@v3 + + format: + needs: [ validation ] + name: Verify Code Format + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + + - name: Initialization + uses: ./.github/actions/init + + - name: Check code style + uses: gradle/actions/setup-gradle@v3 + with: + arguments: detekt + build: + needs: [ validation, format ] runs-on: ubuntu-latest steps: - name: Checkout project @@ -26,7 +50,7 @@ jobs: - name: Build uses: gradle/gradle-build-action@v2.7.0 with: - arguments: build -x test + arguments: assemble - name: Test uses: nick-fields/retry@v2 diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 00000000..c7efd8ec --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,20 @@ +name: Release + +on: + push: + branches: + - main + +permissions: + contents: write + pull-requests: write + +jobs: + release: + runs-on: ubuntu-latest + outputs: + release_created: ${{ steps.release.outputs.release_created }} + tag_name: ${{ steps.release.outputs.tag_name }} + + steps: + - uses: google-github-actions/release-please-action@v4 diff --git a/.github/workflows/sonar.yml b/.github/workflows/sonar.yml index 2d67058b..22ff1744 100644 --- a/.github/workflows/sonar.yml +++ b/.github/workflows/sonar.yml @@ -24,19 +24,29 @@ jobs: with: jdk: 17 - - name: Build + - name: Check code style uses: gradle/gradle-build-action@v2.7.0 env: DETEKT_IGNORE_FAILURES: true with: - arguments: build detekt -x test + arguments: detekt + + - name: Build + uses: gradle/gradle-build-action@v2.7.0 + with: + arguments: assemble - name: Test uses: nick-fields/retry@v2 with: timeout_minutes: 10 max_attempts: 10 - command: ./gradlew test jacocoTestReport + command: ./gradlew test + + - name: Generate test report + uses: gradle/gradle-build-action@v2.7.0 + with: + arguments: koverXmlReport - name: SonarCloud Scan uses: SonarSource/sonarcloud-github-action@master diff --git a/.gitignore b/.gitignore index 0f610ce1..eb77b0cb 100644 --- a/.gitignore +++ b/.gitignore @@ -1,230 +1,9 @@ - -# Created by https://www.toptal.com/developers/gitignore/api/intellij,eclipse,kotlin,gradle -# Edit at https://www.toptal.com/developers/gitignore?templates=intellij,eclipse,kotlin,gradle - -### Eclipse ### -.metadata -bin/ -tmp/ -*.tmp -*.bak -*.swp -*~.nib -local.properties -.settings/ -.loadpath -.recommenders - -# External tool builders -.externalToolBuilders/ - -# Locally stored "Eclipse launch configurations" -*.launch - -# PyDev specific (Python IDE for Eclipse) -*.pydevproject - -# CDT-specific (C/C++ Development Tooling) -.cproject - -# CDT- autotools -.autotools - -# Java annotation processor (APT) -.factorypath - -# PDT-specific (PHP Development Tools) -.buildpath - -# sbteclipse plugin -.target - -# Tern plugin -.tern-project - -# TeXlipse plugin -.texlipse - -# STS (Spring Tool Suite) -.springBeans - -# Code Recommenders -.recommenders/ - -# Annotation Processing -.apt_generated/ -.apt_generated_test/ - -# Scala IDE specific (Scala & Java development for Eclipse) -.cache-main -.scala_dependencies -.worksheet - -# Uncomment this line if you wish to ignore the project description file. -# Typically, this file would be tracked if it contains build/dependency configurations: -#.project - -### Eclipse Patch ### -# Spring Boot Tooling -.sts4-cache/ - -### Intellij ### -# 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 - -.idea -# 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 - -# 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 - -### Intellij Patch ### -# Comment Reason: https://github.com/joeblau/gitignore.io/issues/186#issuecomment-215987721 - -# *.iml -# modules.xml -# .idea/misc.xml -# *.ipr - -# Sonarlint plugin -# https://plugins.jetbrains.com/plugin/7973-sonarlint -.idea/**/sonarlint/ - -# SonarQube Plugin -# https://plugins.jetbrains.com/plugin/7238-sonarqube-community-plugin -.idea/**/sonarIssues.xml - -# Markdown Navigator plugin -# https://plugins.jetbrains.com/plugin/7896-markdown-navigator-enhanced -.idea/**/markdown-navigator.xml -.idea/**/markdown-navigator-enh.xml -.idea/**/markdown-navigator/ - -# Cache file creation bug -# See https://youtrack.jetbrains.com/issue/JBR-2257 -.idea/$CACHE_FILE$ - -# CodeStream plugin -# https://plugins.jetbrains.com/plugin/12206-codestream -.idea/codestream.xml - -### Kotlin ### -# Compiled class file -*.class - -# Log file -*.log - -# BlueJ files -*.ctxt - -# Mobile Tools for Java (J2ME) -.mtj.tmp/ - -# Package Files # -*.jar -*.war -*.nar -*.ear -*.zip -*.tar.gz -*.rar - -# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml -hs_err_pid* - -### Gradle ### .gradle -build/ - -# Ignore Gradle GUI config -gradle-app.setting - -# Avoid ignoring Gradle wrapper jar file (.jar files are usually ignored) -!gradle-wrapper.jar +build +reports +dokka -# Cache of project -.gradletasknamecache - -# # Work around https://youtrack.jetbrains.com/issue/IDEA-116898 -# gradle/wrapper/gradle-wrapper.properties - -### Gradle Patch ### -**/build/ - -# Eclipse Gradle plugin generated files -# Eclipse Core -.project -# JDT-specific (Eclipse Java Development Tools) -.classpath - -# End of https://www.toptal.com/developers/gitignore/api/intellij,eclipse,kotlin,gradle - -dokka/ \ No newline at end of file +.idea +*.iml +.run +*.tmp diff --git a/.release-please-manifest.json b/.release-please-manifest.json new file mode 100644 index 00000000..37fcefaa --- /dev/null +++ b/.release-please-manifest.json @@ -0,0 +1,3 @@ +{ + ".": "1.0.0" +} diff --git a/build.gradle.kts b/build.gradle.kts index b25fd3c7..427c17ec 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -1,111 +1,86 @@ +import io.gitlab.arturbosch.detekt.Detekt +import org.jetbrains.kotlin.gradle.dsl.JvmTarget import org.jetbrains.kotlin.gradle.tasks.KotlinCompile plugins { - embeddedKotlin("jvm") - embeddedKotlin("plugin.serialization") - id("org.jetbrains.dokka") version "1.8.20" - id("com.google.devtools.ksp") version "1.9.0-1.0.13" - id("io.gitlab.arturbosch.detekt") version "1.23.1" + libs.plugins.run { + alias(kt.jvm) + alias(kt.serialization) + alias(dokka) + alias(detekt) + alias(ksp) + alias(kover) + } `java-library` `maven-publish` - jacoco } -val javaVersion get() = JavaVersion.VERSION_17 -val javaVersionString get() = javaVersion.toString() -val javaVersionInt get() = javaVersionString.toInt() +repositories { + mavenCentral() + maven("https://jitpack.io") +} -detekt { - // Allows having different behavior for CI. - // When building a branch, we want to fail the build if detekt fails. - // When building a PR, we want to ignore failures to report them in sonar. - val envIgnoreFailures = System.getenv("DETEKT_IGNORE_FAILURES")?.toBooleanStrictOrNull() ?: false - ignoreFailures = envIgnoreFailures +val jvmTargetVersion = JvmTarget.JVM_17 +val reportFolder = rootProject.file("reports") +val generatedFolder = layout.buildDirectory.dir("generated").get() +val dokkaOutputDir = rootProject.file("dokka") + +detekt { + ignoreFailures = System.getenv("DETEKT_IGNORE_FAILURES")?.toBooleanStrictOrNull() ?: false config.from(file("config/detekt/detekt.yml")) + reportsDir = reportFolder.resolve("detekt") } -jacoco { - reportsDirectory.set(file("${layout.buildDirectory.get()}/reports/jacoco")) -} +kover { + reports { + val reportKoverFolder = reportFolder.resolve("kover") -repositories { - mavenCentral() - maven("https://jitpack.io") + total { + xml { + this.xmlFile.set(reportKoverFolder.resolve("xml/result.xml")) + } + html { + this.htmlDir.set(reportKoverFolder.resolve("html")) + } + } + } } dependencies { - val ktorVersion = "2.3.3" - val ktSerializationVersion = "1.5.1" - val coroutinesCoreVersion = "1.7.3" - val loggingVersion = "3.0.5" - val mockkVersion = "1.13.5" - val junitVersion = "5.10.0" - val testContainersVersion = "1.18.3" - val lettuceVersion = "6.2.3.RELEASE" - val mojangApi = "v1.0.1" - val nettyCodecVersion = "4.1.96.Final" - val assertJcoreVersion = "3.24.2" - val komapperVersion = "1.12.0" - val kotestVersion = "5.6.2" - - api(kotlin("stdlib")) - api(kotlin("reflect")) - - api("com.github.Rushyverse:mojang-api:$mojangApi") - - // Ktor to interact with external API through HTTP - api("io.ktor:ktor-client-core:$ktorVersion") - api("io.ktor:ktor-client-cio:$ktorVersion") - api("io.ktor:ktor-client-serialization:$ktorVersion") - api("io.ktor:ktor-serialization-kotlinx-json:$ktorVersion") - api("io.ktor:ktor-client-content-negotiation:$ktorVersion") - - // Kotlin Serialization to serialize data for database and cache - api("org.jetbrains.kotlinx:kotlinx-serialization-json:$ktSerializationVersion") - api("org.jetbrains.kotlinx:kotlinx-serialization-protobuf:$ktSerializationVersion") - - // Interact with database - platform("org.komapper:komapper-platform:$komapperVersion").let { + platform(libs.komapper.platform).let { api(it) ksp(it) } - api("org.komapper:komapper-starter-r2dbc") - api("org.komapper:komapper-dialect-postgresql-r2dbc") - ksp("org.komapper:komapper-processor") - - // Redis cache - api("io.lettuce:lettuce-core:$lettuceVersion") - api("io.netty:netty-codec:$nettyCodecVersion") + ksp(libs.komapper.ksp) + api(libs.bundles.komapper) - // Logging information - api("io.github.microutils:kotlin-logging:$loggingVersion") + api(libs.mojang.api) + api(libs.bundles.ktor) + api(libs.bundles.ktSerialization) + api(libs.lettuce.core) + api(libs.logger) + testRuntimeOnly(libs.jupiter.engine) testImplementation(kotlin("test-junit5")) - testImplementation("org.jetbrains.kotlinx:kotlinx-coroutines-test:$coroutinesCoreVersion") - testImplementation("io.kotest:kotest-assertions-core:$kotestVersion") - testImplementation("io.kotest:kotest-assertions-json:$kotestVersion") - - // Create fake instance (mock) of components for tests - testImplementation("io.mockk:mockk:$mockkVersion") - - // Junit to run tests - testRuntimeOnly("org.junit.jupiter:junit-jupiter-engine:$junitVersion") - testImplementation("org.assertj:assertj-core:$assertJcoreVersion") - testImplementation("org.junit.jupiter:junit-jupiter-params:$junitVersion") - testImplementation("org.testcontainers:junit-jupiter:$testContainersVersion") - testImplementation("org.testcontainers:postgresql:$testContainersVersion") - testImplementation("org.komapper:komapper-dialect-postgresql-jdbc") + testImplementation(libs.komapper.jdbc.psql) + testImplementation(libs.bundles.testContainer) + testImplementation(libs.mockk) + testImplementation(libs.bundles.kotest) + testImplementation(libs.kt.coroutines.test) + testImplementation(libs.jupiter.params) + testImplementation(libs.assertj.core) } kotlin { - explicitApi = org.jetbrains.kotlin.gradle.dsl.ExplicitApiMode.Strict - jvmToolchain(javaVersionInt) +// explicitApi = org.jetbrains.kotlin.gradle.dsl.ExplicitApiMode.Strict + + jvmToolchain(jvmTargetVersion.target.toInt()) sourceSets { main { kotlin { - srcDir("build/generated") + srcDir(generatedFolder) } } @@ -121,11 +96,11 @@ kotlin { } } -val dokkaOutputDir = "${rootProject.projectDir}/dokka" - tasks { withType { - kotlinOptions.jvmTarget = javaVersionString + compilerOptions { + jvmTarget = jvmTargetVersion + } } test { @@ -144,14 +119,19 @@ tasks { dokkaHtml.configure { // CompileJava should be executed to build library in Jitpack dependsOn(deleteDokkaOutputDir, compileJava.get()) - outputDirectory.set(file(dokkaOutputDir)) + outputDirectory.set(dokkaOutputDir) } - jacocoTestReport { + withType().configureEach { + jvmTarget = jvmTargetVersion.target + exclude("**/${generatedFolder.asFile.name}/**") + reports { - xml.required.set(true) html.required.set(true) - csv.required.set(false) + xml.required.set(true) + txt.required.set(false) + sarif.required.set(false) + md.required.set(false) } } } diff --git a/gradle.properties b/gradle.properties index efe6c7df..dac7ce8f 100644 --- a/gradle.properties +++ b/gradle.properties @@ -2,5 +2,7 @@ kotlin.code.style=official org.gradle.parallel=true kotlin.incremental=true group=com.github.Rushyverse -version=1.0.0 description=Allows to interact with database, cache and other components +# x-release-please-start-version +version=1.0.0 +# x-release-please-end-version diff --git a/gradle/wrapper/gradle-wrapper.jar b/gradle/wrapper/gradle-wrapper.jar index 249e5832..7f93135c 100644 Binary files a/gradle/wrapper/gradle-wrapper.jar and b/gradle/wrapper/gradle-wrapper.jar differ diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index b982b3c6..a4413138 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,5 +1,7 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-8.3-rc-2-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-8.8-bin.zip +networkTimeout=10000 +validateDistributionUrl=true zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists diff --git a/gradlew b/gradlew index 1b6c7873..0adc8e1a 100644 --- a/gradlew +++ b/gradlew @@ -55,7 +55,7 @@ # Darwin, MinGW, and NonStop. # # (3) This script is generated from the Groovy template -# https://github.com/gradle/gradle/blob/master/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt +# https://github.com/gradle/gradle/blob/HEAD/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt # within the Gradle project. # # You can find Gradle at https://github.com/gradle/gradle/. @@ -80,13 +80,11 @@ do esac done -APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit - -APP_NAME="Gradle" +# This is normally unused +# shellcheck disable=SC2034 APP_BASE_NAME=${0##*/} - -# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. -DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' +# Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036) +APP_HOME=$( cd "${APP_HOME:-./}" > /dev/null && pwd -P ) || exit # Use the maximum available, or set MAX_FD != -1 to use that value. MAX_FD=maximum @@ -133,22 +131,29 @@ location of your Java installation." fi else JAVACMD=java - which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. + if ! command -v java >/dev/null 2>&1 + then + die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. Please set the JAVA_HOME variable in your environment to match the location of your Java installation." + fi fi # Increase the maximum file descriptors if we can. if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then case $MAX_FD in #( max*) + # In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked. + # shellcheck disable=SC3045 MAX_FD=$( ulimit -H -n ) || warn "Could not query maximum file descriptor limit" esac case $MAX_FD in #( '' | soft) :;; #( *) + # In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked. + # shellcheck disable=SC3045 ulimit -n "$MAX_FD" || warn "Could not set maximum file descriptor limit to $MAX_FD" esac @@ -193,6 +198,10 @@ if "$cygwin" || "$msys" ; then done fi + +# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' + # Collect all arguments for the java command; # * $DEFAULT_JVM_OPTS, $JAVA_OPTS, and $GRADLE_OPTS can contain fragments of # shell script including quotes and variable substitutions, so put them in @@ -205,6 +214,12 @@ set -- \ org.gradle.wrapper.GradleWrapperMain \ "$@" +# Stop when "xargs" is not available. +if ! command -v xargs >/dev/null 2>&1 +then + die "xargs is not available" +fi + # Use "xargs" to parse quoted args. # # With -n1 it outputs one arg per line, with the quotes and backslashes removed. diff --git a/gradlew.bat b/gradlew.bat index 107acd32..93e3f59f 100644 --- a/gradlew.bat +++ b/gradlew.bat @@ -14,7 +14,7 @@ @rem limitations under the License. @rem -@if "%DEBUG%" == "" @echo off +@if "%DEBUG%"=="" @echo off @rem ########################################################################## @rem @rem Gradle startup script for Windows @@ -25,7 +25,8 @@ if "%OS%"=="Windows_NT" setlocal set DIRNAME=%~dp0 -if "%DIRNAME%" == "" set DIRNAME=. +if "%DIRNAME%"=="" set DIRNAME=. +@rem This is normally unused set APP_BASE_NAME=%~n0 set APP_HOME=%DIRNAME% @@ -40,7 +41,7 @@ if defined JAVA_HOME goto findJavaFromJavaHome set JAVA_EXE=java.exe %JAVA_EXE% -version >NUL 2>&1 -if "%ERRORLEVEL%" == "0" goto execute +if %ERRORLEVEL% equ 0 goto execute echo. echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. @@ -75,13 +76,15 @@ set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar :end @rem End local scope for the variables with windows NT shell -if "%ERRORLEVEL%"=="0" goto mainEnd +if %ERRORLEVEL% equ 0 goto mainEnd :fail rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of rem the _cmd.exe /c_ return code! -if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 -exit /b 1 +set EXIT_CODE=%ERRORLEVEL% +if %EXIT_CODE% equ 0 set EXIT_CODE=1 +if not ""=="%GRADLE_EXIT_CONSOLE%" exit %EXIT_CODE% +exit /b %EXIT_CODE% :mainEnd if "%OS%"=="Windows_NT" endlocal diff --git a/release-please-config.json b/release-please-config.json new file mode 100644 index 00000000..a1e892a6 --- /dev/null +++ b/release-please-config.json @@ -0,0 +1,9 @@ +{ + "packages": { + ".": { + "release-type": "simple", + "extra-files": [ "gradle.properties" ] + } + }, + "$schema": "https://raw.githubusercontent.com/googleapis/release-please/main/schemas/config.json" +} diff --git a/renovate.json b/renovate.json new file mode 100644 index 00000000..185573da --- /dev/null +++ b/renovate.json @@ -0,0 +1,10 @@ +{ + "$schema": "https://docs.renovatebot.com/renovate-schema.json", + "extends": [ + "config:recommended" + ], + "labels": [ + "dependencies" + ], + "automerge": true +} diff --git a/settings.gradle.kts b/settings.gradle.kts index c70332dd..d69b7c7c 100644 --- a/settings.gradle.kts +++ b/settings.gradle.kts @@ -1 +1,99 @@ +pluginManagement { + repositories { + mavenCentral() + gradlePluginPortal() + } +} + +dependencyResolutionManagement { + versionCatalogs { + create("libs") { + // Plugin version + version("kotlin", "2.0.0") + version("dokka", "1.9.20") + version("detekt", "1.23.6") + version("ksp", "2.0.0-1.0.22") + version("kover", "0.8.1") + + // Dependency version + version("rushyverse-mojang", "v1.0.1") + version("ktor", "2.3.11") + version("kotlin-serialization", "1.6.3") + version("kotlin-coroutine", "1.9.0-RC") + version("komapper", "1.18.1") + version("lettuce", "6.3.2.RELEASE") + version("logger", "7.0.0") + version("test-container", "1.19.8") + version("mockk", "1.13.11") + version("kotest", "5.9.1") + version("jupiter", "5.10.2") + version("assertj", "3.26.0") + + plugin("kt-jvm", "org.jetbrains.kotlin.jvm").versionRef("kotlin") + plugin("kt-serialization", "org.jetbrains.kotlin.plugin.serialization").versionRef("kotlin") + plugin("dokka", "org.jetbrains.dokka").versionRef("dokka") + plugin("detekt", "io.gitlab.arturbosch.detekt").versionRef("detekt") + plugin("ksp", "com.google.devtools.ksp").versionRef("ksp") + plugin("kover", "org.jetbrains.kotlinx.kover").versionRef("kover") + + library("mojang-api", "com.github.Rushyverse", "mojang-api").versionRef("rushyverse-mojang") + + library("ktor-core", "io.ktor", "ktor-client-core").versionRef("ktor") + library("ktor-cio", "io.ktor", "ktor-client-cio").versionRef("ktor") + library("ktor-serialization", "io.ktor", "ktor-client-serialization").versionRef("ktor") + library("ktor-content-negotiation", "io.ktor", "ktor-client-content-negotiation").versionRef("ktor") + library("ktor-serialization-json", "io.ktor", "ktor-serialization-kotlinx-json").versionRef("ktor") + + library("kt-serialization-json", "org.jetbrains.kotlinx", "kotlinx-serialization-json").versionRef("kotlin-serialization") + library("kt-serialization-protobuf", "org.jetbrains.kotlinx", "kotlinx-serialization-protobuf").versionRef("kotlin-serialization") + + library("komapper-platform", "org.komapper", "komapper-platform").versionRef("komapper") + library("komapper-r2dbc", "org.komapper", "komapper-starter-r2dbc").versionRef("komapper") + library("komapper-r2dbc-psql", "org.komapper", "komapper-dialect-postgresql-r2dbc").versionRef("komapper") + library("komapper-jdbc-psql", "org.komapper", "komapper-dialect-postgresql-jdbc").versionRef("komapper") + library("komapper-ksp", "org.komapper", "komapper-processor").versionRef("komapper") + + library("lettuce-core", "io.lettuce", "lettuce-core").versionRef("lettuce") + + library("logger", "io.github.oshai", "kotlin-logging-jvm").versionRef("logger") + + // Test + library("container-jupiter", "org.testcontainers", "junit-jupiter").versionRef("test-container") + library("container-postgresql", "org.testcontainers", "postgresql").versionRef("test-container") + library("mockk", "io.mockk", "mockk").versionRef("mockk") + library("kotest-core", "io.kotest", "kotest-assertions-core").versionRef("kotest") + library("kotest-json", "io.kotest", "kotest-assertions-json").versionRef("kotest") + library("jupiter-engine", "org.junit.jupiter", "junit-jupiter-engine").versionRef("jupiter") + library("jupiter-params", "org.junit.jupiter", "junit-jupiter-params").versionRef("jupiter") + library("assertj-core", "org.assertj", "assertj-core").versionRef("assertj") + library("kt-coroutines-test", "org.jetbrains.kotlinx", "kotlinx-coroutines-test").versionRef("kotlin-coroutine") + + bundle( + "ktor", + listOf("ktor-core", "ktor-cio", "ktor-serialization", "ktor-content-negotiation", "ktor-serialization-json") + ) + bundle( + "ktSerialization", + listOf("kt-serialization-json", "kt-serialization-protobuf") + ) + bundle( + "komapper", + listOf("komapper-r2dbc", "komapper-r2dbc-psql") + ) + bundle( + "testContainer", + listOf("container-jupiter", "container-postgresql") + ) + bundle( + "kotest", + listOf("kotest-core", "kotest-json") + ) + } + } +} + +plugins { + id("org.gradle.toolchains.foojay-resolver-convention") version "0.8.0" +} + rootProject.name = "core" diff --git a/sonar-project.properties b/sonar-project.properties index 645add30..a20537dd 100644 --- a/sonar-project.properties +++ b/sonar-project.properties @@ -4,8 +4,8 @@ sonar.projectName=${project.name} sonar.projectVersion=${project.version} sonar.sources=src/main sonar.tests=src/test -sonar.kotlin.detekt.reportPaths=build/reports/detekt/detekt.xml -sonar.coverage.jacoco.xmlReportPaths=build/reports/jacoco/test/jacocoTestReport.xml +sonar.kotlin.detekt.reportPaths=reports/detekt/detekt.xml +sonar.coverage.jacoco.xmlReportPaths=reports/kover/xml/result.xml sonar.sourceEncoding=UTF-8 sonar.kotlin.threads=4 sonar.verbose=true diff --git a/src/main/kotlin/com/github/rushyverse/core/cache/CacheClient.kt b/src/main/kotlin/com/github/rushyverse/core/cache/CacheClient.kt index bec8b218..05725cce 100644 --- a/src/main/kotlin/com/github/rushyverse/core/cache/CacheClient.kt +++ b/src/main/kotlin/com/github/rushyverse/core/cache/CacheClient.kt @@ -7,6 +7,7 @@ import com.github.rushyverse.core.cache.message.publishIdentifiableMessage import com.github.rushyverse.core.cache.message.subscribeIdentifiableMessage import com.github.rushyverse.core.extension.acquire import com.github.rushyverse.core.extension.toTypedArray +import io.github.oshai.kotlinlogging.KotlinLogging import io.lettuce.core.RedisClient import io.lettuce.core.RedisURI import io.lettuce.core.api.AsyncCloseable @@ -26,7 +27,6 @@ import kotlinx.serialization.ExperimentalSerializationApi import kotlinx.serialization.KSerializer import kotlinx.serialization.builtins.serializer import kotlinx.serialization.protobuf.ProtoBuf -import mu.KotlinLogging import java.util.* import java.util.concurrent.CompletableFuture import kotlin.contracts.InvocationKind diff --git a/src/main/kotlin/com/github/rushyverse/core/supplier/database/DatabaseStoreEntitySupplier.kt b/src/main/kotlin/com/github/rushyverse/core/supplier/database/DatabaseStoreEntitySupplier.kt index 389c5718..dbd0cff3 100644 --- a/src/main/kotlin/com/github/rushyverse/core/supplier/database/DatabaseStoreEntitySupplier.kt +++ b/src/main/kotlin/com/github/rushyverse/core/supplier/database/DatabaseStoreEntitySupplier.kt @@ -3,10 +3,10 @@ package com.github.rushyverse.core.supplier.database import com.github.rushyverse.core.data.Guild import com.github.rushyverse.core.data.GuildInvite import com.github.rushyverse.core.data.GuildMember +import io.github.oshai.kotlinlogging.KotlinLogging import kotlinx.coroutines.async import kotlinx.coroutines.coroutineScope import kotlinx.coroutines.flow.* -import mu.KotlinLogging import java.time.Instant import java.util.* diff --git a/src/test/kotlin/com/github/rushyverse/core/container/ContainerManagement.kt b/src/test/kotlin/com/github/rushyverse/core/container/ContainerManagement.kt index f974af2c..56741619 100644 --- a/src/test/kotlin/com/github/rushyverse/core/container/ContainerManagement.kt +++ b/src/test/kotlin/com/github/rushyverse/core/container/ContainerManagement.kt @@ -2,9 +2,9 @@ package com.github.rushyverse.core.container import org.testcontainers.containers.PostgreSQLContainer -fun createPSQLContainer(): PostgreSQLContainer<*> = PostgreSQLContainer("postgres:15.2") +fun createPSQLContainer(): PostgreSQLContainer<*> = PostgreSQLContainer("postgres:16.3") .withDatabaseName("db") .withUsername("test") .withPassword("test") -fun createRedisContainer(): RedisContainer<*> = RedisContainer("redis:7.0.8") +fun createRedisContainer(): RedisContainer<*> = RedisContainer("redis:7.2.5")