mirror of
https://github.com/ReVanced/revanced-patcher.git
synced 2026-01-26 20:51:03 +00:00
BREAKING-CHANGE: DependencyType.SOFT has now been removed after it was deprecated. There is no direct replacement for this. Please look into Patch Options instead, which supersedes this.
47 lines
1.1 KiB
Kotlin
47 lines
1.1 KiB
Kotlin
package app.revanced.patcher.patch.annotations
|
|
|
|
import app.revanced.patcher.data.Data
|
|
import app.revanced.patcher.patch.Patch
|
|
import kotlin.reflect.KClass
|
|
|
|
/**
|
|
* Annotation to mark a Class as a patch.
|
|
* @param include If false, the patch should be treated as optional by default.
|
|
*/
|
|
@Target(AnnotationTarget.CLASS)
|
|
@Retention(AnnotationRetention.RUNTIME)
|
|
@MustBeDocumented
|
|
annotation class Patch(val include: Boolean = true)
|
|
|
|
/**
|
|
* Annotation for dependencies of [Patch]es .
|
|
*/
|
|
@Target(AnnotationTarget.CLASS)
|
|
@Retention(AnnotationRetention.RUNTIME)
|
|
@MustBeDocumented
|
|
@Deprecated(
|
|
"Does not support new parameter 'type'",
|
|
ReplaceWith("DependsOn")
|
|
)
|
|
annotation class Dependencies(
|
|
val dependencies: Array<KClass<out Patch<Data>>> = []
|
|
)
|
|
|
|
/**
|
|
* Annotation for dependencies of [Patch]es .
|
|
*/
|
|
@Target(AnnotationTarget.CLASS)
|
|
@Retention(AnnotationRetention.RUNTIME)
|
|
@MustBeDocumented
|
|
@Repeatable
|
|
annotation class DependsOn(
|
|
val value: KClass<out Patch<Data>>,
|
|
val type: DependencyType = DependencyType.HARD
|
|
)
|
|
|
|
enum class DependencyType {
|
|
/**
|
|
* Enforces that the dependency is applied, even if it was not selected.
|
|
*/
|
|
HARD
|
|
} |