mirror of
https://github.com/ReVanced/revanced-library.git
synced 2026-01-26 12:41:04 +00:00
chore: Fix builds from bumping dependencies
This commit is contained in:
@@ -3,8 +3,9 @@ package app.revanced.library
|
|||||||
import app.revanced.library.Options.setOptions
|
import app.revanced.library.Options.setOptions
|
||||||
import app.revanced.patcher.data.BytecodeContext
|
import app.revanced.patcher.data.BytecodeContext
|
||||||
import app.revanced.patcher.patch.BytecodePatch
|
import app.revanced.patcher.patch.BytecodePatch
|
||||||
import app.revanced.patcher.patch.options.types.BooleanPatchOption.Companion.booleanPatchOption
|
import app.revanced.patcher.patch.annotation.Patch
|
||||||
import app.revanced.patcher.patch.options.types.StringPatchOption.Companion.stringPatchOption
|
import app.revanced.patcher.patch.options.PatchOption.PatchExtensions.booleanPatchOption
|
||||||
|
import app.revanced.patcher.patch.options.PatchOption.PatchExtensions.stringPatchOption
|
||||||
import org.junit.jupiter.api.MethodOrderer
|
import org.junit.jupiter.api.MethodOrderer
|
||||||
import org.junit.jupiter.api.Order
|
import org.junit.jupiter.api.Order
|
||||||
import org.junit.jupiter.api.Test
|
import org.junit.jupiter.api.Test
|
||||||
@@ -35,9 +36,10 @@ internal object PatchOptionsTest {
|
|||||||
private const val CHANGED_JSON =
|
private const val CHANGED_JSON =
|
||||||
"[{\"patchName\":\"PatchOptionsTestPatch\",\"options\":[{\"key\":\"key1\",\"value\":\"test\"},{\"key\":\"key2\",\"value\":false}]}]"
|
"[{\"patchName\":\"PatchOptionsTestPatch\",\"options\":[{\"key\":\"key1\",\"value\":\"test\"},{\"key\":\"key2\",\"value\":false}]}]"
|
||||||
|
|
||||||
object PatchOptionsTestPatch : BytecodePatch(name = "PatchOptionsTestPatch") {
|
@Patch("PatchOptionsTestPatch")
|
||||||
var option1 by stringPatchOption("key1", null, "title1", "description1")
|
object PatchOptionsTestPatch : BytecodePatch() {
|
||||||
var option2 by booleanPatchOption("key2", true, "title2", "description2")
|
var option1 by stringPatchOption("key1", null, null, "title1", "description1")
|
||||||
|
var option2 by booleanPatchOption("key2", true, null, "title2", "description2")
|
||||||
|
|
||||||
override fun execute(context: BytecodeContext) {
|
override fun execute(context: BytecodeContext) {
|
||||||
// Do nothing
|
// Do nothing
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ package app.revanced.library
|
|||||||
import app.revanced.patcher.PatchSet
|
import app.revanced.patcher.PatchSet
|
||||||
import app.revanced.patcher.data.BytecodeContext
|
import app.revanced.patcher.data.BytecodeContext
|
||||||
import app.revanced.patcher.patch.BytecodePatch
|
import app.revanced.patcher.patch.BytecodePatch
|
||||||
|
import app.revanced.patcher.patch.Patch
|
||||||
import org.junit.jupiter.api.Test
|
import org.junit.jupiter.api.Test
|
||||||
import kotlin.test.assertEquals
|
import kotlin.test.assertEquals
|
||||||
|
|
||||||
@@ -42,9 +43,16 @@ internal object PatchUtilsTest {
|
|||||||
expected: String?, patches: PatchSet, compatiblePackageName: String
|
expected: String?, patches: PatchSet, compatiblePackageName: String
|
||||||
) = assertEquals(expected, PatchUtils.getMostCommonCompatibleVersion(patches, compatiblePackageName))
|
) = assertEquals(expected, PatchUtils.getMostCommonCompatibleVersion(patches, compatiblePackageName))
|
||||||
|
|
||||||
private fun newPatch(packageName: String, vararg versions: String) = object : BytecodePatch(
|
private fun newPatch(packageName: String, vararg versions: String) = object : BytecodePatch() {
|
||||||
compatiblePackages = setOf(CompatiblePackage(packageName, versions.toSet()))
|
init {
|
||||||
) {
|
// Set the compatible packages field to the supplied package name and versions reflectively,
|
||||||
|
// because the setter is private but needed for testing.
|
||||||
|
val compatiblePackagesField = Patch::class.java.getDeclaredField("compatiblePackages")
|
||||||
|
|
||||||
|
compatiblePackagesField.isAccessible = true
|
||||||
|
compatiblePackagesField.set(this, setOf(CompatiblePackage(packageName, versions.toSet())))
|
||||||
|
}
|
||||||
|
|
||||||
override fun execute(context: BytecodeContext) {}
|
override fun execute(context: BytecodeContext) {}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user