mirror of
https://github.com/revanced/revanced-patcher.git
synced 2025-05-01 21:54:24 +02:00
executePatches -> applyPatches, made logback a test dep
This commit is contained in:
parent
6bd4d80c47
commit
f9327a2043
@ -16,8 +16,8 @@ dependencies {
|
|||||||
implementation("org.ow2.asm:asm-util:9.2")
|
implementation("org.ow2.asm:asm-util:9.2")
|
||||||
implementation("org.ow2.asm:asm-tree:9.2")
|
implementation("org.ow2.asm:asm-tree:9.2")
|
||||||
implementation("org.ow2.asm:asm-commons:9.2")
|
implementation("org.ow2.asm:asm-commons:9.2")
|
||||||
implementation("ch.qos.logback:logback-classic:1.2.11")
|
|
||||||
implementation("io.github.microutils:kotlin-logging:2.1.21")
|
implementation("io.github.microutils:kotlin-logging:2.1.21")
|
||||||
|
testImplementation("ch.qos.logback:logback-classic:1.2.11") // use your own logger!
|
||||||
testImplementation(kotlin("test"))
|
testImplementation(kotlin("test"))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2,13 +2,11 @@ package net.revanced.patcher
|
|||||||
|
|
||||||
import net.revanced.patcher.cache.Cache
|
import net.revanced.patcher.cache.Cache
|
||||||
import net.revanced.patcher.patch.Patch
|
import net.revanced.patcher.patch.Patch
|
||||||
import net.revanced.patcher.patch.PatchResult
|
|
||||||
import net.revanced.patcher.resolver.MethodResolver
|
import net.revanced.patcher.resolver.MethodResolver
|
||||||
import net.revanced.patcher.signature.Signature
|
import net.revanced.patcher.signature.Signature
|
||||||
import net.revanced.patcher.util.Jar2ASM
|
import net.revanced.patcher.util.Jar2ASM
|
||||||
import java.io.InputStream
|
import java.io.InputStream
|
||||||
import java.io.OutputStream
|
import java.io.OutputStream
|
||||||
import java.util.jar.JarFile
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The patcher. (docs WIP)
|
* The patcher. (docs WIP)
|
||||||
@ -32,7 +30,7 @@ class Patcher (
|
|||||||
this.patches.addAll(patches)
|
this.patches.addAll(patches)
|
||||||
}
|
}
|
||||||
|
|
||||||
fun executePatches(): Map<String, Result<Nothing?>> {
|
fun applyPatches(stopOnError: Boolean = false): Map<String, Result<Nothing?>> {
|
||||||
return buildMap {
|
return buildMap {
|
||||||
for (patch in patches) {
|
for (patch in patches) {
|
||||||
val result: Result<Nothing?> = try {
|
val result: Result<Nothing?> = try {
|
||||||
@ -43,11 +41,12 @@ class Patcher (
|
|||||||
Result.failure(e)
|
Result.failure(e)
|
||||||
}
|
}
|
||||||
this[patch.patchName] = result
|
this[patch.patchName] = result
|
||||||
|
if (stopOnError && result.isFailure) break
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fun save(output: OutputStream) {
|
fun saveTo(output: OutputStream) {
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -37,7 +37,7 @@ internal class PatcherTest {
|
|||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|
||||||
val result = patcher.executePatches()
|
val result = patcher.applyPatches()
|
||||||
for ((s, r) in result) {
|
for ((s, r) in result) {
|
||||||
if (r.isFailure) {
|
if (r.isFailure) {
|
||||||
throw Exception("Patch $s failed", r.exceptionOrNull()!!)
|
throw Exception("Patch $s failed", r.exceptionOrNull()!!)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user