Skip to content

Commit

Permalink
feat: remove unused annotation SincePatcher
Browse files Browse the repository at this point in the history
BREAKING CHANGE: The annotation does not exist anymore and any use should be removed
  • Loading branch information
oSumAtrIX committed Oct 4, 2022
1 parent 447e1ad commit 4ae9ad0
Show file tree
Hide file tree
Showing 3 changed files with 1 addition and 26 deletions.
13 changes: 1 addition & 12 deletions src/main/kotlin/app/revanced/patcher/Patcher.kt
Expand Up @@ -5,7 +5,6 @@ import app.revanced.patcher.data.impl.findIndexed
import app.revanced.patcher.extensions.PatchExtensions.dependencies
import app.revanced.patcher.extensions.PatchExtensions.deprecated
import app.revanced.patcher.extensions.PatchExtensions.patchName
import app.revanced.patcher.extensions.PatchExtensions.sincePatcherVersion
import app.revanced.patcher.extensions.nullOutputStream
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint.Companion.resolve
import app.revanced.patcher.patch.Patch
Expand Down Expand Up @@ -213,17 +212,7 @@ class Patcher(private val options: PatcherOptions) {
}.dependencies?.forEach { it.java.isResource() }
}

data.patches.addAll(
patches.onEach(Class<out Patch<Data>>::isResource).onEach { patch ->
val needsVersion = patch.sincePatcherVersion
if (needsVersion != null && needsVersion > version) {
logger.error("Patch '${patch.patchName}' requires Patcher version $needsVersion or higher")
logger.error("Current Patcher version is $version")
logger.warn("Skipping '${patch.patchName}'!")
return@onEach // TODO: continue or halt/throw?
}
}
)
data.patches.addAll(patches.onEach(Class<out Patch<Data>>::isResource))
}

/**
Expand Down
13 changes: 0 additions & 13 deletions src/main/kotlin/app/revanced/patcher/annotation/SincePatcher.kt

This file was deleted.

Expand Up @@ -58,7 +58,6 @@ object PatchExtensions {
if (cl == Patch::class) null else cl
}
}
val Class<out Patch<Data>>.sincePatcherVersion get() = recursiveAnnotation(SincePatcher::class)?.version

@JvmStatic
fun Class<out Patch<Data>>.dependsOn(patch: Class<out Patch<Data>>): Boolean {
Expand Down

0 comments on commit 4ae9ad0

Please sign in to comment.