fix: make patcher version public

This commit is contained in:
Sculas 2022-09-08 14:49:26 +02:00
parent 25f74dc5e9
commit 76c45dd7c1
No known key found for this signature in database
GPG key ID: 1530BFF96D1EEB89

View file

@ -39,7 +39,6 @@ import java.io.File
import java.nio.file.Files
private val NAMER = BasicDexFileNamer()
private val VERSION = VersionReader.read()
/**
* The ReVanced Patcher.
@ -51,6 +50,11 @@ class Patcher(private val options: PatcherOptions) {
val data: PatcherData
companion object {
@JvmStatic
val version = VersionReader.read()
}
init {
val extInputFile = ExtFile(options.inputFile)
try {
@ -249,9 +253,9 @@ class Patcher(private val options: PatcherOptions) {
fun addPatches(patches: Iterable<Class<out Patch<Data>>>) {
for (patch in patches) {
val needsVersion = patch.sincePatcherVersion
if (needsVersion != null && needsVersion > VERSION) {
if (needsVersion != null && needsVersion > version) {
logger.error("Patch '${patch.patchName}' requires Patcher version $needsVersion or higher")
logger.error("Current Patcher version is $VERSION")
logger.error("Current Patcher version is $version")
logger.warn("Skipping '${patch.patchName}'!")
continue // TODO: continue or halt/throw?
}