-
-
Notifications
You must be signed in to change notification settings - Fork 211
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: use annotations instead of metadata objects
Signed-off-by: oSumAtrIX <johan.melkonyan1@web.de>
- Loading branch information
Showing
54 changed files
with
444 additions
and
333 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
28 changes: 28 additions & 0 deletions
28
src/main/kotlin/app/revanced/patcher/annotation/CompatibilityAnnotation.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
package app.revanced.patcher.annotation | ||
|
||
import app.revanced.patcher.patch.base.Patch | ||
import app.revanced.patcher.signature.implementation.method.MethodSignature | ||
|
||
/** | ||
* Annotation to constrain a [Patch] or [MethodSignature] to compatible packages. | ||
* @param compatiblePackages A list of packages a [Patch] or [MethodSignature] is compatible with. | ||
*/ | ||
@Target(AnnotationTarget.CLASS) | ||
@Retention(AnnotationRetention.RUNTIME) | ||
@MustBeDocumented | ||
annotation class Compatibility( | ||
val compatiblePackages: Array<Package>, | ||
) | ||
|
||
/** | ||
* Annotation to represent packages a patch can be compatible with. | ||
* @param name The package identifier name. | ||
* @param versions The versions of the package the [Patch] or [MethodSignature]is compatible with. | ||
*/ | ||
@Target() | ||
@Retention(AnnotationRetention.RUNTIME) | ||
@MustBeDocumented | ||
annotation class Package( | ||
val name: String, | ||
val versions: Array<String> | ||
) |
38 changes: 38 additions & 0 deletions
38
src/main/kotlin/app/revanced/patcher/annotation/MetadataAnnotation.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
package app.revanced.patcher.annotation | ||
|
||
import app.revanced.patcher.patch.base.Patch | ||
import app.revanced.patcher.signature.implementation.method.MethodSignature | ||
|
||
/** | ||
* Annotation to name a [Patch] or [MethodSignature]. | ||
* @param name A suggestive name for the [Patch] or [MethodSignature]. | ||
*/ | ||
@Target(AnnotationTarget.CLASS) | ||
@Retention(AnnotationRetention.RUNTIME) | ||
@MustBeDocumented | ||
annotation class Name( | ||
val name: String, | ||
) | ||
|
||
/** | ||
* Annotation to describe a [Patch] or [MethodSignature]. | ||
* @param description A description for the [Patch] or [MethodSignature]. | ||
*/ | ||
@Target(AnnotationTarget.CLASS) | ||
@Retention(AnnotationRetention.RUNTIME) | ||
@MustBeDocumented | ||
annotation class Description( | ||
val description: String, | ||
) | ||
|
||
|
||
/** | ||
* Annotation to version a [Patch] or [MethodSignature]. | ||
* @param version The version of a [Patch] or [MethodSignature]. | ||
*/ | ||
@Target(AnnotationTarget.CLASS) | ||
@Retention(AnnotationRetention.RUNTIME) | ||
@MustBeDocumented | ||
annotation class Version( | ||
val version: String, | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
9 changes: 9 additions & 0 deletions
9
src/main/kotlin/app/revanced/patcher/patch/annotations/PatchAnnotation.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
package app.revanced.patcher.patch.annotations | ||
|
||
/** | ||
* Annotation to mark a Class as a patch. | ||
*/ | ||
@Target(AnnotationTarget.CLASS) | ||
@Retention(AnnotationRetention.RUNTIME) | ||
@MustBeDocumented | ||
annotation class Patch |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
29 changes: 0 additions & 29 deletions
29
src/main/kotlin/app/revanced/patcher/patch/implementation/metadata/PatchMetadata.kt
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.