Add CloseableInjector

I'm going to try to minimise use of this (as per
https://github.com/google/guice/wiki/Avoid-Injecting-Closable-Resources).
For example, I'm going to inject a pooling DataSource rather than
Connection objects, as per the advice at the end of the page. However,
HikariCP's DataSource implementation is itself Closeable.

Signed-off-by: Graham <gpe@openrs2.org>
Graham 4 years ago
parent a0f7bf3922
commit c5bd044574
  1. 1
      archive/build.gradle.kts
  2. 8
      archive/src/main/kotlin/org/openrs2/archive/cache/DownloadCommand.kt
  3. 10
      archive/src/main/kotlin/org/openrs2/archive/cache/ExportCommand.kt
  4. 10
      archive/src/main/kotlin/org/openrs2/archive/cache/ImportCommand.kt
  5. 10
      archive/src/main/kotlin/org/openrs2/archive/cache/ImportMasterIndexCommand.kt
  6. 9
      archive/src/main/kotlin/org/openrs2/archive/key/BruteForceCommand.kt
  7. 8
      archive/src/main/kotlin/org/openrs2/archive/key/DownloadCommand.kt
  8. 9
      archive/src/main/kotlin/org/openrs2/archive/key/ImportCommand.kt
  9. 8
      archive/src/main/kotlin/org/openrs2/archive/name/DownloadCommand.kt
  10. 20
      archive/src/main/kotlin/org/openrs2/archive/name/GenerateCommand.kt
  11. 10
      archive/src/main/kotlin/org/openrs2/archive/name/ImportCommand.kt
  12. 8
      archive/src/main/kotlin/org/openrs2/archive/web/WebCommand.kt
  13. 1
      deob-ast/build.gradle.kts
  14. 8
      deob-ast/src/main/kotlin/org/openrs2/deob/ast/DeobfuscateAstCommand.kt
  15. 1
      deob-bytecode/build.gradle.kts
  16. 14
      deob-bytecode/src/main/kotlin/org/openrs2/deob/bytecode/DeobfuscateBytecodeCommand.kt
  17. 1
      deob-processor/build.gradle.kts
  18. 11
      deob-processor/src/main/kotlin/org/openrs2/deob/processor/NameMapProcessor.kt
  19. 1
      deob/build.gradle.kts
  20. 8
      deob/src/main/kotlin/org/openrs2/deob/DeobfuscateCommand.kt
  21. 2
      game/build.gradle.kts
  22. 8
      game/src/main/kotlin/org/openrs2/game/GameCommand.kt
  23. 10
      inject/build.gradle.kts
  24. 23
      inject/src/main/kotlin/org/openrs2/inject/CloseableInjector.kt
  25. 1
      patcher/build.gradle.kts
  26. 16
      patcher/src/main/kotlin/org/openrs2/patcher/PatchCommand.kt
  27. 1
      settings.gradle.kts

@ -16,6 +16,7 @@ dependencies {
implementation(project(":cli")) implementation(project(":cli"))
implementation(project(":db")) implementation(project(":db"))
implementation(project(":http")) implementation(project(":http"))
implementation(project(":inject"))
implementation(project(":json")) implementation(project(":json"))
implementation(project(":net")) implementation(project(":net"))
implementation(project(":protocol")) implementation(project(":protocol"))

@ -6,13 +6,15 @@ import com.github.ajalt.clikt.parameters.arguments.default
import com.google.inject.Guice import com.google.inject.Guice
import kotlinx.coroutines.runBlocking import kotlinx.coroutines.runBlocking
import org.openrs2.archive.ArchiveModule import org.openrs2.archive.ArchiveModule
import org.openrs2.inject.CloseableInjector
public class DownloadCommand : CliktCommand(name = "download") { public class DownloadCommand : CliktCommand(name = "download") {
private val game by argument().default("oldschool") private val game by argument().default("oldschool")
override fun run(): Unit = runBlocking { override fun run(): Unit = runBlocking {
val injector = Guice.createInjector(ArchiveModule) CloseableInjector(Guice.createInjector(ArchiveModule)).use { injector ->
val downloader = injector.getInstance(CacheDownloader::class.java) val downloader = injector.getInstance(CacheDownloader::class.java)
downloader.download(game) downloader.download(game)
}
} }
} }

@ -8,6 +8,7 @@ import com.google.inject.Guice
import kotlinx.coroutines.runBlocking import kotlinx.coroutines.runBlocking
import org.openrs2.archive.ArchiveModule import org.openrs2.archive.ArchiveModule
import org.openrs2.cache.DiskStore import org.openrs2.cache.DiskStore
import org.openrs2.inject.CloseableInjector
public class ExportCommand : CliktCommand(name = "export") { public class ExportCommand : CliktCommand(name = "export") {
private val id by argument().int() private val id by argument().int()
@ -19,11 +20,12 @@ public class ExportCommand : CliktCommand(name = "export") {
) )
override fun run(): Unit = runBlocking { override fun run(): Unit = runBlocking {
val injector = Guice.createInjector(ArchiveModule) CloseableInjector(Guice.createInjector(ArchiveModule)).use { injector ->
val exporter = injector.getInstance(CacheExporter::class.java) val exporter = injector.getInstance(CacheExporter::class.java)
DiskStore.create(output).use { store -> DiskStore.create(output).use { store ->
exporter.export(id, store) exporter.export(id, store)
}
} }
} }
} }

@ -10,6 +10,7 @@ import kotlinx.coroutines.runBlocking
import org.openrs2.archive.ArchiveModule import org.openrs2.archive.ArchiveModule
import org.openrs2.cache.Store import org.openrs2.cache.Store
import org.openrs2.cli.instant import org.openrs2.cli.instant
import org.openrs2.inject.CloseableInjector
public class ImportCommand : CliktCommand(name = "import") { public class ImportCommand : CliktCommand(name = "import") {
private val build by option().int() private val build by option().int()
@ -25,11 +26,12 @@ public class ImportCommand : CliktCommand(name = "import") {
) )
override fun run(): Unit = runBlocking { override fun run(): Unit = runBlocking {
val injector = Guice.createInjector(ArchiveModule) CloseableInjector(Guice.createInjector(ArchiveModule)).use { injector ->
val importer = injector.getInstance(CacheImporter::class.java) val importer = injector.getInstance(CacheImporter::class.java)
Store.open(input).use { store -> Store.open(input).use { store ->
importer.import(store, game, build, timestamp, name, description) importer.import(store, game, build, timestamp, name, description)
}
} }
} }
} }

@ -13,6 +13,7 @@ import org.openrs2.archive.ArchiveModule
import org.openrs2.buffer.use import org.openrs2.buffer.use
import org.openrs2.cache.MasterIndexFormat import org.openrs2.cache.MasterIndexFormat
import org.openrs2.cli.instant import org.openrs2.cli.instant
import org.openrs2.inject.CloseableInjector
import java.nio.file.Files import java.nio.file.Files
public class ImportMasterIndexCommand : CliktCommand(name = "import-master-index") { public class ImportMasterIndexCommand : CliktCommand(name = "import-master-index") {
@ -30,11 +31,12 @@ public class ImportMasterIndexCommand : CliktCommand(name = "import-master-index
) )
override fun run(): Unit = runBlocking { override fun run(): Unit = runBlocking {
val injector = Guice.createInjector(ArchiveModule) CloseableInjector(Guice.createInjector(ArchiveModule)).use { injector ->
val importer = injector.getInstance(CacheImporter::class.java) val importer = injector.getInstance(CacheImporter::class.java)
Unpooled.wrappedBuffer(Files.readAllBytes(input)).use { buf -> Unpooled.wrappedBuffer(Files.readAllBytes(input)).use { buf ->
importer.importMasterIndex(buf, format, game, build, timestamp, name, description) importer.importMasterIndex(buf, format, game, build, timestamp, name, description)
}
} }
} }
} }

@ -4,12 +4,13 @@ import com.github.ajalt.clikt.core.CliktCommand
import com.google.inject.Guice import com.google.inject.Guice
import kotlinx.coroutines.runBlocking import kotlinx.coroutines.runBlocking
import org.openrs2.archive.ArchiveModule import org.openrs2.archive.ArchiveModule
import org.openrs2.inject.CloseableInjector
public class BruteForceCommand : CliktCommand(name = "brute-force") { public class BruteForceCommand : CliktCommand(name = "brute-force") {
override fun run(): Unit = runBlocking { override fun run(): Unit = runBlocking {
val injector = Guice.createInjector(ArchiveModule) CloseableInjector(Guice.createInjector(ArchiveModule)).use { injector ->
val bruteForcer = injector.getInstance(KeyBruteForcer::class.java) val bruteForcer = injector.getInstance(KeyBruteForcer::class.java)
bruteForcer.bruteForce()
bruteForcer.bruteForce() }
} }
} }

@ -4,11 +4,13 @@ import com.github.ajalt.clikt.core.CliktCommand
import com.google.inject.Guice import com.google.inject.Guice
import kotlinx.coroutines.runBlocking import kotlinx.coroutines.runBlocking
import org.openrs2.archive.ArchiveModule import org.openrs2.archive.ArchiveModule
import org.openrs2.inject.CloseableInjector
public class DownloadCommand : CliktCommand(name = "download") { public class DownloadCommand : CliktCommand(name = "download") {
override fun run(): Unit = runBlocking { override fun run(): Unit = runBlocking {
val injector = Guice.createInjector(ArchiveModule) CloseableInjector(Guice.createInjector(ArchiveModule)).use { injector ->
val importer = injector.getInstance(KeyImporter::class.java) val importer = injector.getInstance(KeyImporter::class.java)
importer.download() importer.download()
}
} }
} }

@ -6,6 +6,7 @@ import com.github.ajalt.clikt.parameters.types.path
import com.google.inject.Guice import com.google.inject.Guice
import kotlinx.coroutines.runBlocking import kotlinx.coroutines.runBlocking
import org.openrs2.archive.ArchiveModule import org.openrs2.archive.ArchiveModule
import org.openrs2.inject.CloseableInjector
public class ImportCommand : CliktCommand(name = "import") { public class ImportCommand : CliktCommand(name = "import") {
private val input by argument().path( private val input by argument().path(
@ -14,9 +15,9 @@ public class ImportCommand : CliktCommand(name = "import") {
) )
override fun run(): Unit = runBlocking { override fun run(): Unit = runBlocking {
val injector = Guice.createInjector(ArchiveModule) CloseableInjector(Guice.createInjector(ArchiveModule)).use { injector ->
val importer = injector.getInstance(KeyImporter::class.java) val importer = injector.getInstance(KeyImporter::class.java)
importer.import(input)
importer.import(input) }
} }
} }

@ -4,11 +4,13 @@ import com.github.ajalt.clikt.core.CliktCommand
import com.google.inject.Guice import com.google.inject.Guice
import kotlinx.coroutines.runBlocking import kotlinx.coroutines.runBlocking
import org.openrs2.archive.ArchiveModule import org.openrs2.archive.ArchiveModule
import org.openrs2.inject.CloseableInjector
public class DownloadCommand : CliktCommand(name = "download") { public class DownloadCommand : CliktCommand(name = "download") {
override fun run(): Unit = runBlocking { override fun run(): Unit = runBlocking {
val injector = Guice.createInjector(ArchiveModule) CloseableInjector(Guice.createInjector(ArchiveModule)).use { injector ->
val importer = injector.getInstance(NameImporter::class.java) val importer = injector.getInstance(NameImporter::class.java)
importer.download() importer.download()
}
} }
} }

@ -4,23 +4,25 @@ import com.github.ajalt.clikt.core.CliktCommand
import com.google.inject.Guice import com.google.inject.Guice
import kotlinx.coroutines.runBlocking import kotlinx.coroutines.runBlocking
import org.openrs2.archive.ArchiveModule import org.openrs2.archive.ArchiveModule
import org.openrs2.inject.CloseableInjector
public class GenerateCommand : CliktCommand(name = "generate") { public class GenerateCommand : CliktCommand(name = "generate") {
override fun run(): Unit = runBlocking { override fun run(): Unit = runBlocking {
val injector = Guice.createInjector(ArchiveModule) CloseableInjector(Guice.createInjector(ArchiveModule)).use { injector ->
val importer = injector.getInstance(NameImporter::class.java) val importer = injector.getInstance(NameImporter::class.java)
val names = mutableSetOf<String>() val names = mutableSetOf<String>()
for (x in 0..99) { for (x in 0..99) {
for (z in 0..255) { for (z in 0..255) {
for (prefix in PREFIXES) { for (prefix in PREFIXES) {
names += "$prefix${x}_$z" names += "$prefix${x}_$z"
}
} }
} }
}
importer.import(names) importer.import(names)
}
} }
private companion object { private companion object {

@ -7,16 +7,18 @@ import com.github.ajalt.clikt.parameters.types.inputStream
import com.google.inject.Guice import com.google.inject.Guice
import kotlinx.coroutines.runBlocking import kotlinx.coroutines.runBlocking
import org.openrs2.archive.ArchiveModule import org.openrs2.archive.ArchiveModule
import org.openrs2.inject.CloseableInjector
public class ImportCommand : CliktCommand(name = "import") { public class ImportCommand : CliktCommand(name = "import") {
private val input by option().inputStream().defaultStdin() private val input by option().inputStream().defaultStdin()
override fun run(): Unit = runBlocking { override fun run(): Unit = runBlocking {
val injector = Guice.createInjector(ArchiveModule) CloseableInjector(Guice.createInjector(ArchiveModule)).use { injector ->
val importer = injector.getInstance(NameImporter::class.java) val importer = injector.getInstance(NameImporter::class.java)
input.bufferedReader().useLines { lines -> input.bufferedReader().useLines { lines ->
importer.import(lines.toSet()) importer.import(lines.toSet())
}
} }
} }
} }

@ -3,11 +3,13 @@ package org.openrs2.archive.web
import com.github.ajalt.clikt.core.CliktCommand import com.github.ajalt.clikt.core.CliktCommand
import com.google.inject.Guice import com.google.inject.Guice
import org.openrs2.archive.ArchiveModule import org.openrs2.archive.ArchiveModule
import org.openrs2.inject.CloseableInjector
public class WebCommand : CliktCommand(name = "web") { public class WebCommand : CliktCommand(name = "web") {
override fun run() { override fun run() {
val injector = Guice.createInjector(ArchiveModule) CloseableInjector(Guice.createInjector(ArchiveModule)).use { injector ->
val server = injector.getInstance(WebServer::class.java) val server = injector.getInstance(WebServer::class.java)
server.start() server.start()
}
} }
} }

@ -13,6 +13,7 @@ dependencies {
api("com.github.ajalt.clikt:clikt:${Versions.clikt}") api("com.github.ajalt.clikt:clikt:${Versions.clikt}")
api("com.google.inject:guice:${Versions.guice}") api("com.google.inject:guice:${Versions.guice}")
implementation(project(":inject"))
implementation(project(":util")) implementation(project(":util"))
implementation("com.github.javaparser:javaparser-symbol-solver-core:${Versions.javaParser}") implementation("com.github.javaparser:javaparser-symbol-solver-core:${Versions.javaParser}")
implementation("com.google.guava:guava:${Versions.guava}") implementation("com.google.guava:guava:${Versions.guava}")

@ -3,13 +3,15 @@ package org.openrs2.deob.ast
import com.github.ajalt.clikt.core.CliktCommand import com.github.ajalt.clikt.core.CliktCommand
import com.google.inject.Guice import com.google.inject.Guice
import org.openrs2.deob.util.Module import org.openrs2.deob.util.Module
import org.openrs2.inject.CloseableInjector
public fun main(args: Array<String>): Unit = DeobfuscateAstCommand().main(args) public fun main(args: Array<String>): Unit = DeobfuscateAstCommand().main(args)
public class DeobfuscateAstCommand : CliktCommand(name = "ast") { public class DeobfuscateAstCommand : CliktCommand(name = "ast") {
override fun run() { override fun run() {
val injector = Guice.createInjector(AstDeobfuscatorModule) CloseableInjector(Guice.createInjector(AstDeobfuscatorModule)).use { injector ->
val deobfuscator = injector.getInstance(AstDeobfuscator::class.java) val deobfuscator = injector.getInstance(AstDeobfuscator::class.java)
deobfuscator.run(Module.ALL) deobfuscator.run(Module.ALL)
}
} }
} }

@ -14,6 +14,7 @@ dependencies {
implementation(project(":deob-annotations")) implementation(project(":deob-annotations"))
implementation(project(":deob-util")) implementation(project(":deob-util"))
implementation(project(":inject"))
implementation(project(":patcher")) implementation(project(":patcher"))
implementation(project(":yaml")) implementation(project(":yaml"))
implementation("com.google.guava:guava:${Versions.guava}") implementation("com.google.guava:guava:${Versions.guava}")

@ -2,17 +2,19 @@ package org.openrs2.deob.bytecode
import com.github.ajalt.clikt.core.CliktCommand import com.github.ajalt.clikt.core.CliktCommand
import com.google.inject.Guice import com.google.inject.Guice
import org.openrs2.inject.CloseableInjector
import java.nio.file.Path import java.nio.file.Path
public fun main(args: Array<String>): Unit = DeobfuscateBytecodeCommand().main(args) public fun main(args: Array<String>): Unit = DeobfuscateBytecodeCommand().main(args)
public class DeobfuscateBytecodeCommand : CliktCommand(name = "bytecode") { public class DeobfuscateBytecodeCommand : CliktCommand(name = "bytecode") {
override fun run() { override fun run() {
val injector = Guice.createInjector(BytecodeDeobfuscatorModule) CloseableInjector(Guice.createInjector(BytecodeDeobfuscatorModule)).use { injector ->
val deobfuscator = injector.getInstance(BytecodeDeobfuscator::class.java) val deobfuscator = injector.getInstance(BytecodeDeobfuscator::class.java)
deobfuscator.run( deobfuscator.run(
input = Path.of("nonfree/lib"), input = Path.of("nonfree/lib"),
output = Path.of("nonfree/var/cache/deob") output = Path.of("nonfree/var/cache/deob")
) )
}
} }
} }

@ -6,6 +6,7 @@ plugins {
dependencies { dependencies {
implementation(project(":deob-annotations")) implementation(project(":deob-annotations"))
implementation(project(":deob-util")) implementation(project(":deob-util"))
implementation(project(":inject"))
implementation(project(":yaml")) implementation(project(":yaml"))
} }

@ -12,6 +12,7 @@ import org.openrs2.deob.annotation.OriginalMember
import org.openrs2.deob.util.map.Field import org.openrs2.deob.util.map.Field
import org.openrs2.deob.util.map.Method import org.openrs2.deob.util.map.Method
import org.openrs2.deob.util.map.NameMap import org.openrs2.deob.util.map.NameMap
import org.openrs2.inject.CloseableInjector
import org.openrs2.util.io.useAtomicBufferedWriter import org.openrs2.util.io.useAtomicBufferedWriter
import org.openrs2.yaml.Yaml import org.openrs2.yaml.Yaml
import java.lang.reflect.Proxy import java.lang.reflect.Proxy
@ -40,16 +41,12 @@ import javax.lang.model.element.VariableElement
"map" "map"
) )
public class NameMapProcessor : AbstractProcessor() { public class NameMapProcessor : AbstractProcessor() {
private val injector = CloseableInjector(Guice.createInjector(DeobfuscatorProcessorModule))
private val map = NameMap() private val map = NameMap()
private val mapper: ObjectMapper private val mapper = injector.getInstance(Key.get(ObjectMapper::class.java, Yaml::class.java))
private lateinit var trees: Trees private lateinit var trees: Trees
private lateinit var localScanner: LocalVariableScanner private lateinit var localScanner: LocalVariableScanner
init {
val injector = Guice.createInjector(DeobfuscatorProcessorModule)
mapper = injector.getInstance(Key.get(ObjectMapper::class.java, Yaml::class.java))
}
override fun init(env: ProcessingEnvironment) { override fun init(env: ProcessingEnvironment) {
super.init(env) super.init(env)
trees = Trees.instance(unwrap(env)) trees = Trees.instance(unwrap(env))
@ -124,6 +121,8 @@ public class NameMapProcessor : AbstractProcessor() {
mapPath.useAtomicBufferedWriter { writer -> mapPath.useAtomicBufferedWriter { writer ->
mapper.writeValue(writer, combinedMap) mapper.writeValue(writer, combinedMap)
} }
injector.close()
} }
return true return true

@ -15,6 +15,7 @@ dependencies {
implementation(project(":decompiler")) implementation(project(":decompiler"))
implementation(project(":deob-ast")) implementation(project(":deob-ast"))
implementation(project(":deob-bytecode")) implementation(project(":deob-bytecode"))
implementation(project(":inject"))
} }
publishing { publishing {

@ -2,13 +2,15 @@ package org.openrs2.deob
import com.github.ajalt.clikt.core.CliktCommand import com.github.ajalt.clikt.core.CliktCommand
import com.google.inject.Guice import com.google.inject.Guice
import org.openrs2.inject.CloseableInjector
public fun main(args: Array<String>): Unit = DeobfuscateCommand().main(args) public fun main(args: Array<String>): Unit = DeobfuscateCommand().main(args)
public class DeobfuscateCommand : CliktCommand(name = "deob") { public class DeobfuscateCommand : CliktCommand(name = "deob") {
override fun run() { override fun run() {
val injector = Guice.createInjector(DeobfuscatorModule) CloseableInjector(Guice.createInjector(DeobfuscatorModule)).use { injector ->
val deobfuscator = injector.getInstance(Deobfuscator::class.java) val deobfuscator = injector.getInstance(Deobfuscator::class.java)
deobfuscator.run() deobfuscator.run()
}
} }
} }

@ -11,7 +11,7 @@ application {
dependencies { dependencies {
api("com.github.ajalt.clikt:clikt:${Versions.clikt}") api("com.github.ajalt.clikt:clikt:${Versions.clikt}")
implementation("com.google.inject:guice:${Versions.guice}") implementation(project(":inject"))
} }
publishing { publishing {

@ -2,13 +2,15 @@ package org.openrs2.game
import com.github.ajalt.clikt.core.CliktCommand import com.github.ajalt.clikt.core.CliktCommand
import com.google.inject.Guice import com.google.inject.Guice
import org.openrs2.inject.CloseableInjector
public fun main(args: Array<String>): Unit = GameCommand().main(args) public fun main(args: Array<String>): Unit = GameCommand().main(args)
public class GameCommand : CliktCommand(name = "game") { public class GameCommand : CliktCommand(name = "game") {
override fun run() { override fun run() {
val injector = Guice.createInjector(GameModule) CloseableInjector(Guice.createInjector(GameModule)).use { injector ->
val server = injector.getInstance(GameServer::class.java) val server = injector.getInstance(GameServer::class.java)
server.run() server.run()
}
} }
} }

@ -5,9 +5,6 @@ plugins {
dependencies { dependencies {
api("com.google.inject:guice:${Versions.guice}") api("com.google.inject:guice:${Versions.guice}")
implementation("com.google.guava:guava:${Versions.guava}")
implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core:${Versions.kotlinCoroutines}")
} }
publishing { publishing {
@ -16,13 +13,10 @@ publishing {
pom { pom {
packaging = "jar" packaging = "jar"
name.set("OpenRS2 HTTP") name.set("OpenRS2 Inject")
description.set( description.set(
""" """
Guava module for creating a HTTP client with .netrc and Guice extension for closing AutoCloseable singletons.
redirection support. The I/O dispatcher is used to run
asynchronous requests, as code using coroutines will likely use
the I/O dispatcher to read the response body.
""".trimIndent() """.trimIndent()
) )
} }

@ -0,0 +1,23 @@
package org.openrs2.inject
import com.google.inject.Injector
import com.google.inject.Scopes
public class CloseableInjector(
private val injector: Injector
) : Injector by injector, AutoCloseable {
override fun close() {
for (binding in allBindings.values) {
if (!Scopes.isSingleton(binding)) {
continue
}
val o = binding.provider.get()
if (o !is AutoCloseable) {
continue
}
o.close()
}
}
}

@ -15,6 +15,7 @@ dependencies {
implementation(project(":conf")) implementation(project(":conf"))
implementation(project(":crypto")) implementation(project(":crypto"))
implementation(project(":inject"))
implementation("org.openrs2:openrs2-natives-all:${Versions.openrs2Natives}") implementation("org.openrs2:openrs2-natives-all:${Versions.openrs2Natives}")
} }

@ -2,18 +2,20 @@ package org.openrs2.patcher
import com.github.ajalt.clikt.core.CliktCommand import com.github.ajalt.clikt.core.CliktCommand
import com.google.inject.Guice import com.google.inject.Guice
import org.openrs2.inject.CloseableInjector
import java.nio.file.Path import java.nio.file.Path
public fun main(args: Array<String>): Unit = PatchCommand().main(args) public fun main(args: Array<String>): Unit = PatchCommand().main(args)
public class PatchCommand : CliktCommand(name = "patch") { public class PatchCommand : CliktCommand(name = "patch") {
override fun run() { override fun run() {
val injector = Guice.createInjector(PatcherModule) CloseableInjector(Guice.createInjector(PatcherModule)).use { injector ->
val patcher = injector.getInstance(Patcher::class.java) val patcher = injector.getInstance(Patcher::class.java)
patcher.run( patcher.run(
input = Path.of("nonfree/lib"), input = Path.of("nonfree/lib"),
output = Path.of("nonfree/var/cache/client"), output = Path.of("nonfree/var/cache/client"),
keyStorePath = Path.of("etc/loader.p12") keyStorePath = Path.of("etc/loader.p12")
) )
}
} }
} }

@ -32,6 +32,7 @@ include(
"deob-util", "deob-util",
"game", "game",
"http", "http",
"inject",
"json", "json",
"net", "net",
"nonfree", "nonfree",

Loading…
Cancel
Save