Move MemberRefKeyDeserializer to the asm module

I'm going to use it in multiple places, so I think it makes sense to
share it (at the expense of the asm module depending on the yaml
module).

Signed-off-by: Graham <gpe@openrs2.dev>
Graham 5 years ago
parent 2a4d607d96
commit 3dcf91cfef
  1. 2
      asm/build.gradle.kts
  2. 5
      asm/src/main/java/dev/openrs2/asm/AsmJacksonModule.kt
  3. 15
      asm/src/main/java/dev/openrs2/asm/AsmModule.kt
  4. 3
      asm/src/main/java/dev/openrs2/asm/MemberRefKeyDeserializer.kt
  5. 1
      deob-map/build.gradle.kts
  6. 9
      deob-map/src/main/java/dev/openrs2/deob/map/DeobfuscatorMapModule.kt

@ -5,6 +5,8 @@ plugins {
dependencies { dependencies {
api(project(":util")) api(project(":util"))
api(project(":yaml"))
api("com.google.inject:guice:${Versions.guice}")
api("org.ow2.asm:asm:${Versions.asm}") api("org.ow2.asm:asm:${Versions.asm}")
api("org.ow2.asm:asm-commons:${Versions.asm}") api("org.ow2.asm:asm-commons:${Versions.asm}")
api("org.ow2.asm:asm-tree:${Versions.asm}") api("org.ow2.asm:asm-tree:${Versions.asm}")

@ -1,11 +1,10 @@
package dev.openrs2.deob.map package dev.openrs2.asm
import com.fasterxml.jackson.databind.module.SimpleModule import com.fasterxml.jackson.databind.module.SimpleModule
import dev.openrs2.asm.MemberRef
import javax.inject.Singleton import javax.inject.Singleton
@Singleton @Singleton
class DeobfuscatorMapJacksonModule : SimpleModule() { class AsmJacksonModule : SimpleModule() {
init { init {
addKeyDeserializer(MemberRef::class.java, MemberRefKeyDeserializer) addKeyDeserializer(MemberRef::class.java, MemberRefKeyDeserializer)
} }

@ -0,0 +1,15 @@
package dev.openrs2.asm
import com.fasterxml.jackson.databind.Module
import com.google.inject.AbstractModule
import com.google.inject.multibindings.Multibinder
import dev.openrs2.yaml.YamlModule
object AsmModule : AbstractModule() {
override fun configure() {
install(YamlModule)
Multibinder.newSetBinder(binder(), Module::class.java)
.addBinding().to(AsmJacksonModule::class.java)
}
}

@ -1,8 +1,7 @@
package dev.openrs2.deob.map package dev.openrs2.asm
import com.fasterxml.jackson.databind.DeserializationContext import com.fasterxml.jackson.databind.DeserializationContext
import com.fasterxml.jackson.databind.KeyDeserializer import com.fasterxml.jackson.databind.KeyDeserializer
import dev.openrs2.asm.MemberRef
object MemberRefKeyDeserializer : KeyDeserializer() { object MemberRefKeyDeserializer : KeyDeserializer() {
override fun deserializeKey(key: String, ctx: DeserializationContext): Any { override fun deserializeKey(key: String, ctx: DeserializationContext): Any {

@ -5,7 +5,6 @@ plugins {
dependencies { dependencies {
api(project(":asm")) api(project(":asm"))
api(project(":yaml"))
} }
publishing { publishing {

@ -1,17 +1,12 @@
package dev.openrs2.deob.map package dev.openrs2.deob.map
import com.fasterxml.jackson.databind.Module
import com.google.inject.AbstractModule import com.google.inject.AbstractModule
import com.google.inject.Scopes import com.google.inject.Scopes
import com.google.inject.multibindings.Multibinder import dev.openrs2.asm.AsmModule
import dev.openrs2.yaml.YamlModule
object DeobfuscatorMapModule : AbstractModule() { object DeobfuscatorMapModule : AbstractModule() {
override fun configure() { override fun configure() {
install(YamlModule) install(AsmModule)
Multibinder.newSetBinder(binder(), Module::class.java)
.addBinding().to(DeobfuscatorMapJacksonModule::class.java)
bind(NameMap::class.java) bind(NameMap::class.java)
.toProvider(NameMapProvider::class.java) .toProvider(NameMapProvider::class.java)

Loading…
Cancel
Save