Use common versions
This commit is contained in:
@@ -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),
|
||||
|
||||
Reference in New Issue
Block a user