Skip to content

Commit

Permalink
fix: make patcher version public
Browse files Browse the repository at this point in the history
  • Loading branch information
Sculas committed Sep 8, 2022
1 parent 25f74dc commit 76c45dd
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions src/main/kotlin/app/revanced/patcher/Patcher.kt
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand All @@ -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 {
Expand Down Expand Up @@ -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?
}
Expand Down

0 comments on commit 76c45dd

Please sign in to comment.