From c00981f0263b4c3de1a6d8434c820bb22a46397d Mon Sep 17 00:00:00 2001 From: sschr15 Date: Sat, 30 Sep 2023 11:43:29 -0500 Subject: [PATCH] Update to latest Linkie + new namespaces --- .../extra/mappings/MappingsExtension.kt | 45 +++++++++++++++++++ .../extra/mappings/arguments/BarnArguments.kt | 20 +++++++++ .../mappings/arguments/FeatherArguments.kt | 20 +++++++++ .../mappings/arguments/SrgMojangArguments.kt | 20 +++++++++ gradle/libs.versions.toml | 2 +- 5 files changed, 106 insertions(+), 1 deletion(-) create mode 100644 extra-modules/extra-mappings/src/main/kotlin/com/kotlindiscord/kord/extensions/modules/extra/mappings/arguments/BarnArguments.kt create mode 100644 extra-modules/extra-mappings/src/main/kotlin/com/kotlindiscord/kord/extensions/modules/extra/mappings/arguments/FeatherArguments.kt create mode 100644 extra-modules/extra-mappings/src/main/kotlin/com/kotlindiscord/kord/extensions/modules/extra/mappings/arguments/SrgMojangArguments.kt diff --git a/extra-modules/extra-mappings/src/main/kotlin/com/kotlindiscord/kord/extensions/modules/extra/mappings/MappingsExtension.kt b/extra-modules/extra-mappings/src/main/kotlin/com/kotlindiscord/kord/extensions/modules/extra/mappings/MappingsExtension.kt index b81475e679..b652fb0254 100644 --- a/extra-modules/extra-mappings/src/main/kotlin/com/kotlindiscord/kord/extensions/modules/extra/mappings/MappingsExtension.kt +++ b/extra-modules/extra-mappings/src/main/kotlin/com/kotlindiscord/kord/extensions/modules/extra/mappings/MappingsExtension.kt @@ -73,12 +73,15 @@ class MappingsExtension : Extension() { enabledNamespaces.forEach { when (it) { + "barn" -> namespaces.add(BarnNamespace) + "feather" -> namespaces.add(FeatherNamespace) "legacy-yarn" -> namespaces.add(LegacyYarnNamespace) "mcp" -> namespaces.add(McpNamespaceReplacement) "mojang" -> namespaces.add(MojangNamespace) "hashed-mojang" -> namespaces.add(MojangHashedNamespace) "plasma" -> namespaces.add(PlasmaNamespace) "quilt-mappings" -> namespaces.add(QuiltMappingsNamespace) + "srg-mojang" -> namespaces.add(MojangSrgNamespace) "yarn" -> namespaces.add(YarnNamespace) "yarrn" -> namespaces.add(YarrnNamespace) @@ -93,12 +96,15 @@ class MappingsExtension : Extension() { Namespaces.init(LinkieConfig.DEFAULT.copy(namespaces = namespaces)) + val barnEnabled = enabledNamespaces.contains("barn") + val featherEnabled = enabledNamespaces.contains("feather") val legacyYarnEnabled = enabledNamespaces.contains("legacy-yarn") val mcpEnabled = enabledNamespaces.contains("mcp") val mojangEnabled = enabledNamespaces.contains("mojang") val hashedMojangEnabled = enabledNamespaces.contains("hashed-mojang") val plasmaEnabled = enabledNamespaces.contains("plasma") val quiltMappingsEnabled = enabledNamespaces.contains("quilt-mappings") + val srgMojangEnabled = enabledNamespaces.contains("srg-mojang") val yarnEnabled = enabledNamespaces.contains("yarn") val yarrnEnabled = enabledNamespaces.contains("yarrn") @@ -254,6 +260,32 @@ class MappingsExtension : Extension() { } } + // region: Barn mappings lookups + + if (barnEnabled) { + slashCommand( + "barn", + "Barn", + BarnNamespace, + ::BarnArguments + ) + } + + // endregion + + // region: Feather mappings lookups + + if (featherEnabled) { + slashCommand( + "feather", + "Feather", + FeatherNamespace, + ::FeatherArguments + ) + } + + // endregion + // region: Legacy Yarn mappings lookups if (legacyYarnEnabled) { @@ -441,6 +473,19 @@ class MappingsExtension : Extension() { // endregion + // region: SRG Mojang mappings lookups + + if (srgMojangEnabled) { + slashCommand( + "srg", + "SRG Mojang", + MojangSrgNamespace, + ::SrgMojangArguments + ) + } + + // endregion + // region: Yarn mappings lookups if (yarnEnabled) { diff --git a/extra-modules/extra-mappings/src/main/kotlin/com/kotlindiscord/kord/extensions/modules/extra/mappings/arguments/BarnArguments.kt b/extra-modules/extra-mappings/src/main/kotlin/com/kotlindiscord/kord/extensions/modules/extra/mappings/arguments/BarnArguments.kt new file mode 100644 index 0000000000..3d8d8e5a88 --- /dev/null +++ b/extra-modules/extra-mappings/src/main/kotlin/com/kotlindiscord/kord/extensions/modules/extra/mappings/arguments/BarnArguments.kt @@ -0,0 +1,20 @@ +/* + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at https://mozilla.org/MPL/2.0/. + */ + +package com.kotlindiscord.kord.extensions.modules.extra.mappings.arguments + +import com.kotlindiscord.kord.extensions.commands.converters.impl.defaultingBoolean +import me.shedaniel.linkie.namespaces.BarnNamespace + +/** Arguments for Barn mappings lookup commands. **/ +@Suppress("UndocumentedPublicProperty") +class BarnArguments : MappingArguments(BarnNamespace), IntermediaryMappable { + override val mapDescriptors by defaultingBoolean { + name = "map-descriptor" + description = "Whether to map field/method descriptors to named instead of intermediary" + defaultValue = true + } +} diff --git a/extra-modules/extra-mappings/src/main/kotlin/com/kotlindiscord/kord/extensions/modules/extra/mappings/arguments/FeatherArguments.kt b/extra-modules/extra-mappings/src/main/kotlin/com/kotlindiscord/kord/extensions/modules/extra/mappings/arguments/FeatherArguments.kt new file mode 100644 index 0000000000..568c594a3f --- /dev/null +++ b/extra-modules/extra-mappings/src/main/kotlin/com/kotlindiscord/kord/extensions/modules/extra/mappings/arguments/FeatherArguments.kt @@ -0,0 +1,20 @@ +/* + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at https://mozilla.org/MPL/2.0/. + */ + +package com.kotlindiscord.kord.extensions.modules.extra.mappings.arguments + +import com.kotlindiscord.kord.extensions.commands.converters.impl.defaultingBoolean +import me.shedaniel.linkie.namespaces.FeatherNamespace + +/** Arguments for Feather mappings lookup commands. **/ +@Suppress("UndocumentedPublicProperty") +class FeatherArguments : MappingArguments(FeatherNamespace), IntermediaryMappable { + override val mapDescriptors by defaultingBoolean { + name = "map-descriptor" + description = "Whether to map field/method descriptors to named instead of Calamus" + defaultValue = true + } +} diff --git a/extra-modules/extra-mappings/src/main/kotlin/com/kotlindiscord/kord/extensions/modules/extra/mappings/arguments/SrgMojangArguments.kt b/extra-modules/extra-mappings/src/main/kotlin/com/kotlindiscord/kord/extensions/modules/extra/mappings/arguments/SrgMojangArguments.kt new file mode 100644 index 0000000000..ca6563efaa --- /dev/null +++ b/extra-modules/extra-mappings/src/main/kotlin/com/kotlindiscord/kord/extensions/modules/extra/mappings/arguments/SrgMojangArguments.kt @@ -0,0 +1,20 @@ +/* + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at https://mozilla.org/MPL/2.0/. + */ + +package com.kotlindiscord.kord.extensions.modules.extra.mappings.arguments + +import com.kotlindiscord.kord.extensions.commands.converters.impl.defaultingBoolean +import me.shedaniel.linkie.namespaces.MojangSrgNamespace + +/** Arguments for SRG Mojang mappings lookup commands. **/ +@Suppress("UndocumentedPublicProperty") +class SrgMojangArguments : MappingArguments(MojangSrgNamespace), IntermediaryMappable { + override val mapDescriptors by defaultingBoolean { + name = "map-descriptor" + description = "Whether to map field/method descriptors to named instead of SRG" + defaultValue = true + } +} diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index fbae5c8dae..11b49d8f7c 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -17,7 +17,7 @@ ksp = "1.9.10-1.0.13" ktor = "2.3.4" kx-coro = "1.7.3" kx-ser = "1.6.0" -linkie = "1.0.99" +linkie = "1.0.114" logback = "1.4.11" logback-groovy = "1.14.5" logging = "5.1.0"