1
mirror of https://github.com/revanced/revanced-patcher synced 2025-03-25 07:56:23 +01:00

refactor: remove DependencyType.SOFT ()

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.
This commit is contained in:
Sculas 2022-08-02 00:47:32 +02:00 committed by GitHub
parent 711b8a25a7
commit ec1d8a8fba
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 2 additions and 14 deletions
src
main/kotlin/app/revanced/patcher
test/kotlin/app/revanced/patcher/usage/bytecode

@ -11,7 +11,6 @@ import app.revanced.patcher.patch.Patch
import app.revanced.patcher.patch.PatchResult import app.revanced.patcher.patch.PatchResult
import app.revanced.patcher.patch.PatchResultError import app.revanced.patcher.patch.PatchResultError
import app.revanced.patcher.patch.PatchResultSuccess import app.revanced.patcher.patch.PatchResultSuccess
import app.revanced.patcher.patch.annotations.DependencyType
import app.revanced.patcher.patch.impl.BytecodePatch import app.revanced.patcher.patch.impl.BytecodePatch
import app.revanced.patcher.patch.impl.ResourcePatch import app.revanced.patcher.patch.impl.ResourcePatch
import app.revanced.patcher.util.ListBackedSet import app.revanced.patcher.util.ListBackedSet
@ -265,11 +264,6 @@ class Patcher(private val options: PatcherOptions) {
// recursively apply all dependency patches // recursively apply all dependency patches
patch.dependencies.forEach { patch.dependencies.forEach {
val dependency = it.patch.java val dependency = it.patch.java
if ( // soft dependencies must be included manually.
it.type == DependencyType.SOFT && !data.patches.any { p ->
p.patchName == dependency.patchName
}
) return@forEach
val result = applyPatch(dependency, appliedPatches) val result = applyPatch(dependency, appliedPatches)
if (result.isSuccess()) return@forEach if (result.isSuccess()) return@forEach

@ -43,11 +43,5 @@ enum class DependencyType {
/** /**
* Enforces that the dependency is applied, even if it was not selected. * Enforces that the dependency is applied, even if it was not selected.
*/ */
HARD, HARD
/**
* Applies the dependency only if it was selected.
*/
@Deprecated("Will be removed when Patch Options is implemented.")
SOFT
} }

@ -38,7 +38,7 @@ import org.jf.dexlib2.util.Preconditions
@Description("Example demonstration of a bytecode patch.") @Description("Example demonstration of a bytecode patch.")
@ExampleResourceCompatibility @ExampleResourceCompatibility
@Version("0.0.1") @Version("0.0.1")
@DependsOn(ExampleBytecodePatch::class, DependencyType.SOFT) @DependsOn(ExampleBytecodePatch::class, DependencyType.HARD)
class ExampleBytecodePatch : BytecodePatch(listOf(ExampleFingerprint)) { class ExampleBytecodePatch : BytecodePatch(listOf(ExampleFingerprint)) {
// This function will be executed by the patcher. // This function will be executed by the patcher.
// You can treat it as a constructor // You can treat it as a constructor