Use configurate yaml branch, remove hocon config stuff

This commit is contained in:
Vankka 2023-05-20 21:05:10 +03:00
parent 7314fdb72b
commit 289ea8491f
No known key found for this signature in database
GPG Key ID: 6E50CB7A29B96AD0
7 changed files with 27 additions and 45 deletions

View File

@ -52,6 +52,8 @@ subprojects {
includeGroup 'github.scarsz'
includeGroup 'me.scarsz'
includeGroup 'me.minecraftauth'
includeGroup 'org.spongepowered' // Configurate yamlbranch
}
}
maven {

View File

@ -65,7 +65,6 @@ dependencies {
// Config
runtimeDownloadApi(libs.configurate.yaml)
runtimeDownloadApi(libs.configurate.hocon)
// Logging
compileOnly(libs.log4j.core)

View File

@ -1,33 +0,0 @@
/*
* This file is part of DiscordSRV, licensed under the GPLv3 License
* Copyright (c) 2016-2023 Austin "Scarsz" Shapiro, Henri "Vankka" Schubin and DiscordSRV contributors
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
package com.discordsrv.common.config.manager.loader;
import org.jetbrains.annotations.ApiStatus;
import org.spongepowered.configurate.hocon.HoconConfigurationLoader;
import org.spongepowered.configurate.loader.AbstractConfigurationLoader;
public interface HoconConfigLoaderProvider extends ConfigLoaderProvider<HoconConfigurationLoader> {
@Override
@ApiStatus.NonExtendable
default AbstractConfigurationLoader.Builder<?, HoconConfigurationLoader> createBuilder() {
return HoconConfigurationLoader.builder()
.prettyPrinting(true);
}
}

View File

@ -22,6 +22,9 @@ import org.jetbrains.annotations.ApiStatus;
import org.spongepowered.configurate.loader.AbstractConfigurationLoader;
import org.spongepowered.configurate.yaml.NodeStyle;
import org.spongepowered.configurate.yaml.YamlConfigurationLoader;
import org.spongepowered.configurate.yaml.internal.snakeyaml.DumperOptions;
import java.lang.reflect.Field;
public interface YamlConfigLoaderProvider extends ConfigLoaderProvider<YamlConfigurationLoader> {
@ -36,8 +39,21 @@ public interface YamlConfigLoaderProvider extends ConfigLoaderProvider<YamlConfi
@Override
@ApiStatus.NonExtendable
default AbstractConfigurationLoader.Builder<?, YamlConfigurationLoader> createBuilder() {
return YamlConfigurationLoader.builder()
YamlConfigurationLoader.Builder builder = YamlConfigurationLoader.builder()
.commentsEnabled(true)
.nodeStyle(nodeStyle())
.indent(indent());
try {
Field field = builder.getClass().getDeclaredField("options");
field.setAccessible(true);
DumperOptions dumperOptions = (DumperOptions) field.get(builder);
dumperOptions.setSplitLines(false);
} catch (ReflectiveOperationException e) {
e.printStackTrace();
}
return builder;
}
}

View File

@ -21,7 +21,6 @@ dependencies {
implementation(project(':velocity')) { transitive = false }
api(libs.configurate.yaml)
api(libs.configurate.hocon)
}
application {

View File

@ -82,9 +82,8 @@ dependencyResolutionManagement {
library('jackson-databind', 'com.fasterxml.jackson.core', 'jackson-databind').version('2.14.2')
// Config(urate)
version('configurate', '4.1.2')
version('configurate', '4.2.0-yamlbranch-4')
library('configurate-yaml', 'org.spongepowered', 'configurate-yaml').versionRef('configurate')
library('configurate-hocon', 'org.spongepowered', 'configurate-hocon').versionRef('configurate')
// DB
library('hikaricp', 'com.zaxxer', 'HikariCP').version {

View File

@ -8,14 +8,14 @@ shadowJar {
allprojects {
repositories {
exclusiveContent {
forRepository {
// exclusiveContent {
// forRepository {
maven { url 'https://repo.spongepowered.org/maven/' }
}
filter {
includeGroup 'org.spongepowered'
}
}
// }
// filter {
// includeGroup 'org.spongepowered'
// }
// }
}
dependencies {