feat: Dependencies annotation

This commit is contained in:
oSumAtrIX 2022-06-03 17:49:31 +02:00
parent bf8655ead8
commit 893d4c699b
No known key found for this signature in database
GPG key ID: A9B3094ACDB604B4
2 changed files with 14 additions and 5 deletions

View file

@ -42,12 +42,12 @@ object PatchExtensions {
get() = recursiveAnnotation(Name::class)?.name ?: this.javaClass.simpleName
val Class<out Patch<Data>>.version get() = recursiveAnnotation(Version::class)?.version
val Class<out Patch<Data>>.description get() = recursiveAnnotation(Description::class)?.description
val Class<out Patch<Data>>.dependencies get() = recursiveAnnotation(app.revanced.patcher.patch.annotations.Patch::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
}
object MethodSignatureExtensions {
val MethodSignature.name get() = javaClass.recursiveAnnotation(Name::class)?.name ?: this.javaClass.simpleName
val MethodSignature.name: String get() = javaClass.recursiveAnnotation(Name::class)?.name ?: this.javaClass.simpleName
val MethodSignature.version get() = javaClass.recursiveAnnotation(Version::class)?.version ?: "0.0.1"
val MethodSignature.description get() = javaClass.recursiveAnnotation(Description::class)?.description
val MethodSignature.compatiblePackages get() = javaClass.recursiveAnnotation(Compatibility::class)?.compatiblePackages

View file

@ -1,6 +1,7 @@
package app.revanced.patcher.patch.annotations
import app.revanced.patcher.data.base.Data
import app.revanced.patcher.patch.base.Patch
import kotlin.reflect.KClass
/**
@ -9,6 +10,14 @@ import kotlin.reflect.KClass
@Target(AnnotationTarget.CLASS)
@Retention(AnnotationRetention.RUNTIME)
@MustBeDocumented
annotation class Patch(
val dependencies: Array<KClass<out app.revanced.patcher.patch.base.Patch<Data>>> = []
)
annotation class Patch
/**
* Annotation for dependencies of [Patch]es .
*/
@Target(AnnotationTarget.CLASS)
@Retention(AnnotationRetention.RUNTIME)
@MustBeDocumented
annotation class Dependencies(
val dependencies: Array<KClass<out Patch<Data>>> = []
)