1
0

Use common versions

This commit is contained in:
Hubert Van De Walle 2020-10-06 18:40:38 +02:00
parent f0155dea31
commit a1dde23fb3
2 changed files with 45 additions and 36 deletions

View File

@ -16,6 +16,26 @@ display = "Java Version"
default = "1.4.10"
display = "Kotlin Version"
[versions]
http4k = "3.265.0"
pebble = "3.1.4"
caffeine = "2.8.5"
logback = "1.2.3"
mariadb = "2.6.2"
h2 = "1.4.200"
flyway = "7.0.0"
hikaricp = "3.4.5"
ktorm = "3.0.0"
junit = "5.7.0"
mokk = "1.10.0"
hamkrest = "1.7.0.3"
assertj = "3.17.2"
kodein-di = "7.1.0"
koin = "2.1.6"
jackson = "2.11.2"
kotlinx-serialization = "1.0-M1-1.4.0-rc"
arrow-core = "0.10.5"
[repositories]
[repositories.jcenter]
@ -29,14 +49,13 @@ url = "https://dl.bintray.com/arrow-kt/arrow-kt/"
[dependencies.http4k]
groupId = "org.http4k"
artifactId = "http4k-core"
version = "3.264.0"
category = "http4k"
default = true
[dependencies.http4k-server-jetty]
groupId = "org.http4k"
artifactId = "http4k-server-jetty"
version = "3.264.0"
version = "http4k"
category = "http4k"
default = true
logger = "org.eclipse.jetty"
@ -44,94 +63,85 @@ logger = "org.eclipse.jetty"
[dependencies.http4k-server-apache]
groupId = "org.http4k"
artifactId = "http4k-server-apache"
version = "3.264.0"
version = "http4k"
category = "http4k"
[dependencies.http4k-client-apache]
groupId = "org.http4k"
artifactId = "http4k-client-apache"
version = "3.264.0"
version = "http4k"
category = "http4k"
[dependencies.http4k-format-jackson]
groupId = "org.http4k"
artifactId = "http4k-format-jackson"
version = "3.264.0"
version = "http4k"
category = "http4k"
[dependencies.http4k-format-kotlinx-serialization]
groupId = "org.http4k"
artifactId = "http4k-format-kotlinx-serialization"
version = "3.264.0"
version = "http4k"
category = "http4k"
[dependencies.http4k-contract]
groupId = "org.http4k"
artifactId = "http4k-contract"
version = "3.264.0"
version = "http4k"
category = "http4k"
[dependencies.pebble]
groupId = "io.pebbletemplates"
artifactId = "pebble"
version = "3.1.4"
default = true
logger = "com.mitchellbosecke.pebble"
[dependencies.caffeine]
groupId = "com.github.ben-manes.caffeine"
artifactId = "caffeine"
version = "2.8.5"
[dependencies.logback]
groupId = "ch.qos.logback"
artifactId = "logback-classic"
version = "1.2.3"
default = true
[dependencies.mariadb]
groupId = "org.mariadb.jdbc"
artifactId = "mariadb-java-client"
version = "2.6.2"
category = "database"
[dependencies.h2]
groupId = "com.h2database"
artifactId = "h2"
version = "1.4.200"
category = "database"
[dependencies.flyway]
groupId = "org.flywaydb"
artifactId = "flyway-core"
version = "6.5.4"
category = "database"
logger = "org.flywaydb.core"
[dependencies.HikariCP]
[dependencies.hikaricp]
groupId = "com.zaxxer"
artifactId = "HikariCP"
version = "3.4.5"
category = "database"
logger = "com.zaxxer.hikari"
[dependencies.Ktorm]
[dependencies.ktorm]
groupId = "me.liuwj.ktorm"
artifactId = "ktorm-core"
version = "3.0.0"
category = "database"
logger = "me.liuwj.ktorm.database"
[dependencies.Ktorm-Mysql]
[dependencies.ktorm-mysql]
groupId = "me.liuwj.ktorm"
artifactId = "ktorm-support-mysql"
version = "3.0.0"
version = "ktorm"
category = "database"
[dependencies.junit]
groupId = "org.junit.jupiter"
artifactId = "junit-jupiter"
version = "5.7.0"
scope = "test"
category = "test"
default = true
@ -139,7 +149,7 @@ default = true
[dependencies.junit-params]
groupId = "org.junit.jupiter"
artifactId = "junit-jupiter-params"
version = "5.7.0"
version = "junit"
scope = "test"
category = "test"
default = true
@ -147,54 +157,46 @@ default = true
[dependencies.mokk]
groupId = "io.mockk"
artifactId = "mockk"
version = "1.10.0"
scope = "test"
category = "test"
[dependencies.hamkrest]
groupId = "com.natpryce"
artifactId = "hamkrest"
version = "1.7.0.3"
scope = "test"
category = "test"
[dependencies.assertJ]
[dependencies.assertj]
groupId = "org.assertj"
artifactId = "assertj-core"
version = "3.17.2"
scope = "test"
category = "test"
default = true
[dependencies.Kodein-DI]
[dependencies.kodein-di]
groupId = "org.kodein.di"
artifactId = "kodein-di-jvm"
version = "7.0.0"
category = "injection"
repository = "jcenter"
[dependencies.Koin]
[dependencies.koin]
groupId = "org.koin"
artifactId = "koin-core"
version = "2.1.6"
category = "injection"
repository = "jcenter"
default = true
[dependencies.Jackson]
[dependencies.jackson]
groupId = "com.fasterxml.jackson.module"
artifactId = "jackson-module-kotlin"
version = "2.11.2"
category = "serialization"
[dependencies.Kotlinx-serialization]
[dependencies.kotlinx-serialization]
groupId = "org.jetbrains.kotlinx"
artifactId = "kotlinx-serialization-runtime"
version = "1.0-M1-1.4.0-rc"
category = "serialization"
[dependencies.Arrow-core]
[dependencies.arrow-core]
groupId = "io.arrow-kt"
artifactId = "arrow-core"
version = "0.10.5"
repository = "arrow"

View File

@ -1,5 +1,6 @@
package starter.config
import com.electronwill.nightconfig.core.UnmodifiableConfig
import com.electronwill.nightconfig.core.file.FileConfig
import starter.*
import com.electronwill.nightconfig.core.Config as NightConfig
@ -19,13 +20,19 @@ class Config {
val cfg = FileConfig.of("config.toml")
cfg.load()
@Suppress("UNCHECKED_CAST")
val versions = cfg.get<UnmodifiableConfig>("versions").valueMap() as Map<String, String>
val dependencies = cfg.configMap("dependencies")
.map { (name, values) ->
val versionKey: String = values["version"] ?: name
val version = versions[versionKey] ?: error("Missing version for $name")
Dependency(
name,
values["groupId"],
values["artifactId"],
values["version"],
version,
values.getOrElse("default", false),
values.getEnumOrElse("category", Category.Other),
values.getEnumOrElse("scope", Scope.Compile),