From 1d0bdead975fa029bef3105231e5ce848d5ff9a6 Mon Sep 17 00:00:00 2001 From: "Andrey.Tarashevskiy" Date: Thu, 12 Dec 2024 00:28:04 +0200 Subject: [PATCH] Release 0.1.29: Kotlin 2.0.21 + other libraries, gradle 8.11.1 migrate from openkeepass to KeePassJava2, remove detekt --- build.gradle.kts | 70 +++++++--------- detekt.yml | 79 ------------------- gradle/wrapper/gradle-wrapper.properties | 2 +- konfy-k8s/build.gradle.kts | 2 +- konfy-keepass/build.gradle.kts | 5 +- .../tanvd/konfy/keepass/KeepassClient.kt | 11 +-- konfy-ssm/build.gradle.kts | 10 +-- konfy-toml/build.gradle.kts | 6 +- konfy/build.gradle.kts | 8 +- .../konfy/conversion/ConversionService.kt | 2 +- .../konfy/provider/PropertiesProvider.kt | 1 + 11 files changed, 52 insertions(+), 144 deletions(-) delete mode 100644 detekt.yml diff --git a/build.gradle.kts b/build.gradle.kts index fe0e46f..5faa0a6 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -1,29 +1,47 @@ -import org.jetbrains.kotlin.gradle.tasks.KotlinJvmCompile +import org.jetbrains.kotlin.gradle.dsl.JvmTarget +import org.jetbrains.kotlin.gradle.dsl.KotlinVersion import tanvd.kosogor.proxy.publishJar group = "tanvd.konfy" -version = "0.1.28" +version = "0.1.29" plugins { - id("tanvd.kosogor") version "1.0.18" apply false - id("io.gitlab.arturbosch.detekt") version ("1.22.0") apply true - kotlin("jvm") version "1.9.22" apply false + id("tanvd.kosogor") version "1.0.22" apply true + kotlin("jvm") version "2.0.21" apply true `kotlin-dsl` `maven-publish` } +repositories { + mavenCentral() +} + subprojects { - apply { - plugin("kotlin") - plugin("maven-publish") - plugin("tanvd.kosogor") - plugin("io.gitlab.arturbosch.detekt") - } + apply(plugin = "kotlin") + apply(plugin = "tanvd.kosogor") repositories { mavenCentral() } + java { + toolchain { + languageVersion.set(JavaLanguageVersion.of("17")) + } + } + + kotlin { + jvmToolchain(17) + compilerOptions { + jvmTarget.set(JvmTarget.JVM_17) + apiVersion.set(KotlinVersion.KOTLIN_1_9) + languageVersion.set(KotlinVersion.KOTLIN_2_0) + // https://jakewharton.com/kotlins-jdk-release-compatibility-flag/ + // https://youtrack.jetbrains.com/issue/KT-49746/Support-Xjdk-release-in-gradle-toolchain#focus=Comments-27-8935065.0-0 + freeCompilerArgs.addAll("-Xjdk-release=17") + } + } + publishJar { } publishing { @@ -39,34 +57,4 @@ subprojects { } } } - - java { - toolchain { - languageVersion.set(JavaLanguageVersion.of(17)) - } - } - - tasks.withType().configureEach { - kotlinOptions { - jvmTarget = "17" - apiVersion = "1.9" - languageVersion = "1.9" - freeCompilerArgs += "-Xuse-ir" - } - } - - detekt { - parallel = true - - config = rootProject.files("detekt.yml") - - reports { - xml { - enabled = false - } - html { - enabled = false - } - } - } } diff --git a/detekt.yml b/detekt.yml deleted file mode 100644 index 55fc399..0000000 --- a/detekt.yml +++ /dev/null @@ -1,79 +0,0 @@ -build: - maxIssues: 10 - -comments: - UndocumentedPublicClass: - active: true - excludes: [ '**/test/**' ] - UndocumentedPublicFunction: - active: false - excludes: [ '**/test/**' ] - UndocumentedPublicProperty: - active: false - excludes: [ '**/test/**' ] - -complexity: - StringLiteralDuplication: - active: true - threshold: 5 - ignoreAnnotation: true - excludeStringsWithLessThan5Characters: true - ignoreStringsRegex: '$^' - ComplexInterface: - active: true - threshold: 10 - includeStaticDeclarations: false - includePrivateDeclarations: false - ComplexMethod: - active: true - ignoreSingleWhenExpression: true - LargeClass: - active: true - MethodOverloading: - active: true - -exceptions: - NotImplementedDeclaration: - active: true - InstanceOfCheckForException: - active: true - RethrowCaughtException: - active: true - ReturnFromFinally: - active: true - ThrowingExceptionFromFinally: - active: true - ThrowingExceptionsWithoutMessageOrCause: - active: true - ThrowingNewInstanceOfSameException: - active: true - -potential-bugs: - UnsafeCast: - active: true - UselessPostfixExpression: - active: true - - -style: - CollapsibleIfStatements: - active: true - MagicNumber: - ignorePropertyDeclaration: true - ignoreAnnotation: true - ignoreEnums: true - ignoreNumbers: [ '-1', '0', '1', '2', '100', '1000' ] - NestedClassesVisibility: - active: true - RedundantVisibilityModifierRule: - active: true - ReturnCount: - active: true - excludeGuardClauses: true - SpacingBetweenPackageAndImports: - active: true - UnusedPrivateMember: - active: true - allowedNames: '(_|ignored|expected)' - UseCheckOrError: - active: true diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index a80b22c..e2847c8 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.6-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-8.11.1-bin.zip networkTimeout=10000 validateDistributionUrl=true zipStoreBase=GRADLE_USER_HOME diff --git a/konfy-k8s/build.gradle.kts b/konfy-k8s/build.gradle.kts index 8beec3c..118a53b 100644 --- a/konfy-k8s/build.gradle.kts +++ b/konfy-k8s/build.gradle.kts @@ -3,5 +3,5 @@ version = rootProject.version dependencies { api(project(":konfy")) - api("io.kubernetes", "client-java", "20.0.0") + api("io.kubernetes", "client-java", "22.0.0") } diff --git a/konfy-keepass/build.gradle.kts b/konfy-keepass/build.gradle.kts index 5830451..5eea63c 100644 --- a/konfy-keepass/build.gradle.kts +++ b/konfy-keepass/build.gradle.kts @@ -4,10 +4,7 @@ version = rootProject.version dependencies { api(project(":konfy")) - api("de.slackspace", "openkeepass", "0.8.2") { - exclude("org.simpleframework", "simple-xml") - } - api("com.carrotsearch.thirdparty", "simple-xml-safe", "2.7.1") + api("org.linguafranca.pwdb", "KeePassJava2-dom", "2.2.2") } diff --git a/konfy-keepass/src/main/kotlin/tanvd/konfy/keepass/KeepassClient.kt b/konfy-keepass/src/main/kotlin/tanvd/konfy/keepass/KeepassClient.kt index 8ecd536..d342a2e 100644 --- a/konfy-keepass/src/main/kotlin/tanvd/konfy/keepass/KeepassClient.kt +++ b/konfy-keepass/src/main/kotlin/tanvd/konfy/keepass/KeepassClient.kt @@ -1,17 +1,18 @@ package tanvd.konfy.keepass -import de.slackspace.openkeepass.KeePassDatabase -import de.slackspace.openkeepass.domain.KeePassFile +import org.linguafranca.pwdb.kdbx.KdbxCreds +import org.linguafranca.pwdb.kdbx.dom.DomDatabaseWrapper import java.io.File internal class KeepassClient(databaseFile: File, masterPassword: String) { - private lateinit var database: KeePassFile + private lateinit var database: DomDatabaseWrapper init { - if (databaseFile.exists()) database = KeePassDatabase.getInstance(databaseFile).openDatabase(masterPassword) + val credentials = KdbxCreds(masterPassword.toByteArray()) + if (databaseFile.exists()) database = DomDatabaseWrapper.load(credentials, databaseFile.inputStream()) } fun get(title: String): String? { - return database.getEntryByTitle(title)?.password + return database.findEntries { it.title == title }.firstOrNull()?.password } } diff --git a/konfy-ssm/build.gradle.kts b/konfy-ssm/build.gradle.kts index 497810c..c4c375a 100644 --- a/konfy-ssm/build.gradle.kts +++ b/konfy-ssm/build.gradle.kts @@ -5,12 +5,12 @@ dependencies { api(project(":konfy")) api("software.amazon.awssdk", "ssm", "2.25.13") - implementation("org.slf4j", "slf4j-api", "1.7.36") + implementation("org.slf4j", "slf4j-api", "2.0.16") - testImplementation("org.testng", "testng", "7.9.0") - testImplementation("org.assertj", "assertj-core", "3.25.3") - testImplementation("io.mockk", "mockk", "1.13.9") - testImplementation("ch.qos.logback:logback-classic:1.5.0") + testImplementation("org.testng", "testng", "7.10.2") + testImplementation("org.assertj", "assertj-core", "3.26.3") + testImplementation("io.mockk", "mockk", "1.13.13") + testImplementation("ch.qos.logback:logback-classic:1.5.12") } tasks.test { diff --git a/konfy-toml/build.gradle.kts b/konfy-toml/build.gradle.kts index 3f31cad..62a4a73 100644 --- a/konfy-toml/build.gradle.kts +++ b/konfy-toml/build.gradle.kts @@ -6,9 +6,9 @@ dependencies { api("org.tomlj", "tomlj", "1.1.1") - testImplementation("org.assertj", "assertj-core", "3.24.2") - testImplementation("org.junit.jupiter", "junit-jupiter-api", "5.9.2") - testRuntimeOnly("org.junit.jupiter", "junit-jupiter-engine", "5.9.2") + testImplementation("org.assertj", "assertj-core", "3.26.3") + testImplementation("org.junit.jupiter", "junit-jupiter-api", "5.11.3") + testRuntimeOnly("org.junit.jupiter", "junit-jupiter-engine", "5.11.3") } diff --git a/konfy/build.gradle.kts b/konfy/build.gradle.kts index 1d7c69a..5263a40 100644 --- a/konfy/build.gradle.kts +++ b/konfy/build.gradle.kts @@ -2,8 +2,8 @@ group = rootProject.group version = rootProject.version dependencies { - api(kotlin("stdlib")) - api(kotlin("reflect")) - api("org.jetbrains.kotlinx:kotlinx-datetime:0.5.0") - api("org.jetbrains.kotlinx:kotlinx-coroutines-core:1.7.3") + api(kotlin("stdlib", "2.0.21")) + api(kotlin("reflect", "2.0.21")) + api("org.jetbrains.kotlinx:kotlinx-datetime:0.6.1") + api("org.jetbrains.kotlinx:kotlinx-coroutines-core:1.9.0") } diff --git a/konfy/src/main/kotlin/tanvd/konfy/conversion/ConversionService.kt b/konfy/src/main/kotlin/tanvd/konfy/conversion/ConversionService.kt index a636776..530f352 100644 --- a/konfy/src/main/kotlin/tanvd/konfy/conversion/ConversionService.kt +++ b/konfy/src/main/kotlin/tanvd/konfy/conversion/ConversionService.kt @@ -14,7 +14,7 @@ import java.math.BigInteger object ConversionService { fun convert(value: String, type: Type): Any = when (type) { is WildcardType -> convert(value, type.upperBounds.single()) - Int::class.java, java.lang.Integer::class.java -> value.toInt() + Int::class.java, Integer::class.java -> value.toInt() Float::class.java, java.lang.Float::class.java -> value.toFloat() Double::class.java, java.lang.Double::class.java -> value.toDouble() Long::class.java, java.lang.Long::class.java -> value.toLong() diff --git a/konfy/src/main/kotlin/tanvd/konfy/provider/PropertiesProvider.kt b/konfy/src/main/kotlin/tanvd/konfy/provider/PropertiesProvider.kt index 7eb28e6..82da7c6 100644 --- a/konfy/src/main/kotlin/tanvd/konfy/provider/PropertiesProvider.kt +++ b/konfy/src/main/kotlin/tanvd/konfy/provider/PropertiesProvider.kt @@ -13,6 +13,7 @@ class PropertiesProvider(private val file: File, private val convert: (String, Type) -> Any? = ConversionService::convert) : ConfigProvider() { private val properties by lazy { Properties().apply { load(file.reader()) } } + @Suppress("UNCHECKED_CAST") override fun fetch(key: String, type: Type): N? { val value = properties.getProperty(key) ?: return null return convert(value, type) as N?