-
-
Notifications
You must be signed in to change notification settings - Fork 202
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat!: Use Kotlin DSL for patch options (#234)
- Loading branch information
Showing
30 changed files
with
1,038 additions
and
707 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
14 changes: 6 additions & 8 deletions
14
...esources/app/revanced/patcher/patch/annotations/processor/samples/options/OptionsPatch.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 |
---|---|---|
@@ -1,21 +1,19 @@ | ||
package app.revanced.patcher.patch.annotations.processor.samples.options | ||
|
||
import app.revanced.patcher.data.ResourceContext | ||
import app.revanced.patcher.patch.PatchOption | ||
import app.revanced.patcher.patch.ResourcePatch | ||
import app.revanced.patcher.patch.annotations.Patch | ||
import app.revanced.patcher.patch.options.types.StringPatchOption.Companion.stringPatchOption | ||
|
||
@Patch(name = "Options patch") | ||
object OptionsPatch : ResourcePatch() { | ||
override fun execute(context: ResourceContext) {} | ||
|
||
@Suppress("unused") | ||
private val printOption by option( | ||
PatchOption.StringOption( | ||
"print", | ||
null, | ||
"Print message", | ||
"The message to print." | ||
) | ||
private val printOption by stringPatchOption( | ||
"print", | ||
null, | ||
"Print message", | ||
"The message to print." | ||
) | ||
} |
Large diffs are not rendered by default.
Oops, something went wrong.
27 changes: 27 additions & 0 deletions
27
revanced-patcher/src/main/kotlin/app/revanced/patcher/patch/BytecodePatch.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,27 @@ | ||
package app.revanced.patcher.patch | ||
|
||
import app.revanced.patcher.PatchClass | ||
import app.revanced.patcher.data.BytecodeContext | ||
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint | ||
|
||
/** | ||
* A ReVanced [Patch] that works on [BytecodeContext]. | ||
* | ||
* @param fingerprints A list of [MethodFingerprint]s which will be resolved before the patch is executed. | ||
* @param name The name of the patch. | ||
* @param description The description of the patch. | ||
* @param compatiblePackages The packages the patch is compatible with. | ||
* @param dependencies The names of patches this patch depends on. | ||
* @param use Weather or not the patch should be used. | ||
* @param requiresIntegrations Weather or not the patch requires integrations. | ||
*/ | ||
abstract class BytecodePatch( | ||
internal val fingerprints: Set<MethodFingerprint> = emptySet(), | ||
name: String? = null, | ||
description: String? = null, | ||
compatiblePackages: Set<CompatiblePackage>? = null, | ||
dependencies: Set<PatchClass>? = null, | ||
use: Boolean = true, | ||
// TODO: Remove this property, once integrations are coupled with patches. | ||
requiresIntegrations: Boolean = false, | ||
) : Patch<BytecodeContext>(name, description, compatiblePackages, dependencies, use, requiresIntegrations) |
23 changes: 0 additions & 23 deletions
23
revanced-patcher/src/main/kotlin/app/revanced/patcher/patch/OptionsContainer.kt
This file was deleted.
Oops, something went wrong.
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
Oops, something went wrong.