From 893d4c699bad4c70002fc691c261447d01948b5c Mon Sep 17 00:00:00 2001 From: oSumAtrIX Date: Fri, 3 Jun 2022 17:49:31 +0200 Subject: [PATCH] feat: `Dependencies` annotation --- .../patcher/extensions/AnnotationExtensions.kt | 4 ++-- .../patcher/patch/annotations/PatchAnnotation.kt | 15 ++++++++++++--- 2 files changed, 14 insertions(+), 5 deletions(-) diff --git a/src/main/kotlin/app/revanced/patcher/extensions/AnnotationExtensions.kt b/src/main/kotlin/app/revanced/patcher/extensions/AnnotationExtensions.kt index 9ef5df1..ce3a0d1 100644 --- a/src/main/kotlin/app/revanced/patcher/extensions/AnnotationExtensions.kt +++ b/src/main/kotlin/app/revanced/patcher/extensions/AnnotationExtensions.kt @@ -42,12 +42,12 @@ object PatchExtensions { get() = recursiveAnnotation(Name::class)?.name ?: this.javaClass.simpleName val Class>.version get() = recursiveAnnotation(Version::class)?.version val Class>.description get() = recursiveAnnotation(Description::class)?.description - val Class>.dependencies get() = recursiveAnnotation(app.revanced.patcher.patch.annotations.Patch::class)?.dependencies + val Class>.dependencies get() = recursiveAnnotation(app.revanced.patcher.patch.annotations.Dependencies::class)?.dependencies val Class>.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 diff --git a/src/main/kotlin/app/revanced/patcher/patch/annotations/PatchAnnotation.kt b/src/main/kotlin/app/revanced/patcher/patch/annotations/PatchAnnotation.kt index df2f049..d2e9f99 100644 --- a/src/main/kotlin/app/revanced/patcher/patch/annotations/PatchAnnotation.kt +++ b/src/main/kotlin/app/revanced/patcher/patch/annotations/PatchAnnotation.kt @@ -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>> = [] -) +annotation class Patch + +/** + * Annotation for dependencies of [Patch]es . + */ +@Target(AnnotationTarget.CLASS) +@Retention(AnnotationRetention.RUNTIME) +@MustBeDocumented +annotation class Dependencies( + val dependencies: Array>> = [] +) \ No newline at end of file