mirror of
https://github.com/Suwayomi/Suwayomi-Server.git
synced 2026-07-04 03:14:40 -05:00
Feature/streamline settings (#1614)
* Cleanup graphql setting mutation
* Validate values read from config
* Generate server-reference.conf files from ServerConfig
* Remove unnecessary enum value handling in config value update
Commit df0078b725 introduced the usage of config4k, which handles enums automatically. Thus, this handling is outdated and not needed anymore
* Generate gql SettingsType from ServerConfig
* Extract settings backup logic
* Generate settings backup files
* Move "group" arg to second position
To make it easier to detect and have it at the same position consistently for all settings.
* Remove setting generation from compilation
* Extract setting generation code into new module
* Extract pure setting generation code into new module
* Remove generated settings files from src tree
* Force each setting to set a default value
This commit is contained in:
62
server/server-config-generate/build.gradle.kts
Normal file
62
server/server-config-generate/build.gradle.kts
Normal file
@@ -0,0 +1,62 @@
|
||||
plugins {
|
||||
id(
|
||||
libs.plugins.kotlin.jvm
|
||||
.get()
|
||||
.pluginId,
|
||||
)
|
||||
}
|
||||
|
||||
dependencies {
|
||||
// Core Kotlin
|
||||
implementation(kotlin("stdlib-jdk8"))
|
||||
implementation(kotlin("reflect"))
|
||||
|
||||
// Config handling
|
||||
implementation(libs.config)
|
||||
implementation(libs.config4k)
|
||||
|
||||
// Logging
|
||||
implementation(libs.slf4japi)
|
||||
implementation(libs.kotlinlogging)
|
||||
|
||||
// Serialization
|
||||
implementation(libs.serialization.json)
|
||||
implementation(libs.serialization.protobuf)
|
||||
|
||||
// Depend on server-config module for access to ServerConfig and SettingsRegistry
|
||||
implementation(projects.server.serverConfig)
|
||||
}
|
||||
|
||||
tasks {
|
||||
register<JavaExec>("generateSettings") {
|
||||
group = "build setup"
|
||||
description = "Generates settings from ServerConfig"
|
||||
|
||||
dependsOn(compileKotlin)
|
||||
|
||||
// Use this module's classpath which includes server-config as dependency
|
||||
classpath = sourceSets.main.get().runtimeClasspath
|
||||
|
||||
mainClass.set("suwayomi.tachidesk.server.settings.generation.SettingsGeneratorKt")
|
||||
|
||||
// Get reference to server project for file paths
|
||||
val serverProject = project(":server")
|
||||
|
||||
// Set working directory to the server module directory
|
||||
workingDir = serverProject.projectDir
|
||||
|
||||
inputs.files(
|
||||
serverProject.sourceSets.main.get().allSource.filter {
|
||||
it.name.contains("ServerConfig") || it.name.contains("Settings")
|
||||
},
|
||||
)
|
||||
|
||||
outputs.files(
|
||||
serverProject.file("build/generated/src/main/resources/server-reference.conf"),
|
||||
serverProject.file("build/generated/src/test/resources/server-reference.conf"),
|
||||
serverProject.file("build/generated/src/main/kotlin/suwayomi/tachidesk/graphql/types/SettingsType.kt"),
|
||||
serverProject.file("build/generated/src/main/kotlin/suwayomi/tachidesk/manga/impl/backup/proto/models/BackupServerSettings.kt"),
|
||||
serverProject.file("build/generated/src/main/kotlin/suwayomi/tachidesk/manga/impl/backup/proto/handlers/BackupSettingsHandler.kt"),
|
||||
)
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user