feat: remove unused annotation SincePatcher

BREAKING CHANGE: The annotation does not exist anymore and any use should be removed
This commit is contained in:
oSumAtrIX 2022-10-04 08:16:58 +02:00
parent 447e1ad30e
commit 4ae9ad09d6
No known key found for this signature in database
GPG key ID: A9B3094ACDB604B4
3 changed files with 1 additions and 26 deletions

View file

@ -5,7 +5,6 @@ import app.revanced.patcher.data.impl.findIndexed
import app.revanced.patcher.extensions.PatchExtensions.dependencies import app.revanced.patcher.extensions.PatchExtensions.dependencies
import app.revanced.patcher.extensions.PatchExtensions.deprecated import app.revanced.patcher.extensions.PatchExtensions.deprecated
import app.revanced.patcher.extensions.PatchExtensions.patchName import app.revanced.patcher.extensions.PatchExtensions.patchName
import app.revanced.patcher.extensions.PatchExtensions.sincePatcherVersion
import app.revanced.patcher.extensions.nullOutputStream import app.revanced.patcher.extensions.nullOutputStream
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint.Companion.resolve import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint.Companion.resolve
import app.revanced.patcher.patch.Patch import app.revanced.patcher.patch.Patch
@ -213,17 +212,7 @@ class Patcher(private val options: PatcherOptions) {
}.dependencies?.forEach { it.java.isResource() } }.dependencies?.forEach { it.java.isResource() }
} }
data.patches.addAll( data.patches.addAll(patches.onEach(Class<out Patch<Data>>::isResource))
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?
}
}
)
} }
/** /**

View file

@ -1,13 +0,0 @@
package app.revanced.patcher.annotation
import app.revanced.patcher.patch.Patch
import app.revanced.patcher.Patcher
/**
* Declares a [Patch] deprecated for removal.
* @param version The minimum version of the [Patcher] this [Patch] supports.
*/
@Target(AnnotationTarget.CLASS)
@Retention(AnnotationRetention.RUNTIME)
@MustBeDocumented
annotation class SincePatcher(val version: String)

View file

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