Skip to content

Commit

Permalink
Release 0.1.29: Kotlin 2.0.21 + other libraries, gradle 8.11.1 migrat…
Browse files Browse the repository at this point in the history
…e from openkeepass to KeePassJava2, remove detekt
  • Loading branch information
Tapac committed Dec 11, 2024
1 parent 499a27e commit 1d0bdea
Show file tree
Hide file tree
Showing 11 changed files with 52 additions and 144 deletions.
70 changes: 29 additions & 41 deletions build.gradle.kts
Original file line number Diff line number Diff line change
@@ -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 {
Expand All @@ -39,34 +57,4 @@ subprojects {
}
}
}

java {
toolchain {
languageVersion.set(JavaLanguageVersion.of(17))
}
}

tasks.withType<KotlinJvmCompile>().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
}
}
}
}
79 changes: 0 additions & 79 deletions detekt.yml

This file was deleted.

2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -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
Expand Down
2 changes: 1 addition & 1 deletion konfy-k8s/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -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")
}
5 changes: 1 addition & 4 deletions konfy-keepass/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -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")
}


Original file line number Diff line number Diff line change
@@ -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
}
}
10 changes: 5 additions & 5 deletions konfy-ssm/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
6 changes: 3 additions & 3 deletions konfy-toml/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -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")
}


Expand Down
8 changes: 4 additions & 4 deletions konfy/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -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")
}
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 <N : Any> fetch(key: String, type: Type): N? {
val value = properties.getProperty(key) ?: return null
return convert(value, type) as N?
Expand Down

0 comments on commit 1d0bdea

Please sign in to comment.