mirror of
https://github.com/revanced/revanced-patcher.git
synced 2025-05-03 06:04:25 +02:00
feat: add Patch#dependsOn extension
This commit is contained in:
parent
4813a8b48e
commit
523f67b238
@ -36,13 +36,18 @@ private fun <T : Annotation> Class<*>.findAnnotationRecursively(
|
|||||||
}
|
}
|
||||||
|
|
||||||
object PatchExtensions {
|
object PatchExtensions {
|
||||||
val Class<out Patch<Data>>.patchName: String
|
val Class<out Patch<Data>>.patchName: String get() = recursiveAnnotation(Name::class)?.name ?: this.javaClass.simpleName
|
||||||
get() = recursiveAnnotation(Name::class)?.name ?: this.javaClass.simpleName
|
|
||||||
val Class<out Patch<Data>>.version get() = recursiveAnnotation(Version::class)?.version
|
val Class<out Patch<Data>>.version get() = recursiveAnnotation(Version::class)?.version
|
||||||
val Class<out Patch<Data>>.include get() = recursiveAnnotation(app.revanced.patcher.patch.annotations.Patch::class)!!.include
|
val Class<out Patch<Data>>.include get() = recursiveAnnotation(app.revanced.patcher.patch.annotations.Patch::class)!!.include
|
||||||
val Class<out Patch<Data>>.description get() = recursiveAnnotation(Description::class)?.description
|
val Class<out Patch<Data>>.description get() = recursiveAnnotation(Description::class)?.description
|
||||||
val Class<out Patch<Data>>.dependencies get() = recursiveAnnotation(app.revanced.patcher.patch.annotations.Dependencies::class)?.dependencies
|
val Class<out Patch<Data>>.dependencies get() = recursiveAnnotation(app.revanced.patcher.patch.annotations.Dependencies::class)?.dependencies
|
||||||
val Class<out Patch<Data>>.compatiblePackages get() = recursiveAnnotation(Compatibility::class)?.compatiblePackages
|
val Class<out Patch<Data>>.compatiblePackages get() = recursiveAnnotation(Compatibility::class)?.compatiblePackages
|
||||||
|
|
||||||
|
@JvmStatic
|
||||||
|
fun Class<out Patch<Data>>.dependsOn(patch: Class<out Patch<Data>>): Boolean {
|
||||||
|
if (this.patchName == patch.patchName) throw IllegalArgumentException("thisval and patch may not be the same")
|
||||||
|
return this.dependencies?.any { it.java.patchName == this@dependsOn.patchName } == true
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
object MethodFingerprintExtensions {
|
object MethodFingerprintExtensions {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user