From 642c4ea97e0d8d2ac177dcb6ddada49dd076b310 Mon Sep 17 00:00:00 2001 From: oSumAtrIX Date: Tue, 10 Oct 2023 20:05:46 +0200 Subject: [PATCH 01/36] refactor: Use correct class structure --- .../app/revanced/patcher/PatcherContext.kt | 3 +- .../revanced/patcher/data/BytecodeContext.kt | 56 +++++++++---------- 2 files changed, 30 insertions(+), 29 deletions(-) diff --git a/revanced-patcher/src/main/kotlin/app/revanced/patcher/PatcherContext.kt b/revanced-patcher/src/main/kotlin/app/revanced/patcher/PatcherContext.kt index c21cfa6..fffba74 100644 --- a/revanced-patcher/src/main/kotlin/app/revanced/patcher/PatcherContext.kt +++ b/revanced-patcher/src/main/kotlin/app/revanced/patcher/PatcherContext.kt @@ -37,4 +37,5 @@ class PatcherContext internal constructor(options: PatcherOptions) { * The [BytecodeContext] of this [PatcherContext]. * This holds the current state of the bytecode. */ - internal val bytecodeContext = BytecodeContext(options) } \ No newline at end of file + internal val bytecodeContext = BytecodeContext(options) +} \ No newline at end of file diff --git a/revanced-patcher/src/main/kotlin/app/revanced/patcher/data/BytecodeContext.kt b/revanced-patcher/src/main/kotlin/app/revanced/patcher/data/BytecodeContext.kt index 0dee449..abea9ba 100644 --- a/revanced-patcher/src/main/kotlin/app/revanced/patcher/data/BytecodeContext.kt +++ b/revanced-patcher/src/main/kotlin/app/revanced/patcher/data/BytecodeContext.kt @@ -90,6 +90,34 @@ class BytecodeContext internal constructor(private val options: PatcherOptions) */ fun toMethodWalker(startMethod: Method) = MethodWalker(this, startMethod) + /** + * Compile bytecode from the [BytecodeContext]. + * + * @return The compiled bytecode. + */ + override fun get(): List { + logger.info("Compiling patched dex files") + + val patchedDexFileResults = options.resourceCachePath.resolve("dex").also { + it.deleteRecursively() // Make sure the directory is empty. + it.mkdirs() + }.apply { + MultiDexIO.writeDexFile( + true, + if (options.multithreadingDexFileWriter) -1 else 1, + this, + BasicDexFileNamer(), + object : DexFile { + override fun getClasses() = this@BytecodeContext.classes.also(ProxyClassList::replaceClasses) + override fun getOpcodes() = this@BytecodeContext.opcodes + }, + DexIO.DEFAULT_MAX_DEX_POOL_SIZE + ) { _, entryName, _ -> logger.info("Compiled $entryName") } + }.listFiles(FileFilter { it.isFile })!!.map { PatcherResult.PatchedDexFile(it.name, it.inputStream()) } + + return patchedDexFileResults + } + /** * The integrations of a [PatcherContext]. */ @@ -135,32 +163,4 @@ class BytecodeContext internal constructor(private val options: PatcherOptions) clear() } } - - /** - * Compile bytecode from the [BytecodeContext]. - * - * @return The compiled bytecode. - */ - override fun get(): List { - logger.info("Compiling patched dex files") - - val patchedDexFileResults = options.resourceCachePath.resolve("dex").also { - it.deleteRecursively() // Make sure the directory is empty. - it.mkdirs() - }.apply { - MultiDexIO.writeDexFile( - true, - if (options.multithreadingDexFileWriter) -1 else 1, - this, - BasicDexFileNamer(), - object : DexFile { - override fun getClasses() = this@BytecodeContext.classes.also(ProxyClassList::replaceClasses) - override fun getOpcodes() = this@BytecodeContext.opcodes - }, - DexIO.DEFAULT_MAX_DEX_POOL_SIZE - ) { _, entryName, _ -> logger.info("Compiled $entryName") } - }.listFiles(FileFilter { it.isFile })!!.map { PatcherResult.PatchedDexFile(it.name, it.inputStream()) } - - return patchedDexFileResults - } } \ No newline at end of file From d9fb241d57b0c4340130c0e5900250e66730ea56 Mon Sep 17 00:00:00 2001 From: oSumAtrIX Date: Tue, 10 Oct 2023 20:06:27 +0200 Subject: [PATCH 02/36] perf: Run the garbage collector after writing dex files Writing dex files consumes a lot of memory. --- .../main/kotlin/app/revanced/patcher/data/BytecodeContext.kt | 2 ++ 1 file changed, 2 insertions(+) diff --git a/revanced-patcher/src/main/kotlin/app/revanced/patcher/data/BytecodeContext.kt b/revanced-patcher/src/main/kotlin/app/revanced/patcher/data/BytecodeContext.kt index abea9ba..df06bc5 100644 --- a/revanced-patcher/src/main/kotlin/app/revanced/patcher/data/BytecodeContext.kt +++ b/revanced-patcher/src/main/kotlin/app/revanced/patcher/data/BytecodeContext.kt @@ -115,6 +115,8 @@ class BytecodeContext internal constructor(private val options: PatcherOptions) ) { _, entryName, _ -> logger.info("Compiled $entryName") } }.listFiles(FileFilter { it.isFile })!!.map { PatcherResult.PatchedDexFile(it.name, it.inputStream()) } + System.gc() + return patchedDexFileResults } From 5fb59a227f5891fc70f0e18417b80a2e81c86f53 Mon Sep 17 00:00:00 2001 From: semantic-release-bot Date: Tue, 10 Oct 2023 18:23:51 +0000 Subject: [PATCH 03/36] chore(release): 17.0.1-dev.1 [skip ci] ## [17.0.1-dev.1](https://github.com/ReVanced/revanced-patcher/compare/v17.0.0...v17.0.1-dev.1) (2023-10-10) ### Performance Improvements * Run the garbage collector after writing dex files ([d9fb241](https://github.com/ReVanced/revanced-patcher/commit/d9fb241d57b0c4340130c0e5900250e66730ea56)) --- CHANGELOG.md | 7 +++++++ gradle.properties | 2 +- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 85085a5..97a63a5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,10 @@ +## [17.0.1-dev.1](https://github.com/ReVanced/revanced-patcher/compare/v17.0.0...v17.0.1-dev.1) (2023-10-10) + + +### Performance Improvements + +* Run the garbage collector after writing dex files ([d9fb241](https://github.com/ReVanced/revanced-patcher/commit/d9fb241d57b0c4340130c0e5900250e66730ea56)) + # [17.0.0](https://github.com/ReVanced/revanced-patcher/compare/v16.0.2...v17.0.0) (2023-10-09) diff --git a/gradle.properties b/gradle.properties index 368b0b1..0276c9a 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,4 +1,4 @@ org.gradle.parallel = true org.gradle.caching = true kotlin.code.style = official -version = 17.0.0 +version = 17.0.1-dev.1 From 445603145979a6f67823a79f9d6cd140299cff37 Mon Sep 17 00:00:00 2001 From: oSumAtrIX Date: Sat, 14 Oct 2023 19:09:05 +0200 Subject: [PATCH 04/36] feat: Remove patch annotation processor Unfortunately processing annotations required generating new classes which turned out to be quite cumbersome to work with, especially when trying to publish an API. Therefor, the patch annotation retention is now `RUNTIME`. BREAKING CHANGE: Various patch constructor signatures have changed. --- api/revanced-patcher.api | 914 ++++++++++++++++++ build.gradle.kts | 3 +- gradle/libs.versions.toml | 8 - .../revanced-patch-annotation-processor.api | 24 - .../build.gradle.kts | 45 - .../settings.gradle.kts | 2 - .../annotation/processor/PatchProcessor.kt | 207 ---- .../processor/PatchProcessorProvider.kt | 9 - ...ols.ksp.processing.SymbolProcessorProvider | 1 - .../processor/TestPatchAnnotationProcessor.kt | 147 --- .../samples/dependencies/DependencyPatch.kt | 10 - .../samples/dependencies/DependentPatch.kt | 12 - .../manualdependency/DependencyPatch.kt | 10 - .../manualdependency/DependentPatch.kt | 17 - .../samples/null/NullPropertiesPatch.kt | 14 - .../processor/samples/options/OptionsPatch.kt | 19 - .../samples/processing/ProcessablePatch.kt | 10 - revanced-patcher/build.gradle.kts | 1 - .../revanced/patcher/patch/BytecodePatch.kt | 18 +- .../app/revanced/patcher/patch/Patch.kt | 69 +- .../revanced/patcher/patch/ResourcePatch.kt | 18 +- .../patch/annotation/PatchAnnotations.kt | 1 - settings.gradle.kts | 2 +- 23 files changed, 971 insertions(+), 590 deletions(-) delete mode 100644 revanced-patch-annotation-processor/api/revanced-patch-annotation-processor.api delete mode 100644 revanced-patch-annotation-processor/build.gradle.kts delete mode 100644 revanced-patch-annotation-processor/settings.gradle.kts delete mode 100644 revanced-patch-annotation-processor/src/main/kotlin/app/revanced/patcher/patch/annotation/processor/PatchProcessor.kt delete mode 100644 revanced-patch-annotation-processor/src/main/kotlin/app/revanced/patcher/patch/annotation/processor/PatchProcessorProvider.kt delete mode 100644 revanced-patch-annotation-processor/src/main/resources/META-INF/services/com.google.devtools.ksp.processing.SymbolProcessorProvider delete mode 100644 revanced-patch-annotation-processor/src/test/kotlin/app/revanced/patcher/patch/annotation/processor/TestPatchAnnotationProcessor.kt delete mode 100644 revanced-patch-annotation-processor/src/test/resources/app/revanced/patcher/patch/annotation/processor/samples/dependencies/DependencyPatch.kt delete mode 100644 revanced-patch-annotation-processor/src/test/resources/app/revanced/patcher/patch/annotation/processor/samples/dependencies/DependentPatch.kt delete mode 100644 revanced-patch-annotation-processor/src/test/resources/app/revanced/patcher/patch/annotation/processor/samples/limitations/manualdependency/DependencyPatch.kt delete mode 100644 revanced-patch-annotation-processor/src/test/resources/app/revanced/patcher/patch/annotation/processor/samples/limitations/manualdependency/DependentPatch.kt delete mode 100644 revanced-patch-annotation-processor/src/test/resources/app/revanced/patcher/patch/annotation/processor/samples/null/NullPropertiesPatch.kt delete mode 100644 revanced-patch-annotation-processor/src/test/resources/app/revanced/patcher/patch/annotation/processor/samples/options/OptionsPatch.kt delete mode 100644 revanced-patch-annotation-processor/src/test/resources/app/revanced/patcher/patch/annotation/processor/samples/processing/ProcessablePatch.kt rename {revanced-patch-annotation-processor => revanced-patcher}/src/main/kotlin/app/revanced/patcher/patch/annotation/PatchAnnotations.kt (97%) diff --git a/api/revanced-patcher.api b/api/revanced-patcher.api index e69de29..d727f2d 100644 --- a/api/revanced-patcher.api +++ b/api/revanced-patcher.api @@ -0,0 +1,914 @@ +public abstract interface class app/revanced/patcher/IntegrationsConsumer { + public abstract fun acceptIntegrations (Ljava/util/List;)V +} + +public final class app/revanced/patcher/PackageMetadata { + public final fun getPackageName ()Ljava/lang/String; + public final fun getPackageVersion ()Ljava/lang/String; +} + +public abstract class app/revanced/patcher/PatchBundleLoader : java/util/Set, kotlin/jvm/internal/markers/KMappedMarker { + public synthetic fun (Ljava/lang/ClassLoader;[Ljava/io/File;Lkotlin/jvm/functions/Function1;Ljava/util/Set;Lkotlin/jvm/internal/DefaultConstructorMarker;)V + public fun add (Lapp/revanced/patcher/patch/Patch;)Z + public synthetic fun add (Ljava/lang/Object;)Z + public fun addAll (Ljava/util/Collection;)Z + public fun clear ()V + public fun contains (Lapp/revanced/patcher/patch/Patch;)Z + public final fun contains (Ljava/lang/Object;)Z + public fun containsAll (Ljava/util/Collection;)Z + public fun getSize ()I + public fun isEmpty ()Z + public fun iterator ()Ljava/util/Iterator; + public fun remove (Ljava/lang/Object;)Z + public fun removeAll (Ljava/util/Collection;)Z + public fun retainAll (Ljava/util/Collection;)Z + public final fun size ()I + public fun toArray ()[Ljava/lang/Object; + public fun toArray ([Ljava/lang/Object;)[Ljava/lang/Object; +} + +public final class app/revanced/patcher/PatchBundleLoader$Dex : app/revanced/patcher/PatchBundleLoader { + public fun ([Ljava/io/File;)V + public fun ([Ljava/io/File;Ljava/io/File;)V + public synthetic fun ([Ljava/io/File;Ljava/io/File;ILkotlin/jvm/internal/DefaultConstructorMarker;)V +} + +public final class app/revanced/patcher/PatchBundleLoader$Jar : app/revanced/patcher/PatchBundleLoader { + public fun ([Ljava/io/File;)V +} + +public abstract interface class app/revanced/patcher/PatchExecutorFunction : java/util/function/Function { +} + +public final class app/revanced/patcher/Patcher : app/revanced/patcher/IntegrationsConsumer, app/revanced/patcher/PatchExecutorFunction, app/revanced/patcher/PatchesConsumer, java/io/Closeable, java/util/function/Supplier { + public fun (Lapp/revanced/patcher/PatcherOptions;)V + public fun acceptIntegrations (Ljava/util/List;)V + public fun acceptPatches (Ljava/util/List;)V + public synthetic fun apply (Ljava/lang/Object;)Ljava/lang/Object; + public fun apply (Z)Lkotlinx/coroutines/flow/Flow; + public fun close ()V + public fun get ()Lapp/revanced/patcher/PatcherResult; + public synthetic fun get ()Ljava/lang/Object; + public final fun getContext ()Lapp/revanced/patcher/PatcherContext; +} + +public final class app/revanced/patcher/PatcherContext { + public final fun getPackageMetadata ()Lapp/revanced/patcher/PackageMetadata; +} + +public abstract class app/revanced/patcher/PatcherException : java/lang/Exception { + public synthetic fun (Ljava/lang/String;Ljava/lang/Throwable;Lkotlin/jvm/internal/DefaultConstructorMarker;)V + public synthetic fun (Ljava/lang/String;Lkotlin/jvm/internal/DefaultConstructorMarker;)V +} + +public final class app/revanced/patcher/PatcherException$CircularDependencyException : app/revanced/patcher/PatcherException { +} + +public final class app/revanced/patcher/PatcherOptions { + public fun (Ljava/io/File;Ljava/io/File;Ljava/lang/String;Ljava/lang/String;)V + public synthetic fun (Ljava/io/File;Ljava/io/File;Ljava/lang/String;Ljava/lang/String;ILkotlin/jvm/internal/DefaultConstructorMarker;)V + public fun (Ljava/io/File;Ljava/io/File;Ljava/lang/String;Ljava/lang/String;Z)V + public synthetic fun (Ljava/io/File;Ljava/io/File;Ljava/lang/String;Ljava/lang/String;ZILkotlin/jvm/internal/DefaultConstructorMarker;)V + public final fun copy (Ljava/io/File;Ljava/io/File;Ljava/lang/String;Ljava/lang/String;Z)Lapp/revanced/patcher/PatcherOptions; + public static synthetic fun copy$default (Lapp/revanced/patcher/PatcherOptions;Ljava/io/File;Ljava/io/File;Ljava/lang/String;Ljava/lang/String;ZILjava/lang/Object;)Lapp/revanced/patcher/PatcherOptions; + public fun equals (Ljava/lang/Object;)Z + public fun hashCode ()I + public final fun recreateResourceCacheDirectory ()Ljava/io/File; + public fun toString ()Ljava/lang/String; +} + +public final class app/revanced/patcher/PatcherResult { + public fun (Ljava/util/List;Ljava/io/File;Ljava/util/List;)V + public synthetic fun (Ljava/util/List;Ljava/io/File;Ljava/util/List;ILkotlin/jvm/internal/DefaultConstructorMarker;)V + public final fun component1 ()Ljava/util/List; + public final fun component2 ()Ljava/io/File; + public final fun component3 ()Ljava/util/List; + public final fun copy (Ljava/util/List;Ljava/io/File;Ljava/util/List;)Lapp/revanced/patcher/PatcherResult; + public static synthetic fun copy$default (Lapp/revanced/patcher/PatcherResult;Ljava/util/List;Ljava/io/File;Ljava/util/List;ILjava/lang/Object;)Lapp/revanced/patcher/PatcherResult; + public fun equals (Ljava/lang/Object;)Z + public final fun getDexFiles ()Ljava/util/List; + public final fun getDoNotCompress ()Ljava/util/List; + public final fun getResourceFile ()Ljava/io/File; + public fun hashCode ()I + public fun toString ()Ljava/lang/String; +} + +public final class app/revanced/patcher/PatcherResult$PatchedDexFile { + public fun (Ljava/lang/String;Ljava/io/InputStream;)V + public final fun getName ()Ljava/lang/String; + public final fun getStream ()Ljava/io/InputStream; +} + +public abstract interface class app/revanced/patcher/PatchesConsumer { + public abstract fun acceptPatches (Ljava/util/List;)V +} + +public final class app/revanced/patcher/data/BytecodeContext : app/revanced/patcher/data/Context { + public final fun findClass (Ljava/lang/String;)Lapp/revanced/patcher/util/proxy/ClassProxy; + public final fun findClass (Lkotlin/jvm/functions/Function1;)Lapp/revanced/patcher/util/proxy/ClassProxy; + public synthetic fun get ()Ljava/lang/Object; + public fun get ()Ljava/util/List; + public final fun getClasses ()Lapp/revanced/patcher/util/ProxyClassList; + public final fun proxy (Lcom/android/tools/smali/dexlib2/iface/ClassDef;)Lapp/revanced/patcher/util/proxy/ClassProxy; + public final fun toMethodWalker (Lcom/android/tools/smali/dexlib2/iface/Method;)Lapp/revanced/patcher/util/method/MethodWalker; +} + +public abstract interface class app/revanced/patcher/data/Context : java/util/function/Supplier { +} + +public final class app/revanced/patcher/data/ResourceContext : app/revanced/patcher/data/Context, java/lang/Iterable, kotlin/jvm/internal/markers/KMappedMarker { + public fun get ()Ljava/io/File; + public synthetic fun get ()Ljava/lang/Object; + public final fun get (Ljava/lang/String;)Ljava/io/File; + public final fun getXmlEditor ()Lapp/revanced/patcher/data/ResourceContext$XmlFileHolder; + public fun iterator ()Ljava/util/Iterator; +} + +public final class app/revanced/patcher/data/ResourceContext$XmlFileHolder { + public fun (Lapp/revanced/patcher/data/ResourceContext;)V + public final fun get (Ljava/io/InputStream;)Lapp/revanced/patcher/util/DomFileEditor; + public final fun get (Ljava/lang/String;)Lapp/revanced/patcher/util/DomFileEditor; +} + +public final class app/revanced/patcher/extensions/ExtensionsKt { + public static final fun newLabel (Lapp/revanced/patcher/util/proxy/mutableTypes/MutableMethod;I)Lcom/android/tools/smali/dexlib2/builder/Label; + public static final fun or (ILcom/android/tools/smali/dexlib2/AccessFlags;)I + public static final fun or (Lcom/android/tools/smali/dexlib2/AccessFlags;I)I + public static final fun or (Lcom/android/tools/smali/dexlib2/AccessFlags;Lcom/android/tools/smali/dexlib2/AccessFlags;)I +} + +public final class app/revanced/patcher/extensions/InstructionExtensions { + public static final field INSTANCE Lapp/revanced/patcher/extensions/InstructionExtensions; + public final fun addInstruction (Lapp/revanced/patcher/util/proxy/mutableTypes/MutableMethod;ILcom/android/tools/smali/dexlib2/builder/BuilderInstruction;)V + public final fun addInstruction (Lapp/revanced/patcher/util/proxy/mutableTypes/MutableMethod;ILjava/lang/String;)V + public final fun addInstruction (Lapp/revanced/patcher/util/proxy/mutableTypes/MutableMethod;Lcom/android/tools/smali/dexlib2/builder/BuilderInstruction;)V + public final fun addInstruction (Lapp/revanced/patcher/util/proxy/mutableTypes/MutableMethod;Ljava/lang/String;)V + public final fun addInstructions (Lapp/revanced/patcher/util/proxy/mutableTypes/MutableMethod;ILjava/lang/String;)V + public final fun addInstructions (Lapp/revanced/patcher/util/proxy/mutableTypes/MutableMethod;ILjava/util/List;)V + public final fun addInstructions (Lapp/revanced/patcher/util/proxy/mutableTypes/MutableMethod;Ljava/lang/String;)V + public final fun addInstructions (Lapp/revanced/patcher/util/proxy/mutableTypes/MutableMethod;Ljava/util/List;)V + public final fun addInstructions (Lcom/android/tools/smali/dexlib2/builder/MutableMethodImplementation;ILjava/util/List;)V + public final fun addInstructions (Lcom/android/tools/smali/dexlib2/builder/MutableMethodImplementation;Ljava/util/List;)V + public final fun addInstructionsWithLabels (Lapp/revanced/patcher/util/proxy/mutableTypes/MutableMethod;ILjava/lang/String;[Lapp/revanced/patcher/util/smali/ExternalLabel;)V + public final fun getInstruction (Lapp/revanced/patcher/util/proxy/mutableTypes/MutableMethod;I)Lcom/android/tools/smali/dexlib2/builder/BuilderInstruction; + public final fun getInstruction (Lapp/revanced/patcher/util/proxy/mutableTypes/MutableMethod;I)Ljava/lang/Object; + public final fun getInstruction (Lcom/android/tools/smali/dexlib2/builder/MutableMethodImplementation;I)Lcom/android/tools/smali/dexlib2/builder/BuilderInstruction; + public final fun getInstruction (Lcom/android/tools/smali/dexlib2/builder/MutableMethodImplementation;I)Ljava/lang/Object; + public final fun getInstructions (Lapp/revanced/patcher/util/proxy/mutableTypes/MutableMethod;)Ljava/util/List; + public final fun removeInstruction (Lapp/revanced/patcher/util/proxy/mutableTypes/MutableMethod;I)V + public final fun removeInstructions (Lapp/revanced/patcher/util/proxy/mutableTypes/MutableMethod;I)V + public final fun removeInstructions (Lapp/revanced/patcher/util/proxy/mutableTypes/MutableMethod;II)V + public final fun removeInstructions (Lcom/android/tools/smali/dexlib2/builder/MutableMethodImplementation;I)V + public final fun removeInstructions (Lcom/android/tools/smali/dexlib2/builder/MutableMethodImplementation;II)V + public final fun replaceInstruction (Lapp/revanced/patcher/util/proxy/mutableTypes/MutableMethod;ILcom/android/tools/smali/dexlib2/builder/BuilderInstruction;)V + public final fun replaceInstruction (Lapp/revanced/patcher/util/proxy/mutableTypes/MutableMethod;ILjava/lang/String;)V + public final fun replaceInstructions (Lapp/revanced/patcher/util/proxy/mutableTypes/MutableMethod;ILjava/lang/String;)V + public final fun replaceInstructions (Lapp/revanced/patcher/util/proxy/mutableTypes/MutableMethod;ILjava/util/List;)V + public final fun replaceInstructions (Lcom/android/tools/smali/dexlib2/builder/MutableMethodImplementation;ILjava/util/List;)V +} + +public final class app/revanced/patcher/extensions/MethodFingerprintExtensions { + public static final field INSTANCE Lapp/revanced/patcher/extensions/MethodFingerprintExtensions; + public final fun getFuzzyPatternScanMethod (Lapp/revanced/patcher/fingerprint/method/impl/MethodFingerprint;)Lapp/revanced/patcher/fingerprint/method/annotation/FuzzyPatternScanMethod; +} + +public abstract interface class app/revanced/patcher/fingerprint/Fingerprint { +} + +public abstract interface annotation class app/revanced/patcher/fingerprint/method/annotation/FuzzyPatternScanMethod : java/lang/annotation/Annotation { + public abstract fun threshold ()I +} + +public abstract class app/revanced/patcher/fingerprint/method/impl/MethodFingerprint : app/revanced/patcher/fingerprint/Fingerprint { + public static final field Companion Lapp/revanced/patcher/fingerprint/method/impl/MethodFingerprint$Companion; + public fun ()V + public fun (Ljava/lang/String;Ljava/lang/Integer;Ljava/lang/Iterable;Ljava/lang/Iterable;Ljava/lang/Iterable;Lkotlin/jvm/functions/Function2;)V + public synthetic fun (Ljava/lang/String;Ljava/lang/Integer;Ljava/lang/Iterable;Ljava/lang/Iterable;Ljava/lang/Iterable;Lkotlin/jvm/functions/Function2;ILkotlin/jvm/internal/DefaultConstructorMarker;)V + public final fun getResult ()Lapp/revanced/patcher/fingerprint/method/impl/MethodFingerprintResult; + public final fun setResult (Lapp/revanced/patcher/fingerprint/method/impl/MethodFingerprintResult;)V +} + +public final class app/revanced/patcher/fingerprint/method/impl/MethodFingerprint$Companion { + public final fun resolve (Lapp/revanced/patcher/fingerprint/method/impl/MethodFingerprint;Lapp/revanced/patcher/data/BytecodeContext;Lcom/android/tools/smali/dexlib2/iface/ClassDef;)Z + public final fun resolve (Lapp/revanced/patcher/fingerprint/method/impl/MethodFingerprint;Lapp/revanced/patcher/data/BytecodeContext;Lcom/android/tools/smali/dexlib2/iface/Method;Lcom/android/tools/smali/dexlib2/iface/ClassDef;)Z + public final fun resolve (Ljava/lang/Iterable;Lapp/revanced/patcher/data/BytecodeContext;Ljava/lang/Iterable;)V +} + +public final class app/revanced/patcher/fingerprint/method/impl/MethodFingerprintResult { + public fun (Lcom/android/tools/smali/dexlib2/iface/Method;Lcom/android/tools/smali/dexlib2/iface/ClassDef;Lapp/revanced/patcher/fingerprint/method/impl/MethodFingerprintResult$MethodFingerprintScanResult;Lapp/revanced/patcher/data/BytecodeContext;)V + public final fun component1 ()Lcom/android/tools/smali/dexlib2/iface/Method; + public final fun component2 ()Lcom/android/tools/smali/dexlib2/iface/ClassDef; + public final fun component3 ()Lapp/revanced/patcher/fingerprint/method/impl/MethodFingerprintResult$MethodFingerprintScanResult; + public final fun copy (Lcom/android/tools/smali/dexlib2/iface/Method;Lcom/android/tools/smali/dexlib2/iface/ClassDef;Lapp/revanced/patcher/fingerprint/method/impl/MethodFingerprintResult$MethodFingerprintScanResult;Lapp/revanced/patcher/data/BytecodeContext;)Lapp/revanced/patcher/fingerprint/method/impl/MethodFingerprintResult; + public static synthetic fun copy$default (Lapp/revanced/patcher/fingerprint/method/impl/MethodFingerprintResult;Lcom/android/tools/smali/dexlib2/iface/Method;Lcom/android/tools/smali/dexlib2/iface/ClassDef;Lapp/revanced/patcher/fingerprint/method/impl/MethodFingerprintResult$MethodFingerprintScanResult;Lapp/revanced/patcher/data/BytecodeContext;ILjava/lang/Object;)Lapp/revanced/patcher/fingerprint/method/impl/MethodFingerprintResult; + public fun equals (Ljava/lang/Object;)Z + public final fun getClassDef ()Lcom/android/tools/smali/dexlib2/iface/ClassDef; + public final fun getMethod ()Lcom/android/tools/smali/dexlib2/iface/Method; + public final fun getMutableClass ()Lapp/revanced/patcher/util/proxy/mutableTypes/MutableClass; + public final fun getMutableMethod ()Lapp/revanced/patcher/util/proxy/mutableTypes/MutableMethod; + public final fun getScanResult ()Lapp/revanced/patcher/fingerprint/method/impl/MethodFingerprintResult$MethodFingerprintScanResult; + public fun hashCode ()I + public fun toString ()Ljava/lang/String; +} + +public final class app/revanced/patcher/fingerprint/method/impl/MethodFingerprintResult$MethodFingerprintScanResult { + public fun (Lapp/revanced/patcher/fingerprint/method/impl/MethodFingerprintResult$MethodFingerprintScanResult$PatternScanResult;Lapp/revanced/patcher/fingerprint/method/impl/MethodFingerprintResult$MethodFingerprintScanResult$StringsScanResult;)V + public final fun component1 ()Lapp/revanced/patcher/fingerprint/method/impl/MethodFingerprintResult$MethodFingerprintScanResult$PatternScanResult; + public final fun component2 ()Lapp/revanced/patcher/fingerprint/method/impl/MethodFingerprintResult$MethodFingerprintScanResult$StringsScanResult; + public final fun copy (Lapp/revanced/patcher/fingerprint/method/impl/MethodFingerprintResult$MethodFingerprintScanResult$PatternScanResult;Lapp/revanced/patcher/fingerprint/method/impl/MethodFingerprintResult$MethodFingerprintScanResult$StringsScanResult;)Lapp/revanced/patcher/fingerprint/method/impl/MethodFingerprintResult$MethodFingerprintScanResult; + public static synthetic fun copy$default (Lapp/revanced/patcher/fingerprint/method/impl/MethodFingerprintResult$MethodFingerprintScanResult;Lapp/revanced/patcher/fingerprint/method/impl/MethodFingerprintResult$MethodFingerprintScanResult$PatternScanResult;Lapp/revanced/patcher/fingerprint/method/impl/MethodFingerprintResult$MethodFingerprintScanResult$StringsScanResult;ILjava/lang/Object;)Lapp/revanced/patcher/fingerprint/method/impl/MethodFingerprintResult$MethodFingerprintScanResult; + public fun equals (Ljava/lang/Object;)Z + public final fun getPatternScanResult ()Lapp/revanced/patcher/fingerprint/method/impl/MethodFingerprintResult$MethodFingerprintScanResult$PatternScanResult; + public final fun getStringsScanResult ()Lapp/revanced/patcher/fingerprint/method/impl/MethodFingerprintResult$MethodFingerprintScanResult$StringsScanResult; + public fun hashCode ()I + public fun toString ()Ljava/lang/String; +} + +public final class app/revanced/patcher/fingerprint/method/impl/MethodFingerprintResult$MethodFingerprintScanResult$PatternScanResult { + public fun (IILjava/util/List;)V + public synthetic fun (IILjava/util/List;ILkotlin/jvm/internal/DefaultConstructorMarker;)V + public final fun component1 ()I + public final fun component2 ()I + public final fun component3 ()Ljava/util/List; + public final fun copy (IILjava/util/List;)Lapp/revanced/patcher/fingerprint/method/impl/MethodFingerprintResult$MethodFingerprintScanResult$PatternScanResult; + public static synthetic fun copy$default (Lapp/revanced/patcher/fingerprint/method/impl/MethodFingerprintResult$MethodFingerprintScanResult$PatternScanResult;IILjava/util/List;ILjava/lang/Object;)Lapp/revanced/patcher/fingerprint/method/impl/MethodFingerprintResult$MethodFingerprintScanResult$PatternScanResult; + public fun equals (Ljava/lang/Object;)Z + public final fun getEndIndex ()I + public final fun getStartIndex ()I + public final fun getWarnings ()Ljava/util/List; + public fun hashCode ()I + public final fun setWarnings (Ljava/util/List;)V + public fun toString ()Ljava/lang/String; +} + +public final class app/revanced/patcher/fingerprint/method/impl/MethodFingerprintResult$MethodFingerprintScanResult$PatternScanResult$Warning { + public fun (Lcom/android/tools/smali/dexlib2/Opcode;Lcom/android/tools/smali/dexlib2/Opcode;II)V + public final fun component1 ()Lcom/android/tools/smali/dexlib2/Opcode; + public final fun component2 ()Lcom/android/tools/smali/dexlib2/Opcode; + public final fun component3 ()I + public final fun component4 ()I + public final fun copy (Lcom/android/tools/smali/dexlib2/Opcode;Lcom/android/tools/smali/dexlib2/Opcode;II)Lapp/revanced/patcher/fingerprint/method/impl/MethodFingerprintResult$MethodFingerprintScanResult$PatternScanResult$Warning; + public static synthetic fun copy$default (Lapp/revanced/patcher/fingerprint/method/impl/MethodFingerprintResult$MethodFingerprintScanResult$PatternScanResult$Warning;Lcom/android/tools/smali/dexlib2/Opcode;Lcom/android/tools/smali/dexlib2/Opcode;IIILjava/lang/Object;)Lapp/revanced/patcher/fingerprint/method/impl/MethodFingerprintResult$MethodFingerprintScanResult$PatternScanResult$Warning; + public fun equals (Ljava/lang/Object;)Z + public final fun getCorrectOpcode ()Lcom/android/tools/smali/dexlib2/Opcode; + public final fun getInstructionIndex ()I + public final fun getPatternIndex ()I + public final fun getWrongOpcode ()Lcom/android/tools/smali/dexlib2/Opcode; + public fun hashCode ()I + public fun toString ()Ljava/lang/String; +} + +public final class app/revanced/patcher/fingerprint/method/impl/MethodFingerprintResult$MethodFingerprintScanResult$StringsScanResult { + public fun (Ljava/util/List;)V + public final fun component1 ()Ljava/util/List; + public final fun copy (Ljava/util/List;)Lapp/revanced/patcher/fingerprint/method/impl/MethodFingerprintResult$MethodFingerprintScanResult$StringsScanResult; + public static synthetic fun copy$default (Lapp/revanced/patcher/fingerprint/method/impl/MethodFingerprintResult$MethodFingerprintScanResult$StringsScanResult;Ljava/util/List;ILjava/lang/Object;)Lapp/revanced/patcher/fingerprint/method/impl/MethodFingerprintResult$MethodFingerprintScanResult$StringsScanResult; + public fun equals (Ljava/lang/Object;)Z + public final fun getMatches ()Ljava/util/List; + public fun hashCode ()I + public fun toString ()Ljava/lang/String; +} + +public final class app/revanced/patcher/fingerprint/method/impl/MethodFingerprintResult$MethodFingerprintScanResult$StringsScanResult$StringMatch { + public fun (Ljava/lang/String;I)V + public final fun component1 ()Ljava/lang/String; + public final fun component2 ()I + public final fun copy (Ljava/lang/String;I)Lapp/revanced/patcher/fingerprint/method/impl/MethodFingerprintResult$MethodFingerprintScanResult$StringsScanResult$StringMatch; + public static synthetic fun copy$default (Lapp/revanced/patcher/fingerprint/method/impl/MethodFingerprintResult$MethodFingerprintScanResult$StringsScanResult$StringMatch;Ljava/lang/String;IILjava/lang/Object;)Lapp/revanced/patcher/fingerprint/method/impl/MethodFingerprintResult$MethodFingerprintScanResult$StringsScanResult$StringMatch; + public fun equals (Ljava/lang/Object;)Z + public final fun getIndex ()I + public final fun getString ()Ljava/lang/String; + public fun hashCode ()I + public fun toString ()Ljava/lang/String; +} + +public abstract interface class app/revanced/patcher/logging/Logger { + public abstract fun error (Ljava/lang/String;)V + public abstract fun info (Ljava/lang/String;)V + public abstract fun trace (Ljava/lang/String;)V + public abstract fun warn (Ljava/lang/String;)V +} + +public final class app/revanced/patcher/logging/Logger$DefaultImpls { + public static fun error (Lapp/revanced/patcher/logging/Logger;Ljava/lang/String;)V + public static fun info (Lapp/revanced/patcher/logging/Logger;Ljava/lang/String;)V + public static fun trace (Lapp/revanced/patcher/logging/Logger;Ljava/lang/String;)V + public static fun warn (Lapp/revanced/patcher/logging/Logger;Ljava/lang/String;)V +} + +public final class app/revanced/patcher/logging/impl/NopLogger : app/revanced/patcher/logging/Logger { + public static final field INSTANCE Lapp/revanced/patcher/logging/impl/NopLogger; + public fun error (Ljava/lang/String;)V + public fun info (Ljava/lang/String;)V + public fun trace (Ljava/lang/String;)V + public fun warn (Ljava/lang/String;)V +} + +public abstract class app/revanced/patcher/patch/BytecodePatch : app/revanced/patcher/patch/Patch { + public fun ()V + public fun (Ljava/util/Set;)V + public synthetic fun (Ljava/util/Set;ILkotlin/jvm/internal/DefaultConstructorMarker;)V +} + +public abstract class app/revanced/patcher/patch/Patch { + public fun equals (Ljava/lang/Object;)Z + public abstract fun execute (Lapp/revanced/patcher/data/Context;)V + public final fun getCompatiblePackages ()Ljava/util/Set; + public final fun getDependencies ()Ljava/util/Set; + public final fun getDescription ()Ljava/lang/String; + public final fun getName ()Ljava/lang/String; + public final fun getOptions ()Lapp/revanced/patcher/patch/options/PatchOptions; + public final fun getRequiresIntegrations ()Z + public final fun getUse ()Z + public fun hashCode ()I + public fun toString ()Ljava/lang/String; +} + +public final class app/revanced/patcher/patch/Patch$CompatiblePackage { + public fun (Ljava/lang/String;Ljava/util/Set;)V + public synthetic fun (Ljava/lang/String;Ljava/util/Set;ILkotlin/jvm/internal/DefaultConstructorMarker;)V + public final fun getName ()Ljava/lang/String; + public final fun getVersions ()Ljava/util/Set; +} + +public final class app/revanced/patcher/patch/PatchException : java/lang/Exception { + public fun (Ljava/lang/String;)V + public fun (Ljava/lang/String;Ljava/lang/Throwable;)V + public fun (Ljava/lang/Throwable;)V +} + +public final class app/revanced/patcher/patch/PatchResult { + public final fun getException ()Lapp/revanced/patcher/patch/PatchException; + public final fun getPatch ()Lapp/revanced/patcher/patch/Patch; +} + +public abstract class app/revanced/patcher/patch/ResourcePatch : app/revanced/patcher/patch/Patch { + public fun ()V +} + +public abstract interface annotation class app/revanced/patcher/patch/annotation/CompatiblePackage : java/lang/annotation/Annotation { + public abstract fun name ()Ljava/lang/String; + public abstract fun versions ()[Ljava/lang/String; +} + +public abstract interface annotation class app/revanced/patcher/patch/annotation/Patch : java/lang/annotation/Annotation { + public abstract fun compatiblePackages ()[Lapp/revanced/patcher/patch/annotation/CompatiblePackage; + public abstract fun dependencies ()[Ljava/lang/Class; + public abstract fun description ()Ljava/lang/String; + public abstract fun name ()Ljava/lang/String; + public abstract fun requiresIntegrations ()Z + public abstract fun use ()Z +} + +public abstract class app/revanced/patcher/patch/options/PatchOption { + public fun (Ljava/lang/String;Ljava/lang/Object;Ljava/lang/String;Ljava/lang/String;ZLkotlin/jvm/functions/Function1;)V + public final fun getDescription ()Ljava/lang/String; + public final fun getKey ()Ljava/lang/String; + public final fun getRequired ()Z + public final fun getTitle ()Ljava/lang/String; + public final fun getValidate ()Lkotlin/jvm/functions/Function1; + public final fun getValue ()Ljava/lang/Object; + public final fun getValue (Ljava/lang/Object;Lkotlin/reflect/KProperty;)Ljava/lang/Object; + public final fun setValue (Ljava/lang/Object;)V + public final fun setValue (Ljava/lang/Object;Lkotlin/reflect/KProperty;Ljava/lang/Object;)V +} + +public abstract class app/revanced/patcher/patch/options/PatchOptionException : java/lang/Exception { + public synthetic fun (Ljava/lang/String;Lkotlin/jvm/internal/DefaultConstructorMarker;)V +} + +public final class app/revanced/patcher/patch/options/PatchOptionException$InvalidValueTypeException : app/revanced/patcher/patch/options/PatchOptionException { + public fun (Ljava/lang/String;Ljava/lang/String;)V +} + +public final class app/revanced/patcher/patch/options/PatchOptionException$PatchOptionNotFoundException : app/revanced/patcher/patch/options/PatchOptionException { + public fun (Ljava/lang/String;)V +} + +public final class app/revanced/patcher/patch/options/PatchOptionException$ValueRequiredException : app/revanced/patcher/patch/options/PatchOptionException { + public fun (Lapp/revanced/patcher/patch/options/PatchOption;)V +} + +public final class app/revanced/patcher/patch/options/PatchOptionException$ValueValidationException : app/revanced/patcher/patch/options/PatchOptionException { + public fun (Ljava/lang/Object;Lapp/revanced/patcher/patch/options/PatchOption;)V +} + +public final class app/revanced/patcher/patch/options/PatchOptions : java/util/Map, kotlin/jvm/internal/markers/KMutableMap { + public fun ()V + public fun clear ()V + public final fun containsKey (Ljava/lang/Object;)Z + public fun containsKey (Ljava/lang/String;)Z + public fun containsValue (Lapp/revanced/patcher/patch/options/PatchOption;)Z + public final fun containsValue (Ljava/lang/Object;)Z + public final fun entrySet ()Ljava/util/Set; + public final fun get (Ljava/lang/Object;)Lapp/revanced/patcher/patch/options/PatchOption; + public final synthetic fun get (Ljava/lang/Object;)Ljava/lang/Object; + public fun get (Ljava/lang/String;)Lapp/revanced/patcher/patch/options/PatchOption; + public fun getEntries ()Ljava/util/Set; + public fun getKeys ()Ljava/util/Set; + public fun getSize ()I + public fun getValues ()Ljava/util/Collection; + public fun isEmpty ()Z + public final fun keySet ()Ljava/util/Set; + public synthetic fun put (Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; + public fun put (Ljava/lang/String;Lapp/revanced/patcher/patch/options/PatchOption;)Lapp/revanced/patcher/patch/options/PatchOption; + public fun putAll (Ljava/util/Map;)V + public final fun register (Lapp/revanced/patcher/patch/options/PatchOption;)V + public final fun remove (Ljava/lang/Object;)Lapp/revanced/patcher/patch/options/PatchOption; + public final synthetic fun remove (Ljava/lang/Object;)Ljava/lang/Object; + public fun remove (Ljava/lang/String;)Lapp/revanced/patcher/patch/options/PatchOption; + public final fun set (Ljava/lang/String;Ljava/lang/Object;)V + public final fun size ()I + public final fun values ()Ljava/util/Collection; +} + +public final class app/revanced/patcher/patch/options/types/BooleanPatchOption : app/revanced/patcher/patch/options/PatchOption { + public static final field Companion Lapp/revanced/patcher/patch/options/types/BooleanPatchOption$Companion; + public synthetic fun (Ljava/lang/String;Ljava/lang/Boolean;Ljava/lang/String;Ljava/lang/String;ZLkotlin/jvm/functions/Function1;Lkotlin/jvm/internal/DefaultConstructorMarker;)V +} + +public final class app/revanced/patcher/patch/options/types/BooleanPatchOption$Companion { + public final fun booleanPatchOption (Lapp/revanced/patcher/patch/Patch;Ljava/lang/String;Ljava/lang/Boolean;Ljava/lang/String;Ljava/lang/String;ZLkotlin/jvm/functions/Function1;)Lapp/revanced/patcher/patch/options/types/BooleanPatchOption; + public static synthetic fun booleanPatchOption$default (Lapp/revanced/patcher/patch/options/types/BooleanPatchOption$Companion;Lapp/revanced/patcher/patch/Patch;Ljava/lang/String;Ljava/lang/Boolean;Ljava/lang/String;Ljava/lang/String;ZLkotlin/jvm/functions/Function1;ILjava/lang/Object;)Lapp/revanced/patcher/patch/options/types/BooleanPatchOption; +} + +public final class app/revanced/patcher/patch/options/types/FloatPatchOption : app/revanced/patcher/patch/options/PatchOption { + public static final field Companion Lapp/revanced/patcher/patch/options/types/FloatPatchOption$Companion; + public synthetic fun (Ljava/lang/String;Ljava/lang/Float;Ljava/lang/String;Ljava/lang/String;ZLkotlin/jvm/functions/Function1;Lkotlin/jvm/internal/DefaultConstructorMarker;)V +} + +public final class app/revanced/patcher/patch/options/types/FloatPatchOption$Companion { + public final fun floatPatchOption (Lapp/revanced/patcher/patch/Patch;Ljava/lang/String;Ljava/lang/Float;Ljava/lang/String;Ljava/lang/String;ZLkotlin/jvm/functions/Function1;)Lapp/revanced/patcher/patch/options/types/FloatPatchOption; + public static synthetic fun floatPatchOption$default (Lapp/revanced/patcher/patch/options/types/FloatPatchOption$Companion;Lapp/revanced/patcher/patch/Patch;Ljava/lang/String;Ljava/lang/Float;Ljava/lang/String;Ljava/lang/String;ZLkotlin/jvm/functions/Function1;ILjava/lang/Object;)Lapp/revanced/patcher/patch/options/types/FloatPatchOption; +} + +public final class app/revanced/patcher/patch/options/types/IntPatchOption : app/revanced/patcher/patch/options/PatchOption { + public static final field Companion Lapp/revanced/patcher/patch/options/types/IntPatchOption$Companion; + public synthetic fun (Ljava/lang/String;Ljava/lang/Integer;Ljava/lang/String;Ljava/lang/String;ZLkotlin/jvm/functions/Function1;Lkotlin/jvm/internal/DefaultConstructorMarker;)V +} + +public final class app/revanced/patcher/patch/options/types/IntPatchOption$Companion { + public final fun intPatchOption (Lapp/revanced/patcher/patch/Patch;Ljava/lang/String;Ljava/lang/Integer;Ljava/lang/String;Ljava/lang/String;ZLkotlin/jvm/functions/Function1;)Lapp/revanced/patcher/patch/options/types/IntPatchOption; + public static synthetic fun intPatchOption$default (Lapp/revanced/patcher/patch/options/types/IntPatchOption$Companion;Lapp/revanced/patcher/patch/Patch;Ljava/lang/String;Ljava/lang/Integer;Ljava/lang/String;Ljava/lang/String;ZLkotlin/jvm/functions/Function1;ILjava/lang/Object;)Lapp/revanced/patcher/patch/options/types/IntPatchOption; +} + +public final class app/revanced/patcher/patch/options/types/LongPatchOption : app/revanced/patcher/patch/options/PatchOption { + public static final field Companion Lapp/revanced/patcher/patch/options/types/LongPatchOption$Companion; + public synthetic fun (Ljava/lang/String;Ljava/lang/Long;Ljava/lang/String;Ljava/lang/String;ZLkotlin/jvm/functions/Function1;Lkotlin/jvm/internal/DefaultConstructorMarker;)V +} + +public final class app/revanced/patcher/patch/options/types/LongPatchOption$Companion { + public final fun longPatchOption (Lapp/revanced/patcher/patch/Patch;Ljava/lang/String;Ljava/lang/Long;Ljava/lang/String;Ljava/lang/String;ZLkotlin/jvm/functions/Function1;)Lapp/revanced/patcher/patch/options/types/LongPatchOption; + public static synthetic fun longPatchOption$default (Lapp/revanced/patcher/patch/options/types/LongPatchOption$Companion;Lapp/revanced/patcher/patch/Patch;Ljava/lang/String;Ljava/lang/Long;Ljava/lang/String;Ljava/lang/String;ZLkotlin/jvm/functions/Function1;ILjava/lang/Object;)Lapp/revanced/patcher/patch/options/types/LongPatchOption; +} + +public final class app/revanced/patcher/patch/options/types/StringPatchOption : app/revanced/patcher/patch/options/PatchOption { + public static final field Companion Lapp/revanced/patcher/patch/options/types/StringPatchOption$Companion; + public synthetic fun (Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;ZLkotlin/jvm/functions/Function1;Lkotlin/jvm/internal/DefaultConstructorMarker;)V +} + +public final class app/revanced/patcher/patch/options/types/StringPatchOption$Companion { + public final fun stringPatchOption (Lapp/revanced/patcher/patch/Patch;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;ZLkotlin/jvm/functions/Function1;)Lapp/revanced/patcher/patch/options/types/StringPatchOption; + public static synthetic fun stringPatchOption$default (Lapp/revanced/patcher/patch/options/types/StringPatchOption$Companion;Lapp/revanced/patcher/patch/Patch;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;ZLkotlin/jvm/functions/Function1;ILjava/lang/Object;)Lapp/revanced/patcher/patch/options/types/StringPatchOption; +} + +public final class app/revanced/patcher/patch/options/types/array/BooleanArrayPatchOption : app/revanced/patcher/patch/options/PatchOption { + public static final field Companion Lapp/revanced/patcher/patch/options/types/array/BooleanArrayPatchOption$Companion; + public synthetic fun (Ljava/lang/String;[Ljava/lang/Boolean;Ljava/lang/String;Ljava/lang/String;ZLkotlin/jvm/functions/Function1;Lkotlin/jvm/internal/DefaultConstructorMarker;)V +} + +public final class app/revanced/patcher/patch/options/types/array/BooleanArrayPatchOption$Companion { + public final fun booleanArrayPatchOption (Lapp/revanced/patcher/patch/Patch;Ljava/lang/String;[Ljava/lang/Boolean;Ljava/lang/String;Ljava/lang/String;ZLkotlin/jvm/functions/Function1;)Lapp/revanced/patcher/patch/options/types/array/BooleanArrayPatchOption; + public static synthetic fun booleanArrayPatchOption$default (Lapp/revanced/patcher/patch/options/types/array/BooleanArrayPatchOption$Companion;Lapp/revanced/patcher/patch/Patch;Ljava/lang/String;[Ljava/lang/Boolean;Ljava/lang/String;Ljava/lang/String;ZLkotlin/jvm/functions/Function1;ILjava/lang/Object;)Lapp/revanced/patcher/patch/options/types/array/BooleanArrayPatchOption; +} + +public final class app/revanced/patcher/patch/options/types/array/FloatArrayPatchOption : app/revanced/patcher/patch/options/PatchOption { + public static final field Companion Lapp/revanced/patcher/patch/options/types/array/FloatArrayPatchOption$Companion; + public synthetic fun (Ljava/lang/String;[Ljava/lang/Float;Ljava/lang/String;Ljava/lang/String;ZLkotlin/jvm/functions/Function1;Lkotlin/jvm/internal/DefaultConstructorMarker;)V +} + +public final class app/revanced/patcher/patch/options/types/array/FloatArrayPatchOption$Companion { + public final fun floatArrayPatchOption (Lapp/revanced/patcher/patch/Patch;Ljava/lang/String;[Ljava/lang/Float;Ljava/lang/String;Ljava/lang/String;ZLkotlin/jvm/functions/Function1;)Lapp/revanced/patcher/patch/options/types/array/FloatArrayPatchOption; + public static synthetic fun floatArrayPatchOption$default (Lapp/revanced/patcher/patch/options/types/array/FloatArrayPatchOption$Companion;Lapp/revanced/patcher/patch/Patch;Ljava/lang/String;[Ljava/lang/Float;Ljava/lang/String;Ljava/lang/String;ZLkotlin/jvm/functions/Function1;ILjava/lang/Object;)Lapp/revanced/patcher/patch/options/types/array/FloatArrayPatchOption; +} + +public final class app/revanced/patcher/patch/options/types/array/IntArrayPatchOption : app/revanced/patcher/patch/options/PatchOption { + public static final field Companion Lapp/revanced/patcher/patch/options/types/array/IntArrayPatchOption$Companion; + public synthetic fun (Ljava/lang/String;[Ljava/lang/Integer;Ljava/lang/String;Ljava/lang/String;ZLkotlin/jvm/functions/Function1;Lkotlin/jvm/internal/DefaultConstructorMarker;)V +} + +public final class app/revanced/patcher/patch/options/types/array/IntArrayPatchOption$Companion { + public final fun intArrayPatchOption (Lapp/revanced/patcher/patch/Patch;Ljava/lang/String;[Ljava/lang/Integer;Ljava/lang/String;Ljava/lang/String;ZLkotlin/jvm/functions/Function1;)Lapp/revanced/patcher/patch/options/types/array/IntArrayPatchOption; + public static synthetic fun intArrayPatchOption$default (Lapp/revanced/patcher/patch/options/types/array/IntArrayPatchOption$Companion;Lapp/revanced/patcher/patch/Patch;Ljava/lang/String;[Ljava/lang/Integer;Ljava/lang/String;Ljava/lang/String;ZLkotlin/jvm/functions/Function1;ILjava/lang/Object;)Lapp/revanced/patcher/patch/options/types/array/IntArrayPatchOption; +} + +public final class app/revanced/patcher/patch/options/types/array/LongArrayPatchOption : app/revanced/patcher/patch/options/PatchOption { + public static final field Companion Lapp/revanced/patcher/patch/options/types/array/LongArrayPatchOption$Companion; + public synthetic fun (Ljava/lang/String;[Ljava/lang/Long;Ljava/lang/String;Ljava/lang/String;ZLkotlin/jvm/functions/Function1;Lkotlin/jvm/internal/DefaultConstructorMarker;)V +} + +public final class app/revanced/patcher/patch/options/types/array/LongArrayPatchOption$Companion { + public final fun longArrayPatchOption (Lapp/revanced/patcher/patch/Patch;Ljava/lang/String;[Ljava/lang/Long;Ljava/lang/String;Ljava/lang/String;ZLkotlin/jvm/functions/Function1;)Lapp/revanced/patcher/patch/options/types/array/LongArrayPatchOption; + public static synthetic fun longArrayPatchOption$default (Lapp/revanced/patcher/patch/options/types/array/LongArrayPatchOption$Companion;Lapp/revanced/patcher/patch/Patch;Ljava/lang/String;[Ljava/lang/Long;Ljava/lang/String;Ljava/lang/String;ZLkotlin/jvm/functions/Function1;ILjava/lang/Object;)Lapp/revanced/patcher/patch/options/types/array/LongArrayPatchOption; +} + +public final class app/revanced/patcher/patch/options/types/array/StringArrayPatchOption : app/revanced/patcher/patch/options/PatchOption { + public static final field Companion Lapp/revanced/patcher/patch/options/types/array/StringArrayPatchOption$Companion; + public synthetic fun (Ljava/lang/String;[Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;ZLkotlin/jvm/functions/Function1;Lkotlin/jvm/internal/DefaultConstructorMarker;)V +} + +public final class app/revanced/patcher/patch/options/types/array/StringArrayPatchOption$Companion { + public final fun stringArrayPatchOption (Lapp/revanced/patcher/patch/Patch;Ljava/lang/String;[Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;ZLkotlin/jvm/functions/Function1;)Lapp/revanced/patcher/patch/options/types/array/StringArrayPatchOption; + public static synthetic fun stringArrayPatchOption$default (Lapp/revanced/patcher/patch/options/types/array/StringArrayPatchOption$Companion;Lapp/revanced/patcher/patch/Patch;Ljava/lang/String;[Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;ZLkotlin/jvm/functions/Function1;ILjava/lang/Object;)Lapp/revanced/patcher/patch/options/types/array/StringArrayPatchOption; +} + +public final class app/revanced/patcher/util/DomFileEditor : java/io/Closeable { + public fun (Ljava/io/File;)V + public fun close ()V + public final fun getFile ()Lorg/w3c/dom/Document; +} + +public final class app/revanced/patcher/util/ProxyClassList : java/util/Set, kotlin/jvm/internal/markers/KMutableSet { + public final fun add (Lapp/revanced/patcher/util/proxy/ClassProxy;)Z + public fun add (Lcom/android/tools/smali/dexlib2/iface/ClassDef;)Z + public synthetic fun add (Ljava/lang/Object;)Z + public fun addAll (Ljava/util/Collection;)Z + public fun clear ()V + public fun contains (Lcom/android/tools/smali/dexlib2/iface/ClassDef;)Z + public final fun contains (Ljava/lang/Object;)Z + public fun containsAll (Ljava/util/Collection;)Z + public fun getSize ()I + public fun isEmpty ()Z + public fun iterator ()Ljava/util/Iterator; + public fun remove (Lcom/android/tools/smali/dexlib2/iface/ClassDef;)Z + public final fun remove (Ljava/lang/Object;)Z + public fun removeAll (Ljava/util/Collection;)Z + public fun retainAll (Ljava/util/Collection;)Z + public final fun size ()I + public fun toArray ()[Ljava/lang/Object; + public fun toArray ([Ljava/lang/Object;)[Ljava/lang/Object; +} + +public final class app/revanced/patcher/util/method/MethodWalker { + public final fun getMethod ()Lcom/android/tools/smali/dexlib2/iface/Method; + public final fun nextMethod (IZ)Lapp/revanced/patcher/util/method/MethodWalker; + public static synthetic fun nextMethod$default (Lapp/revanced/patcher/util/method/MethodWalker;IZILjava/lang/Object;)Lapp/revanced/patcher/util/method/MethodWalker; +} + +public final class app/revanced/patcher/util/proxy/ClassProxy { + public final fun getImmutableClass ()Lcom/android/tools/smali/dexlib2/iface/ClassDef; + public final fun getMutableClass ()Lapp/revanced/patcher/util/proxy/mutableTypes/MutableClass; +} + +public final class app/revanced/patcher/util/proxy/mutableTypes/MutableAnnotation : com/android/tools/smali/dexlib2/base/BaseAnnotation { + public static final field Companion Lapp/revanced/patcher/util/proxy/mutableTypes/MutableAnnotation$Companion; + public fun (Lcom/android/tools/smali/dexlib2/iface/Annotation;)V + public fun getElements ()Ljava/util/Set; + public fun getType ()Ljava/lang/String; + public fun getVisibility ()I +} + +public final class app/revanced/patcher/util/proxy/mutableTypes/MutableAnnotation$Companion { + public final fun toMutable (Lcom/android/tools/smali/dexlib2/iface/Annotation;)Lapp/revanced/patcher/util/proxy/mutableTypes/MutableAnnotation; +} + +public final class app/revanced/patcher/util/proxy/mutableTypes/MutableAnnotationElement : com/android/tools/smali/dexlib2/base/BaseAnnotationElement { + public static final field Companion Lapp/revanced/patcher/util/proxy/mutableTypes/MutableAnnotationElement$Companion; + public fun (Lcom/android/tools/smali/dexlib2/iface/AnnotationElement;)V + public fun getName ()Ljava/lang/String; + public fun getValue ()Lcom/android/tools/smali/dexlib2/iface/value/EncodedValue; + public final fun setName (Ljava/lang/String;)V + public final fun setValue (Lapp/revanced/patcher/util/proxy/mutableTypes/encodedValue/MutableEncodedValue;)V +} + +public final class app/revanced/patcher/util/proxy/mutableTypes/MutableAnnotationElement$Companion { + public final fun toMutable (Lcom/android/tools/smali/dexlib2/iface/AnnotationElement;)Lapp/revanced/patcher/util/proxy/mutableTypes/MutableAnnotationElement; +} + +public final class app/revanced/patcher/util/proxy/mutableTypes/MutableClass : com/android/tools/smali/dexlib2/base/reference/BaseTypeReference, com/android/tools/smali/dexlib2/iface/ClassDef { + public static final field Companion Lapp/revanced/patcher/util/proxy/mutableTypes/MutableClass$Companion; + public fun (Lcom/android/tools/smali/dexlib2/iface/ClassDef;)V + public final fun charAt (I)C + public fun get (I)C + public fun getAccessFlags ()I + public fun getAnnotations ()Ljava/util/Set; + public synthetic fun getDirectMethods ()Ljava/lang/Iterable; + public fun getDirectMethods ()Ljava/util/Set; + public synthetic fun getFields ()Ljava/lang/Iterable; + public fun getFields ()Ljava/util/Set; + public synthetic fun getInstanceFields ()Ljava/lang/Iterable; + public fun getInstanceFields ()Ljava/util/Set; + public fun getInterfaces ()Ljava/util/List; + public fun getLength ()I + public synthetic fun getMethods ()Ljava/lang/Iterable; + public fun getMethods ()Ljava/util/Set; + public fun getSourceFile ()Ljava/lang/String; + public synthetic fun getStaticFields ()Ljava/lang/Iterable; + public fun getStaticFields ()Ljava/util/Set; + public fun getSuperclass ()Ljava/lang/String; + public fun getType ()Ljava/lang/String; + public synthetic fun getVirtualMethods ()Ljava/lang/Iterable; + public fun getVirtualMethods ()Ljava/util/Set; + public final fun length ()I + public final fun setAccessFlags (I)V + public final fun setSourceFile (Ljava/lang/String;)V + public final fun setSuperClass (Ljava/lang/String;)V + public final fun setType (Ljava/lang/String;)V +} + +public final class app/revanced/patcher/util/proxy/mutableTypes/MutableClass$Companion { + public final fun toMutable (Lcom/android/tools/smali/dexlib2/iface/ClassDef;)Lapp/revanced/patcher/util/proxy/mutableTypes/MutableClass; +} + +public final class app/revanced/patcher/util/proxy/mutableTypes/MutableField : com/android/tools/smali/dexlib2/base/reference/BaseFieldReference, com/android/tools/smali/dexlib2/iface/Field { + public static final field Companion Lapp/revanced/patcher/util/proxy/mutableTypes/MutableField$Companion; + public fun (Lcom/android/tools/smali/dexlib2/iface/Field;)V + public fun getAccessFlags ()I + public fun getAnnotations ()Ljava/util/Set; + public fun getDefiningClass ()Ljava/lang/String; + public fun getHiddenApiRestrictions ()Ljava/util/Set; + public fun getInitialValue ()Lapp/revanced/patcher/util/proxy/mutableTypes/encodedValue/MutableEncodedValue; + public synthetic fun getInitialValue ()Lcom/android/tools/smali/dexlib2/iface/value/EncodedValue; + public fun getName ()Ljava/lang/String; + public fun getType ()Ljava/lang/String; + public final fun setAccessFlags (I)V + public final fun setDefiningClass (Ljava/lang/String;)V + public final fun setInitialValue (Lapp/revanced/patcher/util/proxy/mutableTypes/encodedValue/MutableEncodedValue;)V + public final fun setName (Ljava/lang/String;)V + public final fun setType (Ljava/lang/String;)V +} + +public final class app/revanced/patcher/util/proxy/mutableTypes/MutableField$Companion { + public final fun toMutable (Lcom/android/tools/smali/dexlib2/iface/Field;)Lapp/revanced/patcher/util/proxy/mutableTypes/MutableField; +} + +public final class app/revanced/patcher/util/proxy/mutableTypes/MutableMethod : com/android/tools/smali/dexlib2/base/reference/BaseMethodReference, com/android/tools/smali/dexlib2/iface/Method { + public static final field Companion Lapp/revanced/patcher/util/proxy/mutableTypes/MutableMethod$Companion; + public fun (Lcom/android/tools/smali/dexlib2/iface/Method;)V + public fun getAccessFlags ()I + public fun getAnnotations ()Ljava/util/Set; + public fun getDefiningClass ()Ljava/lang/String; + public fun getHiddenApiRestrictions ()Ljava/util/Set; + public fun getImplementation ()Lcom/android/tools/smali/dexlib2/builder/MutableMethodImplementation; + public synthetic fun getImplementation ()Lcom/android/tools/smali/dexlib2/iface/MethodImplementation; + public fun getName ()Ljava/lang/String; + public fun getParameterTypes ()Ljava/util/List; + public fun getParameters ()Ljava/util/List; + public fun getReturnType ()Ljava/lang/String; + public final fun setAccessFlags (I)V + public final fun setDefiningClass (Ljava/lang/String;)V + public final fun setName (Ljava/lang/String;)V + public final fun setReturnType (Ljava/lang/String;)V +} + +public final class app/revanced/patcher/util/proxy/mutableTypes/MutableMethod$Companion { + public final fun toMutable (Lcom/android/tools/smali/dexlib2/iface/Method;)Lapp/revanced/patcher/util/proxy/mutableTypes/MutableMethod; +} + +public final class app/revanced/patcher/util/proxy/mutableTypes/MutableMethodParameter : com/android/tools/smali/dexlib2/base/BaseMethodParameter, com/android/tools/smali/dexlib2/iface/MethodParameter { + public static final field Companion Lapp/revanced/patcher/util/proxy/mutableTypes/MutableMethodParameter$Companion; + public fun (Lcom/android/tools/smali/dexlib2/iface/MethodParameter;)V + public final fun charAt (I)C + public fun get (I)C + public fun getAnnotations ()Ljava/util/Set; + public fun getLength ()I + public fun getName ()Ljava/lang/String; + public fun getSignature ()Ljava/lang/String; + public fun getType ()Ljava/lang/String; + public final fun length ()I +} + +public final class app/revanced/patcher/util/proxy/mutableTypes/MutableMethodParameter$Companion { + public final fun toMutable (Lcom/android/tools/smali/dexlib2/iface/MethodParameter;)Lapp/revanced/patcher/util/proxy/mutableTypes/MutableMethodParameter; +} + +public final class app/revanced/patcher/util/proxy/mutableTypes/encodedValue/MutableAnnotationEncodedValue : com/android/tools/smali/dexlib2/base/value/BaseAnnotationEncodedValue, app/revanced/patcher/util/proxy/mutableTypes/encodedValue/MutableEncodedValue { + public static final field Companion Lapp/revanced/patcher/util/proxy/mutableTypes/encodedValue/MutableAnnotationEncodedValue$Companion; + public fun (Lcom/android/tools/smali/dexlib2/iface/value/AnnotationEncodedValue;)V + public fun getElements ()Ljava/util/Set; + public fun getType ()Ljava/lang/String; + public final fun setType (Ljava/lang/String;)V +} + +public final class app/revanced/patcher/util/proxy/mutableTypes/encodedValue/MutableAnnotationEncodedValue$Companion { + public final fun toMutable (Lcom/android/tools/smali/dexlib2/iface/value/AnnotationEncodedValue;)Lapp/revanced/patcher/util/proxy/mutableTypes/encodedValue/MutableAnnotationEncodedValue; +} + +public final class app/revanced/patcher/util/proxy/mutableTypes/encodedValue/MutableArrayEncodedValue : com/android/tools/smali/dexlib2/base/value/BaseArrayEncodedValue, app/revanced/patcher/util/proxy/mutableTypes/encodedValue/MutableEncodedValue { + public static final field Companion Lapp/revanced/patcher/util/proxy/mutableTypes/encodedValue/MutableArrayEncodedValue$Companion; + public fun (Lcom/android/tools/smali/dexlib2/iface/value/ArrayEncodedValue;)V + public fun getValue ()Ljava/util/List; +} + +public final class app/revanced/patcher/util/proxy/mutableTypes/encodedValue/MutableArrayEncodedValue$Companion { + public final fun toMutable (Lcom/android/tools/smali/dexlib2/iface/value/ArrayEncodedValue;)Lapp/revanced/patcher/util/proxy/mutableTypes/encodedValue/MutableArrayEncodedValue; +} + +public final class app/revanced/patcher/util/proxy/mutableTypes/encodedValue/MutableBooleanEncodedValue : com/android/tools/smali/dexlib2/base/value/BaseBooleanEncodedValue, app/revanced/patcher/util/proxy/mutableTypes/encodedValue/MutableEncodedValue { + public static final field Companion Lapp/revanced/patcher/util/proxy/mutableTypes/encodedValue/MutableBooleanEncodedValue$Companion; + public fun (Lcom/android/tools/smali/dexlib2/iface/value/BooleanEncodedValue;)V + public fun getValue ()Z + public final fun setValue (Z)V +} + +public final class app/revanced/patcher/util/proxy/mutableTypes/encodedValue/MutableBooleanEncodedValue$Companion { + public final fun toMutable (Lcom/android/tools/smali/dexlib2/iface/value/BooleanEncodedValue;)Lapp/revanced/patcher/util/proxy/mutableTypes/encodedValue/MutableBooleanEncodedValue; +} + +public final class app/revanced/patcher/util/proxy/mutableTypes/encodedValue/MutableByteEncodedValue : com/android/tools/smali/dexlib2/base/value/BaseByteEncodedValue, app/revanced/patcher/util/proxy/mutableTypes/encodedValue/MutableEncodedValue { + public static final field Companion Lapp/revanced/patcher/util/proxy/mutableTypes/encodedValue/MutableByteEncodedValue$Companion; + public fun (Lcom/android/tools/smali/dexlib2/iface/value/ByteEncodedValue;)V + public fun getValue ()B + public final fun setValue (B)V +} + +public final class app/revanced/patcher/util/proxy/mutableTypes/encodedValue/MutableByteEncodedValue$Companion { + public final fun toMutable (Lcom/android/tools/smali/dexlib2/iface/value/ByteEncodedValue;)Lapp/revanced/patcher/util/proxy/mutableTypes/encodedValue/MutableByteEncodedValue; +} + +public final class app/revanced/patcher/util/proxy/mutableTypes/encodedValue/MutableCharEncodedValue : com/android/tools/smali/dexlib2/base/value/BaseCharEncodedValue, app/revanced/patcher/util/proxy/mutableTypes/encodedValue/MutableEncodedValue { + public static final field Companion Lapp/revanced/patcher/util/proxy/mutableTypes/encodedValue/MutableCharEncodedValue$Companion; + public fun (Lcom/android/tools/smali/dexlib2/iface/value/CharEncodedValue;)V + public fun getValue ()C + public final fun setValue (C)V +} + +public final class app/revanced/patcher/util/proxy/mutableTypes/encodedValue/MutableCharEncodedValue$Companion { + public final fun toMutable (Lcom/android/tools/smali/dexlib2/iface/value/CharEncodedValue;)Lapp/revanced/patcher/util/proxy/mutableTypes/encodedValue/MutableCharEncodedValue; +} + +public final class app/revanced/patcher/util/proxy/mutableTypes/encodedValue/MutableDoubleEncodedValue : com/android/tools/smali/dexlib2/base/value/BaseDoubleEncodedValue, app/revanced/patcher/util/proxy/mutableTypes/encodedValue/MutableEncodedValue { + public static final field Companion Lapp/revanced/patcher/util/proxy/mutableTypes/encodedValue/MutableDoubleEncodedValue$Companion; + public fun (Lcom/android/tools/smali/dexlib2/iface/value/DoubleEncodedValue;)V + public fun getValue ()D + public final fun setValue (D)V +} + +public final class app/revanced/patcher/util/proxy/mutableTypes/encodedValue/MutableDoubleEncodedValue$Companion { + public final fun toMutable (Lcom/android/tools/smali/dexlib2/iface/value/DoubleEncodedValue;)Lapp/revanced/patcher/util/proxy/mutableTypes/encodedValue/MutableDoubleEncodedValue; +} + +public abstract interface class app/revanced/patcher/util/proxy/mutableTypes/encodedValue/MutableEncodedValue : com/android/tools/smali/dexlib2/iface/value/EncodedValue { + public static final field Companion Lapp/revanced/patcher/util/proxy/mutableTypes/encodedValue/MutableEncodedValue$Companion; +} + +public final class app/revanced/patcher/util/proxy/mutableTypes/encodedValue/MutableEncodedValue$Companion { + public final fun toMutable (Lcom/android/tools/smali/dexlib2/iface/value/EncodedValue;)Lapp/revanced/patcher/util/proxy/mutableTypes/encodedValue/MutableEncodedValue; +} + +public final class app/revanced/patcher/util/proxy/mutableTypes/encodedValue/MutableEnumEncodedValue : com/android/tools/smali/dexlib2/base/value/BaseEnumEncodedValue, app/revanced/patcher/util/proxy/mutableTypes/encodedValue/MutableEncodedValue { + public static final field Companion Lapp/revanced/patcher/util/proxy/mutableTypes/encodedValue/MutableEnumEncodedValue$Companion; + public fun (Lcom/android/tools/smali/dexlib2/iface/value/EnumEncodedValue;)V + public fun getValue ()Lcom/android/tools/smali/dexlib2/iface/reference/FieldReference; + public final fun setValue (Lcom/android/tools/smali/dexlib2/iface/reference/FieldReference;)V +} + +public final class app/revanced/patcher/util/proxy/mutableTypes/encodedValue/MutableEnumEncodedValue$Companion { + public final fun toMutable (Lcom/android/tools/smali/dexlib2/iface/value/EnumEncodedValue;)Lapp/revanced/patcher/util/proxy/mutableTypes/encodedValue/MutableEnumEncodedValue; +} + +public final class app/revanced/patcher/util/proxy/mutableTypes/encodedValue/MutableFieldEncodedValue : com/android/tools/smali/dexlib2/base/value/BaseFieldEncodedValue, app/revanced/patcher/util/proxy/mutableTypes/encodedValue/MutableEncodedValue { + public static final field Companion Lapp/revanced/patcher/util/proxy/mutableTypes/encodedValue/MutableFieldEncodedValue$Companion; + public fun (Lcom/android/tools/smali/dexlib2/iface/value/FieldEncodedValue;)V + public fun getValue ()Lcom/android/tools/smali/dexlib2/iface/reference/FieldReference; + public fun getValueType ()I + public final fun setValue (Lcom/android/tools/smali/dexlib2/iface/reference/FieldReference;)V +} + +public final class app/revanced/patcher/util/proxy/mutableTypes/encodedValue/MutableFieldEncodedValue$Companion { + public final fun toMutable (Lcom/android/tools/smali/dexlib2/iface/value/FieldEncodedValue;)Lapp/revanced/patcher/util/proxy/mutableTypes/encodedValue/MutableFieldEncodedValue; +} + +public final class app/revanced/patcher/util/proxy/mutableTypes/encodedValue/MutableFloatEncodedValue : com/android/tools/smali/dexlib2/base/value/BaseFloatEncodedValue, app/revanced/patcher/util/proxy/mutableTypes/encodedValue/MutableEncodedValue { + public static final field Companion Lapp/revanced/patcher/util/proxy/mutableTypes/encodedValue/MutableFloatEncodedValue$Companion; + public fun (Lcom/android/tools/smali/dexlib2/iface/value/FloatEncodedValue;)V + public fun getValue ()F + public final fun setValue (F)V +} + +public final class app/revanced/patcher/util/proxy/mutableTypes/encodedValue/MutableFloatEncodedValue$Companion { + public final fun toMutable (Lcom/android/tools/smali/dexlib2/iface/value/FloatEncodedValue;)Lapp/revanced/patcher/util/proxy/mutableTypes/encodedValue/MutableFloatEncodedValue; +} + +public final class app/revanced/patcher/util/proxy/mutableTypes/encodedValue/MutableIntEncodedValue : com/android/tools/smali/dexlib2/base/value/BaseIntEncodedValue, app/revanced/patcher/util/proxy/mutableTypes/encodedValue/MutableEncodedValue { + public static final field Companion Lapp/revanced/patcher/util/proxy/mutableTypes/encodedValue/MutableIntEncodedValue$Companion; + public fun (Lcom/android/tools/smali/dexlib2/iface/value/IntEncodedValue;)V + public fun getValue ()I + public final fun setValue (I)V +} + +public final class app/revanced/patcher/util/proxy/mutableTypes/encodedValue/MutableIntEncodedValue$Companion { + public final fun toMutable (Lcom/android/tools/smali/dexlib2/iface/value/IntEncodedValue;)Lapp/revanced/patcher/util/proxy/mutableTypes/encodedValue/MutableIntEncodedValue; +} + +public final class app/revanced/patcher/util/proxy/mutableTypes/encodedValue/MutableLongEncodedValue : com/android/tools/smali/dexlib2/base/value/BaseLongEncodedValue, app/revanced/patcher/util/proxy/mutableTypes/encodedValue/MutableEncodedValue { + public static final field Companion Lapp/revanced/patcher/util/proxy/mutableTypes/encodedValue/MutableLongEncodedValue$Companion; + public fun (Lcom/android/tools/smali/dexlib2/iface/value/LongEncodedValue;)V + public fun getValue ()J + public final fun setValue (J)V +} + +public final class app/revanced/patcher/util/proxy/mutableTypes/encodedValue/MutableLongEncodedValue$Companion { + public final fun toMutable (Lcom/android/tools/smali/dexlib2/iface/value/LongEncodedValue;)Lapp/revanced/patcher/util/proxy/mutableTypes/encodedValue/MutableLongEncodedValue; +} + +public final class app/revanced/patcher/util/proxy/mutableTypes/encodedValue/MutableMethodEncodedValue : com/android/tools/smali/dexlib2/base/value/BaseMethodEncodedValue, app/revanced/patcher/util/proxy/mutableTypes/encodedValue/MutableEncodedValue { + public static final field Companion Lapp/revanced/patcher/util/proxy/mutableTypes/encodedValue/MutableMethodEncodedValue$Companion; + public fun (Lcom/android/tools/smali/dexlib2/iface/value/MethodEncodedValue;)V + public fun getValue ()Lcom/android/tools/smali/dexlib2/iface/reference/MethodReference; + public final fun setValue (Lcom/android/tools/smali/dexlib2/iface/reference/MethodReference;)V +} + +public final class app/revanced/patcher/util/proxy/mutableTypes/encodedValue/MutableMethodEncodedValue$Companion { + public final fun toMutable (Lcom/android/tools/smali/dexlib2/iface/value/MethodEncodedValue;)Lapp/revanced/patcher/util/proxy/mutableTypes/encodedValue/MutableMethodEncodedValue; +} + +public final class app/revanced/patcher/util/proxy/mutableTypes/encodedValue/MutableMethodHandleEncodedValue : com/android/tools/smali/dexlib2/base/value/BaseMethodHandleEncodedValue, app/revanced/patcher/util/proxy/mutableTypes/encodedValue/MutableEncodedValue { + public static final field Companion Lapp/revanced/patcher/util/proxy/mutableTypes/encodedValue/MutableMethodHandleEncodedValue$Companion; + public fun (Lcom/android/tools/smali/dexlib2/iface/value/MethodHandleEncodedValue;)V + public fun getValue ()Lcom/android/tools/smali/dexlib2/iface/reference/MethodHandleReference; + public final fun setValue (Lcom/android/tools/smali/dexlib2/iface/reference/MethodHandleReference;)V +} + +public final class app/revanced/patcher/util/proxy/mutableTypes/encodedValue/MutableMethodHandleEncodedValue$Companion { + public final fun toMutable (Lcom/android/tools/smali/dexlib2/iface/value/MethodHandleEncodedValue;)Lapp/revanced/patcher/util/proxy/mutableTypes/encodedValue/MutableMethodHandleEncodedValue; +} + +public final class app/revanced/patcher/util/proxy/mutableTypes/encodedValue/MutableMethodTypeEncodedValue : com/android/tools/smali/dexlib2/base/value/BaseMethodTypeEncodedValue, app/revanced/patcher/util/proxy/mutableTypes/encodedValue/MutableEncodedValue { + public static final field Companion Lapp/revanced/patcher/util/proxy/mutableTypes/encodedValue/MutableMethodTypeEncodedValue$Companion; + public fun (Lcom/android/tools/smali/dexlib2/iface/value/MethodTypeEncodedValue;)V + public fun getValue ()Lcom/android/tools/smali/dexlib2/iface/reference/MethodProtoReference; + public final fun setValue (Lcom/android/tools/smali/dexlib2/iface/reference/MethodProtoReference;)V +} + +public final class app/revanced/patcher/util/proxy/mutableTypes/encodedValue/MutableMethodTypeEncodedValue$Companion { + public final fun toMutable (Lcom/android/tools/smali/dexlib2/iface/value/MethodTypeEncodedValue;)Lapp/revanced/patcher/util/proxy/mutableTypes/encodedValue/MutableMethodTypeEncodedValue; +} + +public final class app/revanced/patcher/util/proxy/mutableTypes/encodedValue/MutableNullEncodedValue : com/android/tools/smali/dexlib2/base/value/BaseNullEncodedValue, app/revanced/patcher/util/proxy/mutableTypes/encodedValue/MutableEncodedValue { + public static final field Companion Lapp/revanced/patcher/util/proxy/mutableTypes/encodedValue/MutableNullEncodedValue$Companion; + public fun ()V +} + +public final class app/revanced/patcher/util/proxy/mutableTypes/encodedValue/MutableNullEncodedValue$Companion { + public final fun toMutable (Lcom/android/tools/smali/dexlib2/iface/value/ByteEncodedValue;)Lapp/revanced/patcher/util/proxy/mutableTypes/encodedValue/MutableByteEncodedValue; +} + +public final class app/revanced/patcher/util/proxy/mutableTypes/encodedValue/MutableShortEncodedValue : com/android/tools/smali/dexlib2/base/value/BaseShortEncodedValue, app/revanced/patcher/util/proxy/mutableTypes/encodedValue/MutableEncodedValue { + public static final field Companion Lapp/revanced/patcher/util/proxy/mutableTypes/encodedValue/MutableShortEncodedValue$Companion; + public fun (Lcom/android/tools/smali/dexlib2/iface/value/ShortEncodedValue;)V + public fun getValue ()S + public final fun setValue (S)V +} + +public final class app/revanced/patcher/util/proxy/mutableTypes/encodedValue/MutableShortEncodedValue$Companion { + public final fun toMutable (Lcom/android/tools/smali/dexlib2/iface/value/ShortEncodedValue;)Lapp/revanced/patcher/util/proxy/mutableTypes/encodedValue/MutableShortEncodedValue; +} + +public final class app/revanced/patcher/util/proxy/mutableTypes/encodedValue/MutableStringEncodedValue : com/android/tools/smali/dexlib2/base/value/BaseStringEncodedValue, app/revanced/patcher/util/proxy/mutableTypes/encodedValue/MutableEncodedValue { + public static final field Companion Lapp/revanced/patcher/util/proxy/mutableTypes/encodedValue/MutableStringEncodedValue$Companion; + public fun (Lcom/android/tools/smali/dexlib2/iface/value/StringEncodedValue;)V + public fun getValue ()Ljava/lang/String; + public final fun setValue (Ljava/lang/String;)V +} + +public final class app/revanced/patcher/util/proxy/mutableTypes/encodedValue/MutableStringEncodedValue$Companion { + public final fun toMutable (Lcom/android/tools/smali/dexlib2/iface/value/ByteEncodedValue;)Lapp/revanced/patcher/util/proxy/mutableTypes/encodedValue/MutableByteEncodedValue; +} + +public final class app/revanced/patcher/util/proxy/mutableTypes/encodedValue/MutableTypeEncodedValue : com/android/tools/smali/dexlib2/base/value/BaseTypeEncodedValue, app/revanced/patcher/util/proxy/mutableTypes/encodedValue/MutableEncodedValue { + public static final field Companion Lapp/revanced/patcher/util/proxy/mutableTypes/encodedValue/MutableTypeEncodedValue$Companion; + public fun (Lcom/android/tools/smali/dexlib2/iface/value/TypeEncodedValue;)V + public fun getValue ()Ljava/lang/String; + public final fun setValue (Ljava/lang/String;)V +} + +public final class app/revanced/patcher/util/proxy/mutableTypes/encodedValue/MutableTypeEncodedValue$Companion { + public final fun toMutable (Lcom/android/tools/smali/dexlib2/iface/value/TypeEncodedValue;)Lapp/revanced/patcher/util/proxy/mutableTypes/encodedValue/MutableTypeEncodedValue; +} + +public final class app/revanced/patcher/util/smali/ExternalLabel { + public fun (Ljava/lang/String;Lcom/android/tools/smali/dexlib2/iface/instruction/Instruction;)V + public final fun copy (Ljava/lang/String;Lcom/android/tools/smali/dexlib2/iface/instruction/Instruction;)Lapp/revanced/patcher/util/smali/ExternalLabel; + public static synthetic fun copy$default (Lapp/revanced/patcher/util/smali/ExternalLabel;Ljava/lang/String;Lcom/android/tools/smali/dexlib2/iface/instruction/Instruction;ILjava/lang/Object;)Lapp/revanced/patcher/util/smali/ExternalLabel; + public fun equals (Ljava/lang/Object;)Z + public fun hashCode ()I + public fun toString ()Ljava/lang/String; +} + +public final class app/revanced/patcher/util/smali/InlineSmaliCompiler { + public static final field Companion Lapp/revanced/patcher/util/smali/InlineSmaliCompiler$Companion; + public fun ()V +} + +public final class app/revanced/patcher/util/smali/InlineSmaliCompiler$Companion { + public final fun compile (Ljava/lang/String;Ljava/lang/String;IZ)Ljava/util/List; +} + +public final class app/revanced/patcher/util/smali/InlineSmaliCompilerKt { + public static final fun toInstruction (Ljava/lang/String;Lapp/revanced/patcher/util/proxy/mutableTypes/MutableMethod;)Lcom/android/tools/smali/dexlib2/builder/BuilderInstruction; + public static synthetic fun toInstruction$default (Ljava/lang/String;Lapp/revanced/patcher/util/proxy/mutableTypes/MutableMethod;ILjava/lang/Object;)Lcom/android/tools/smali/dexlib2/builder/BuilderInstruction; + public static final fun toInstructions (Ljava/lang/String;Lapp/revanced/patcher/util/proxy/mutableTypes/MutableMethod;)Ljava/util/List; + public static synthetic fun toInstructions$default (Ljava/lang/String;Lapp/revanced/patcher/util/proxy/mutableTypes/MutableMethod;ILjava/lang/Object;)Ljava/util/List; +} + diff --git a/build.gradle.kts b/build.gradle.kts index 49603fd..5160dc5 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -16,8 +16,7 @@ subprojects { apply(plugin = "java") apply(plugin ="kotlin") - group = "app.revanced" - version = publicationVersion + version = pulicationVersion repositories { mavenCentral() diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index f10c02f..bec7eff 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -6,12 +6,8 @@ kotlin-test = "1.8.20-RC" kotlinx-coroutines-core = "1.7.3" multidexlib2 = "3.0.3.r3" smali = "3.0.3" -symbol-processing-api = "1.9.10-1.0.13" xpp3 = "1.1.4c" binary-compatibility-validator = "0.13.2" -kotlin-compile-testing-ksp = "1.5.0" -kotlinpoet-ksp = "1.14.2" -ksp = "1.9.0-1.0.11" [libraries] android = { module = "com.google.android:android", version.ref = "android" } @@ -21,11 +17,7 @@ kotlin-test = { module = "org.jetbrains.kotlin:kotlin-test", version.ref = "kotl kotlinx-coroutines-core = { module = "org.jetbrains.kotlinx:kotlinx-coroutines-core", version.ref = "kotlinx-coroutines-core" } multidexlib2 = { module = "app.revanced:multidexlib2", version.ref = "multidexlib2" } smali = { module = "com.android.tools.smali:smali", version.ref = "smali" } -symbol-processing-api = { module = "com.google.devtools.ksp:symbol-processing-api", version.ref = "symbol-processing-api" } xpp3 = { module = "xpp3:xpp3", version.ref = "xpp3" } -kotlin-compile-testing = { module = "com.github.tschuchortdev:kotlin-compile-testing-ksp", version.ref = "kotlin-compile-testing-ksp" } -kotlinpoet-ksp = { module = "com.squareup:kotlinpoet-ksp", version.ref = "kotlinpoet-ksp" } [plugins] binary-compatibility-validator = { id = "org.jetbrains.kotlinx.binary-compatibility-validator", version.ref = "binary-compatibility-validator" } -ksp = { id = "com.google.devtools.ksp", version.ref = "ksp" } \ No newline at end of file diff --git a/revanced-patch-annotation-processor/api/revanced-patch-annotation-processor.api b/revanced-patch-annotation-processor/api/revanced-patch-annotation-processor.api deleted file mode 100644 index c1536a9..0000000 --- a/revanced-patch-annotation-processor/api/revanced-patch-annotation-processor.api +++ /dev/null @@ -1,24 +0,0 @@ -public abstract interface annotation class app/revanced/patcher/patch/annotation/CompatiblePackage : java/lang/annotation/Annotation { - public abstract fun name ()Ljava/lang/String; - public abstract fun versions ()[Ljava/lang/String; -} - -public abstract interface annotation class app/revanced/patcher/patch/annotation/Patch : java/lang/annotation/Annotation { - public abstract fun compatiblePackages ()[Lapp/revanced/patcher/patch/annotation/CompatiblePackage; - public abstract fun dependencies ()[Ljava/lang/Class; - public abstract fun description ()Ljava/lang/String; - public abstract fun name ()Ljava/lang/String; - public abstract fun requiresIntegrations ()Z - public abstract fun use ()Z -} - -public final class app/revanced/patcher/patch/annotation/processor/PatchProcessor : com/google/devtools/ksp/processing/SymbolProcessor { - public fun process (Lcom/google/devtools/ksp/processing/Resolver;)Ljava/util/List; -} - -public final class app/revanced/patcher/patch/annotation/processor/PatchProcessorProvider : com/google/devtools/ksp/processing/SymbolProcessorProvider { - public fun ()V - public fun create (Lcom/google/devtools/ksp/processing/SymbolProcessorEnvironment;)Lapp/revanced/patcher/patch/annotation/processor/PatchProcessor; - public synthetic fun create (Lcom/google/devtools/ksp/processing/SymbolProcessorEnvironment;)Lcom/google/devtools/ksp/processing/SymbolProcessor; -} - diff --git a/revanced-patch-annotation-processor/build.gradle.kts b/revanced-patch-annotation-processor/build.gradle.kts deleted file mode 100644 index 5dafe1d..0000000 --- a/revanced-patch-annotation-processor/build.gradle.kts +++ /dev/null @@ -1,45 +0,0 @@ -plugins { - alias(libs.plugins.ksp) -} - -dependencies { - implementation(libs.symbol.processing.api) - implementation(libs.kotlinpoet.ksp) - implementation(project(":revanced-patcher")) - - testImplementation(libs.kotlin.test) - testImplementation(libs.kotlin.compile.testing) -} - -publishing { - publications { - create("revanced-patch-annotation-processor-publication") { - from(components["java"]) - - pom { - name = "ReVanced patch annotation processor" - description = "Annotation processor for patches." - url = "https://revanced.app" - - licenses { - license { - name = "GNU General Public License v3.0" - url = "https://www.gnu.org/licenses/gpl-3.0.en.html" - } - } - developers { - developer { - id = "ReVanced" - name = "ReVanced" - email = "contact@revanced.app" - } - } - scm { - connection = "scm:git:git://github.com/revanced/revanced-patcher.git" - developerConnection = "scm:git:git@github.com:revanced/revanced-patcher.git" - url = "https://github.com/revanced/revanced-patcher" - } - } - } - } -} \ No newline at end of file diff --git a/revanced-patch-annotation-processor/settings.gradle.kts b/revanced-patch-annotation-processor/settings.gradle.kts deleted file mode 100644 index f1d8160..0000000 --- a/revanced-patch-annotation-processor/settings.gradle.kts +++ /dev/null @@ -1,2 +0,0 @@ -rootProject.name = "revanced-patch-annotation-processor" - diff --git a/revanced-patch-annotation-processor/src/main/kotlin/app/revanced/patcher/patch/annotation/processor/PatchProcessor.kt b/revanced-patch-annotation-processor/src/main/kotlin/app/revanced/patcher/patch/annotation/processor/PatchProcessor.kt deleted file mode 100644 index 325d005..0000000 --- a/revanced-patch-annotation-processor/src/main/kotlin/app/revanced/patcher/patch/annotation/processor/PatchProcessor.kt +++ /dev/null @@ -1,207 +0,0 @@ -package app.revanced.patcher.patch.annotation.processor - -import app.revanced.patcher.data.BytecodeContext -import app.revanced.patcher.data.ResourceContext -import app.revanced.patcher.patch.BytecodePatch -import app.revanced.patcher.patch.ResourcePatch -import app.revanced.patcher.patch.annotation.Patch -import com.google.devtools.ksp.processing.CodeGenerator -import com.google.devtools.ksp.processing.Dependencies -import com.google.devtools.ksp.processing.Resolver -import com.google.devtools.ksp.processing.SymbolProcessor -import com.google.devtools.ksp.symbol.KSAnnotated -import com.google.devtools.ksp.symbol.KSAnnotation -import com.google.devtools.ksp.symbol.KSClassDeclaration -import com.google.devtools.ksp.symbol.KSType -import com.google.devtools.ksp.validate -import com.squareup.kotlinpoet.* -import com.squareup.kotlinpoet.ksp.toClassName -import com.squareup.kotlinpoet.ksp.writeTo -import kotlin.reflect.KClass - -class PatchProcessor internal constructor( - private val codeGenerator: CodeGenerator, -) : SymbolProcessor { - - private fun KSAnnotated.isSubclassOf(cls: KClass<*>): Boolean { - if (this !is KSClassDeclaration) return false - - if (qualifiedName?.asString() == cls.qualifiedName) return true - - return superTypes.any { it.resolve().declaration.isSubclassOf(cls) } - } - - @Suppress("UNCHECKED_CAST") - override fun process(resolver: Resolver): List { - val patches = buildMap { - resolver.getSymbolsWithAnnotation(Patch::class.qualifiedName!!).filter { - // Do not check here if Patch is super of the class, because it is expensive. - // Check it later when processing. - it.validate() && it.isSubclassOf(app.revanced.patcher.patch.Patch::class) - }.map { - it as KSClassDeclaration - }.forEach { patchDeclaration -> - patchDeclaration.annotations.find { - it.annotationType.resolve().declaration.qualifiedName!!.asString() == Patch::class.qualifiedName!! - }?.let { annotation -> - fun KSAnnotation.property(name: String) = - arguments.find { it.name!!.asString() == name }?.value!! - - val name = - annotation.property("name").toString().ifEmpty { null } - - val description = - annotation.property("description").toString().ifEmpty { null } - - val dependencies = - (annotation.property("dependencies") as List).ifEmpty { null } - - val compatiblePackages = - (annotation.property("compatiblePackages") as List).ifEmpty { null } - - val use = - annotation.property("use") as Boolean - - val requiresIntegrations = - annotation.property("requiresIntegrations") as Boolean - - // Data class for KotlinPoet - data class PatchData( - val name: String?, - val description: String?, - val dependencies: List?, - val compatiblePackages: List?, - val use: Boolean, - val requiresIntegrations: Boolean - ) - - this[patchDeclaration] = PatchData( - name, - description, - dependencies?.map { dependency -> dependency.toClassName() }, - compatiblePackages?.map { - val packageName = it.property("name") - val packageVersions = (it.property("versions") as List).ifEmpty { null } - ?.joinToString(", ") { version -> "\"$version\"" } - - CodeBlock.of( - "%T(%S, %L)", - app.revanced.patcher.patch.Patch.CompatiblePackage::class, - packageName, - packageVersions?.let { "setOf($packageVersions)" }, - ) - }, - use, - requiresIntegrations - ) - } - } - } - - // If a patch depends on another, that is annotated, the dependency should be replaced with the generated patch, - // because the generated patch has all the necessary properties to invoke the super constructor with, - // unlike the annotated patch. - val dependencyResolutionMap = buildMap { - patches.values.filter { it.dependencies != null }.flatMap { - it.dependencies!! - }.distinct().forEach { dependency -> - patches.keys.find { it.qualifiedName?.asString() == dependency.toString() } - ?.let { patch -> - this[dependency] = ClassName( - patch.packageName.asString(), - patch.simpleName.asString() + "Generated" - ) - } - } - } - - patches.forEach { (patchDeclaration, patchAnnotation) -> - val isBytecodePatch = patchDeclaration.isSubclassOf(BytecodePatch::class) - - val superClass = if (isBytecodePatch) { - BytecodePatch::class - } else { - ResourcePatch::class - } - - val contextClass = if (isBytecodePatch) { - BytecodeContext::class - } else { - ResourceContext::class - } - - val generatedPatchClassName = ClassName( - patchDeclaration.packageName.asString(), - patchDeclaration.simpleName.asString() + "Generated" - ) - - FileSpec.builder(generatedPatchClassName) - .addType( - TypeSpec.objectBuilder(generatedPatchClassName) - .superclass(superClass).apply { - patchAnnotation.name?.let { name -> - addSuperclassConstructorParameter("name = %S", name) - } - - patchAnnotation.description?.let { description -> - addSuperclassConstructorParameter("description = %S", description) - } - - patchAnnotation.compatiblePackages?.let { compatiblePackages -> - addSuperclassConstructorParameter( - "compatiblePackages = setOf(%L)", - compatiblePackages.joinToString(", ") - ) - } - - // The generated patch always depends on the source patch. - addSuperclassConstructorParameter( - "dependencies = setOf(%L)", - buildList { - patchAnnotation.dependencies?.forEach { dependency -> - add("${(dependencyResolutionMap[dependency] ?: dependency)}::class") - } - - add("${patchDeclaration.toClassName()}::class") - }.joinToString(", "), - ) - - addSuperclassConstructorParameter( - "use = %L", patchAnnotation.use - ) - - addSuperclassConstructorParameter( - "requiresIntegrations = %L", - patchAnnotation.requiresIntegrations - ) - } - .addFunction( - FunSpec.builder("execute") - .addModifiers(KModifier.OVERRIDE) - .addParameter("context", contextClass) - .build() - ) - .addInitializerBlock( - CodeBlock.builder() - .add( - "%T.options.forEach { (_, option) ->", - patchDeclaration.toClassName() - ) - .addStatement( - "options.register(option)" - ) - .add( - "}" - ) - .build() - ) - .build() - ).build().writeTo( - codeGenerator, - Dependencies(false, patchDeclaration.containingFile!!) - ) - } - - return emptyList() - } -} \ No newline at end of file diff --git a/revanced-patch-annotation-processor/src/main/kotlin/app/revanced/patcher/patch/annotation/processor/PatchProcessorProvider.kt b/revanced-patch-annotation-processor/src/main/kotlin/app/revanced/patcher/patch/annotation/processor/PatchProcessorProvider.kt deleted file mode 100644 index 9e3cc63..0000000 --- a/revanced-patch-annotation-processor/src/main/kotlin/app/revanced/patcher/patch/annotation/processor/PatchProcessorProvider.kt +++ /dev/null @@ -1,9 +0,0 @@ -package app.revanced.patcher.patch.annotation.processor - -import com.google.devtools.ksp.processing.SymbolProcessorEnvironment -import com.google.devtools.ksp.processing.SymbolProcessorProvider - -class PatchProcessorProvider : SymbolProcessorProvider { - override fun create(environment: SymbolProcessorEnvironment) = - PatchProcessor(environment.codeGenerator) -} \ No newline at end of file diff --git a/revanced-patch-annotation-processor/src/main/resources/META-INF/services/com.google.devtools.ksp.processing.SymbolProcessorProvider b/revanced-patch-annotation-processor/src/main/resources/META-INF/services/com.google.devtools.ksp.processing.SymbolProcessorProvider deleted file mode 100644 index 52884f4..0000000 --- a/revanced-patch-annotation-processor/src/main/resources/META-INF/services/com.google.devtools.ksp.processing.SymbolProcessorProvider +++ /dev/null @@ -1 +0,0 @@ -app.revanced.patcher.patch.annotation.processor.PatchProcessorProvider \ No newline at end of file diff --git a/revanced-patch-annotation-processor/src/test/kotlin/app/revanced/patcher/patch/annotation/processor/TestPatchAnnotationProcessor.kt b/revanced-patch-annotation-processor/src/test/kotlin/app/revanced/patcher/patch/annotation/processor/TestPatchAnnotationProcessor.kt deleted file mode 100644 index f3e2e43..0000000 --- a/revanced-patch-annotation-processor/src/test/kotlin/app/revanced/patcher/patch/annotation/processor/TestPatchAnnotationProcessor.kt +++ /dev/null @@ -1,147 +0,0 @@ -package app.revanced.patcher.patch.annotation.processor - -import app.revanced.patcher.patch.Patch -import com.tschuchort.compiletesting.KotlinCompilation -import com.tschuchort.compiletesting.SourceFile -import com.tschuchort.compiletesting.kspWithCompilation -import com.tschuchort.compiletesting.symbolProcessorProviders -import kotlin.test.Test -import kotlin.test.assertEquals -import kotlin.test.assertNull - -class TestPatchAnnotationProcessor { - // region Processing - - @Test - fun testProcessing() = assertEquals( - "Processable patch", compile( - getSourceFile( - "processing", "ProcessablePatch" - ) - ).loadPatch("$SAMPLE_PACKAGE.processing.ProcessablePatchGenerated").name - ) - - @Test - fun generateNullProperties() = compile( - getSourceFile( - "null", "NullPropertiesPatch" - ) - ).loadPatch("$SAMPLE_PACKAGE.null.NullPropertiesPatchGenerated").let { - assertNull(it.description) // Because no description was provided. - assertNull(it.compatiblePackages!!.first().versions) // Because no versions were provided. - } - - // endregion - - // region Dependencies - - @Test - fun testDependencies() { - compile( - getSourceFile( - "dependencies", "DependentPatch" - ), getSourceFile( - "dependencies", "DependencyPatch" - ) - ).let { result -> - result.loadPatch("$SAMPLE_PACKAGE.dependencies.DependentPatchGenerated").let { - // Dependency as well as the source class of the generated class. - assertEquals( - 2, - it.dependencies!!.size - ) - - // The last dependency is always the source class of the generated class to respect - // order of dependencies. - assertEquals( - result.loadPatch("$SAMPLE_PACKAGE.dependencies.DependentPatch")::class, - it.dependencies!!.last() - ) - } - } - } - - // endregion - - // region Options - - @Test - fun testOptions() { - val patch = compile( - getSourceFile( - "options", "OptionsPatch" - ) - ).loadPatch("$SAMPLE_PACKAGE.options.OptionsPatchGenerated") - - assert(patch.options.isNotEmpty()) - assertEquals(patch.options["print"].title, "Print message") - } - - // endregion - - // region Limitations - - @Test - fun failingManualDependency() = assertEquals( - 1, // Generated patch is always dependent on source class. - compile( - getSourceFile( - "limitations/manualdependency", "DependentPatch" - ), getSourceFile( - "limitations/manualdependency", "DependencyPatch" - ) - ).loadPatch("$SAMPLE_PACKAGE.limitations.manualdependency.DependentPatchGenerated").dependencies!!.size - ) - - // endregion - - private companion object Utils { - const val SAMPLE_PACKAGE = "app.revanced.patcher.patch.annotation.processor.samples" - - /** - * Get a source file from the given sample and class name. - * - * @param sample The sample to get the source file from. - * @param className The name of the class to get the source file from. - * @return The source file. - */ - fun getSourceFile(sample: String, className: String): SourceFile { - val resourceName = "app/revanced/patcher/patch/annotation/processor/samples/$sample/$className.kt" - return SourceFile.kotlin( - "$className.kt", - TestPatchAnnotationProcessor::class.java.classLoader.getResourceAsStream(resourceName) - ?.readAllBytes() - ?.toString(Charsets.UTF_8) - ?: error("Could not find resource $resourceName") - ) - } - - /** - * Compile the given source files and return the result. - * - * @param sourceFiles The source files to compile. - * @return The result of the compilation. - */ - fun compile(vararg sourceFiles: SourceFile) = KotlinCompilation().apply { - sources = sourceFiles.asList() - - symbolProcessorProviders = listOf(PatchProcessorProvider()) - - // Required until https://github.com/tschuchortdev/kotlin-compile-testing/issues/312 closed. - kspWithCompilation = true - - inheritClassPath = true - messageOutputStream = System.out - }.compile().also { result -> - assertEquals(KotlinCompilation.ExitCode.OK, result.exitCode) - } - - // region Class loading - - fun KotlinCompilation.Result.loadPatch(name: String) = classLoader.loadClass(name).loadPatch() - - fun Class<*>.loadPatch() = this.getField("INSTANCE").get(null) as Patch<*> - - // endregion - } -} \ No newline at end of file diff --git a/revanced-patch-annotation-processor/src/test/resources/app/revanced/patcher/patch/annotation/processor/samples/dependencies/DependencyPatch.kt b/revanced-patch-annotation-processor/src/test/resources/app/revanced/patcher/patch/annotation/processor/samples/dependencies/DependencyPatch.kt deleted file mode 100644 index 2230274..0000000 --- a/revanced-patch-annotation-processor/src/test/resources/app/revanced/patcher/patch/annotation/processor/samples/dependencies/DependencyPatch.kt +++ /dev/null @@ -1,10 +0,0 @@ -package app.revanced.patcher.patch.annotation.processor.samples.dependencies - -import app.revanced.patcher.data.ResourceContext -import app.revanced.patcher.patch.ResourcePatch -import app.revanced.patcher.patch.annotation.Patch - -@Patch(name = "Dependency patch") -object DependencyPatch : ResourcePatch() { - override fun execute(context: ResourceContext) {} -} \ No newline at end of file diff --git a/revanced-patch-annotation-processor/src/test/resources/app/revanced/patcher/patch/annotation/processor/samples/dependencies/DependentPatch.kt b/revanced-patch-annotation-processor/src/test/resources/app/revanced/patcher/patch/annotation/processor/samples/dependencies/DependentPatch.kt deleted file mode 100644 index d20dc51..0000000 --- a/revanced-patch-annotation-processor/src/test/resources/app/revanced/patcher/patch/annotation/processor/samples/dependencies/DependentPatch.kt +++ /dev/null @@ -1,12 +0,0 @@ -package app.revanced.patcher.patch.annotation.processor.samples.dependencies -import app.revanced.patcher.data.BytecodeContext -import app.revanced.patcher.patch.BytecodePatch -import app.revanced.patcher.patch.annotation.Patch - -@Patch( - name = "Dependent patch", - dependencies = [DependencyPatch::class], -) -object DependentPatch : BytecodePatch() { - override fun execute(context: BytecodeContext) {} -} \ No newline at end of file diff --git a/revanced-patch-annotation-processor/src/test/resources/app/revanced/patcher/patch/annotation/processor/samples/limitations/manualdependency/DependencyPatch.kt b/revanced-patch-annotation-processor/src/test/resources/app/revanced/patcher/patch/annotation/processor/samples/limitations/manualdependency/DependencyPatch.kt deleted file mode 100644 index c373c34..0000000 --- a/revanced-patch-annotation-processor/src/test/resources/app/revanced/patcher/patch/annotation/processor/samples/limitations/manualdependency/DependencyPatch.kt +++ /dev/null @@ -1,10 +0,0 @@ -package app.revanced.patcher.patch.annotation.processor.samples.limitations.manualdependency - -import app.revanced.patcher.data.ResourceContext -import app.revanced.patcher.patch.ResourcePatch -import app.revanced.patcher.patch.annotation.Patch - -@Patch(name = "Dependency patch") -object DependencyPatch : ResourcePatch() { - override fun execute(context: ResourceContext) { } -} \ No newline at end of file diff --git a/revanced-patch-annotation-processor/src/test/resources/app/revanced/patcher/patch/annotation/processor/samples/limitations/manualdependency/DependentPatch.kt b/revanced-patch-annotation-processor/src/test/resources/app/revanced/patcher/patch/annotation/processor/samples/limitations/manualdependency/DependentPatch.kt deleted file mode 100644 index 5bc396c..0000000 --- a/revanced-patch-annotation-processor/src/test/resources/app/revanced/patcher/patch/annotation/processor/samples/limitations/manualdependency/DependentPatch.kt +++ /dev/null @@ -1,17 +0,0 @@ -package app.revanced.patcher.patch.annotation.processor.samples.limitations.manualdependency -import app.revanced.patcher.data.BytecodeContext -import app.revanced.patcher.patch.BytecodePatch -import app.revanced.patcher.patch.annotation.Patch - -@Patch(name = "Dependent patch") -object DependentPatch : BytecodePatch( - // Dependency will not be executed correctly if it is manually specified. - // The reason for this is that the dependency patch is annotated too, - // so the processor will generate a new patch class for it embedding the annotated information. - // Because the dependency is manually specified, - // the processor will not be able to change this dependency to the generated class, - // which means that the dependency will lose the annotated information. - dependencies = setOf(DependencyPatch::class) -) { - override fun execute(context: BytecodeContext) {} -} \ No newline at end of file diff --git a/revanced-patch-annotation-processor/src/test/resources/app/revanced/patcher/patch/annotation/processor/samples/null/NullPropertiesPatch.kt b/revanced-patch-annotation-processor/src/test/resources/app/revanced/patcher/patch/annotation/processor/samples/null/NullPropertiesPatch.kt deleted file mode 100644 index a013dba..0000000 --- a/revanced-patch-annotation-processor/src/test/resources/app/revanced/patcher/patch/annotation/processor/samples/null/NullPropertiesPatch.kt +++ /dev/null @@ -1,14 +0,0 @@ -package app.revanced.patcher.patch.annotation.processor.samples.`null` - -import app.revanced.patcher.data.BytecodeContext -import app.revanced.patcher.patch.BytecodePatch -import app.revanced.patcher.patch.annotation.CompatiblePackage -import app.revanced.patcher.patch.annotation.Patch - -@Patch( - "Patch with null properties", - compatiblePackages = [CompatiblePackage("com.google.android.youtube")], -) -object NullPropertiesPatch : BytecodePatch() { - override fun execute(context: BytecodeContext) {} -} \ No newline at end of file diff --git a/revanced-patch-annotation-processor/src/test/resources/app/revanced/patcher/patch/annotation/processor/samples/options/OptionsPatch.kt b/revanced-patch-annotation-processor/src/test/resources/app/revanced/patcher/patch/annotation/processor/samples/options/OptionsPatch.kt deleted file mode 100644 index 6bc1027..0000000 --- a/revanced-patch-annotation-processor/src/test/resources/app/revanced/patcher/patch/annotation/processor/samples/options/OptionsPatch.kt +++ /dev/null @@ -1,19 +0,0 @@ -package app.revanced.patcher.patch.annotation.processor.samples.options - -import app.revanced.patcher.data.ResourceContext -import app.revanced.patcher.patch.ResourcePatch -import app.revanced.patcher.patch.annotation.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 stringPatchOption( - "print", - null, - "Print message", - "The message to print." - ) -} \ No newline at end of file diff --git a/revanced-patch-annotation-processor/src/test/resources/app/revanced/patcher/patch/annotation/processor/samples/processing/ProcessablePatch.kt b/revanced-patch-annotation-processor/src/test/resources/app/revanced/patcher/patch/annotation/processor/samples/processing/ProcessablePatch.kt deleted file mode 100644 index 86767db..0000000 --- a/revanced-patch-annotation-processor/src/test/resources/app/revanced/patcher/patch/annotation/processor/samples/processing/ProcessablePatch.kt +++ /dev/null @@ -1,10 +0,0 @@ -package app.revanced.patcher.patch.annotation.processor.samples.processing - -import app.revanced.patcher.data.BytecodeContext -import app.revanced.patcher.patch.BytecodePatch -import app.revanced.patcher.patch.annotation.Patch - -@Patch("Processable patch") -object ProcessablePatch : BytecodePatch() { - override fun execute(context: BytecodeContext) {} -} \ No newline at end of file diff --git a/revanced-patcher/build.gradle.kts b/revanced-patcher/build.gradle.kts index ff913b9..832f981 100644 --- a/revanced-patcher/build.gradle.kts +++ b/revanced-patcher/build.gradle.kts @@ -8,7 +8,6 @@ dependencies { compileOnly(libs.android) - testImplementation(project(":revanced-patch-annotation-processor")) testImplementation(libs.kotlin.test) } diff --git a/revanced-patcher/src/main/kotlin/app/revanced/patcher/patch/BytecodePatch.kt b/revanced-patcher/src/main/kotlin/app/revanced/patcher/patch/BytecodePatch.kt index 7c15481..fe918e6 100644 --- a/revanced-patcher/src/main/kotlin/app/revanced/patcher/patch/BytecodePatch.kt +++ b/revanced-patcher/src/main/kotlin/app/revanced/patcher/patch/BytecodePatch.kt @@ -1,6 +1,5 @@ package app.revanced.patcher.patch -import app.revanced.patcher.PatchClass import app.revanced.patcher.data.BytecodeContext import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint @@ -8,20 +7,7 @@ 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 = emptySet(), - name: String? = null, - description: String? = null, - compatiblePackages: Set? = null, - dependencies: Set? = null, - use: Boolean = true, - // TODO: Remove this property, once integrations are coupled with patches. - requiresIntegrations: Boolean = false, -) : Patch(name, description, compatiblePackages, dependencies, use, requiresIntegrations) \ No newline at end of file + internal val fingerprints : Set = emptySet(), +) : Patch() \ No newline at end of file diff --git a/revanced-patcher/src/main/kotlin/app/revanced/patcher/patch/Patch.kt b/revanced-patcher/src/main/kotlin/app/revanced/patcher/patch/Patch.kt index 2f56807..c48939c 100644 --- a/revanced-patcher/src/main/kotlin/app/revanced/patcher/patch/Patch.kt +++ b/revanced-patcher/src/main/kotlin/app/revanced/patcher/patch/Patch.kt @@ -7,35 +7,71 @@ import app.revanced.patcher.Patcher import app.revanced.patcher.data.Context import app.revanced.patcher.patch.options.PatchOptions import java.io.Closeable +import kotlin.reflect.full.findAnnotation /** * A ReVanced patch. - * * If an implementation of [Patch] also implements [Closeable] * it will be closed in reverse execution order of patches executed by ReVanced [Patcher]. * - * @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. * @param T The [Context] type this patch will work on. */ -sealed class Patch>( - val name: String? = null, - val description: String? = null, - val compatiblePackages: Set? = null, - val dependencies: Set? = null, - val use: Boolean = true, +sealed class Patch> { + /** + * The name of the patch. + */ + var name: String? = null + private set + + /** + * The description of the patch. + */ + var description: String? = null + private set + + /** + * The packages the patch is compatible with. + */ + var compatiblePackages: Set? = null + private set + + /** + * Other patches this patch depends on. + */ + var dependencies: Set? = null + private set + + /** + * Weather or not the patch should be used. + */ + var use = true + private set + + // TODO: Remove this property, once integrations are coupled with patches. - val requiresIntegrations: Boolean = false, -) { + /** + * Weather or not the patch requires integrations. + */ + var requiresIntegrations = false + private set + /** * The options of the patch associated by the options key. */ val options = PatchOptions() + init { + this::class.findAnnotation()?.let { annotation -> + name = annotation.name.ifEmpty { null } + description = annotation.description.ifEmpty { null } + compatiblePackages = annotation.compatiblePackages + .map { CompatiblePackage(it.name, it.versions.toSet()) }.toSet() + dependencies = annotation.dependencies.toSet().ifEmpty { null } + use = annotation.use + requiresIntegrations = annotation.requiresIntegrations + } + } + /** * The execution function of the patch. * @@ -67,5 +103,4 @@ sealed class Patch>( val name: String, val versions: Set? = null, ) -} - +} \ No newline at end of file diff --git a/revanced-patcher/src/main/kotlin/app/revanced/patcher/patch/ResourcePatch.kt b/revanced-patcher/src/main/kotlin/app/revanced/patcher/patch/ResourcePatch.kt index b5d4229..368bbb8 100644 --- a/revanced-patcher/src/main/kotlin/app/revanced/patcher/patch/ResourcePatch.kt +++ b/revanced-patcher/src/main/kotlin/app/revanced/patcher/patch/ResourcePatch.kt @@ -1,24 +1,8 @@ package app.revanced.patcher.patch -import app.revanced.patcher.PatchClass import app.revanced.patcher.data.ResourceContext /** * A ReVanced [Patch] that works on [ResourceContext]. - * - * @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 ResourcePatch( - name: String? = null, - description: String? = null, - compatiblePackages: Set? = null, - dependencies: Set? = null, - use: Boolean = true, - // TODO: Remove this property, once integrations are coupled with patches. - requiresIntegrations: Boolean = false, -) : Patch(name, description, compatiblePackages, dependencies, use, requiresIntegrations) \ No newline at end of file +abstract class ResourcePatch : Patch() \ No newline at end of file diff --git a/revanced-patch-annotation-processor/src/main/kotlin/app/revanced/patcher/patch/annotation/PatchAnnotations.kt b/revanced-patcher/src/main/kotlin/app/revanced/patcher/patch/annotation/PatchAnnotations.kt similarity index 97% rename from revanced-patch-annotation-processor/src/main/kotlin/app/revanced/patcher/patch/annotation/PatchAnnotations.kt rename to revanced-patcher/src/main/kotlin/app/revanced/patcher/patch/annotation/PatchAnnotations.kt index c6919bc..f003e45 100644 --- a/revanced-patch-annotation-processor/src/main/kotlin/app/revanced/patcher/patch/annotation/PatchAnnotations.kt +++ b/revanced-patcher/src/main/kotlin/app/revanced/patcher/patch/annotation/PatchAnnotations.kt @@ -13,7 +13,6 @@ import kotlin.reflect.KClass * @param use Whether this patch should be used. * @param requiresIntegrations Whether this patch requires integrations. */ -@Retention(AnnotationRetention.SOURCE) @Target(AnnotationTarget.CLASS) @Inherited annotation class Patch( diff --git a/settings.gradle.kts b/settings.gradle.kts index 23a5a77..5c99423 100644 --- a/settings.gradle.kts +++ b/settings.gradle.kts @@ -1 +1 @@ -include("revanced-patch-annotation-processor", "revanced-patcher") \ No newline at end of file +include("revanced-patcher") From c38f0ef42a37c70f274ad04aea6190ca1c0aecc7 Mon Sep 17 00:00:00 2001 From: oSumAtrIX Date: Sat, 14 Oct 2023 19:18:57 +0200 Subject: [PATCH 05/36] build: Move subproject to root project --- build.gradle.kts | 103 +- revanced-patcher/api/revanced-patcher.api | 904 ------------------ revanced-patcher/build.gradle.kts | 51 - revanced-patcher/settings.gradle.kts | 1 - settings.gradle.kts | 2 +- .../revanced/patcher/IntegrationsConsumer.kt | 0 .../app/revanced/patcher/PackageMetadata.kt | 0 .../app/revanced/patcher/PatchBundleLoader.kt | 0 .../revanced/patcher/PatchExecutorFunction.kt | 0 .../kotlin/app/revanced/patcher/Patcher.kt | 0 .../app/revanced/patcher/PatcherContext.kt | 0 .../app/revanced/patcher/PatcherException.kt | 0 .../app/revanced/patcher/PatcherOptions.kt | 0 .../app/revanced/patcher/PatcherResult.kt | 0 .../app/revanced/patcher/PatchesConsumer.kt | 0 .../revanced/patcher/data/BytecodeContext.kt | 0 .../app/revanced/patcher/data/Context.kt | 0 .../revanced/patcher/data/ResourceContext.kt | 0 .../extensions/AnnotationExtensions.kt | 0 .../revanced/patcher/extensions/Extensions.kt | 0 .../extensions/InstructionExtensions.kt | 0 .../extensions/MethodFingerprintExtensions.kt | 0 .../patcher/fingerprint/Fingerprint.kt | 0 .../annotation/MethodFingerprintMetadata.kt | 0 .../method/impl/MethodFingerprint.kt | 0 .../app/revanced/patcher/logging/Logger.kt | 0 .../patcher/logging/impl/NopLogger.kt | 0 .../revanced/patcher/patch/BytecodePatch.kt | 0 .../app/revanced/patcher/patch/Patch.kt | 0 .../revanced/patcher/patch/PatchException.kt | 0 .../app/revanced/patcher/patch/PatchResult.kt | 0 .../revanced/patcher/patch/ResourcePatch.kt | 0 .../patch/annotation/PatchAnnotations.kt | 0 .../patcher/patch/options/PatchOption.kt | 0 .../patch/options/PatchOptionException.kt | 0 .../patcher/patch/options/PatchOptions.kt | 0 .../patch/options/types/BooleanPatchOption.kt | 0 .../patch/options/types/FloatPatchOption.kt | 0 .../patch/options/types/IntPatchOption.kt | 0 .../patch/options/types/LongPatchOption.kt | 0 .../patch/options/types/StringPatchOption.kt | 0 .../types/array/BooleanArrayPatchOption.kt | 0 .../types/array/FloatArrayPatchOption.kt | 0 .../types/array/IntArrayPatchOption.kt | 0 .../types/array/LongArrayPatchOption.kt | 0 .../types/array/StringArrayPatchOption.kt | 0 .../app/revanced/patcher/util/ClassMerger.kt | 0 .../revanced/patcher/util/DomFileEditor.kt | 0 .../revanced/patcher/util/ProxyClassList.kt | 0 .../patcher/util/method/MethodWalker.kt | 0 .../revanced/patcher/util/proxy/ClassProxy.kt | 0 .../proxy/mutableTypes/MutableAnnotation.kt | 0 .../mutableTypes/MutableAnnotationElement.kt | 0 .../util/proxy/mutableTypes/MutableClass.kt | 0 .../util/proxy/mutableTypes/MutableField.kt | 0 .../util/proxy/mutableTypes/MutableMethod.kt | 0 .../mutableTypes/MutableMethodParameter.kt | 0 .../MutableAnnotationEncodedValue.kt | 0 .../encodedValue/MutableArrayEncodedValue.kt | 0 .../MutableBooleanEncodedValue.kt | 0 .../encodedValue/MutableByteEncodedValue.kt | 0 .../encodedValue/MutableCharEncodedValue.kt | 0 .../encodedValue/MutableDoubleEncodedValue.kt | 0 .../encodedValue/MutableEncodedValue.kt | 0 .../encodedValue/MutableEnumEncodedValue.kt | 0 .../encodedValue/MutableFieldEncodedValue.kt | 0 .../encodedValue/MutableFloatEncodedValue.kt | 0 .../encodedValue/MutableIntEncodedValue.kt | 0 .../encodedValue/MutableLongEncodedValue.kt | 0 .../encodedValue/MutableMethodEncodedValue.kt | 0 .../MutableMethodHandleEncodedValue.kt | 0 .../MutableMethodTypeEncodedValue.kt | 0 .../encodedValue/MutableNullEncodedValue.kt | 0 .../encodedValue/MutableShortEncodedValue.kt | 0 .../encodedValue/MutableStringEncodedValue.kt | 0 .../encodedValue/MutableTypeEncodedValue.kt | 0 .../patcher/util/smali/ExternalLabel.kt | 0 .../patcher/util/smali/InlineSmaliCompiler.kt | 0 .../app/revanced/patcher/version.properties | 0 .../extensions/InstructionExtensionsTest.kt | 0 .../patcher/patch/options/PatchOptionsTest.kt | 0 .../patch/usage/ExampleBytecodePatch.kt | 0 .../patcher/patch/usage/ExampleFingerprint.kt | 0 .../patch/usage/ExampleResourcePatch.kt | 0 .../util/smali/InlineSmaliCompilerTest.kt | 0 85 files changed, 73 insertions(+), 988 deletions(-) delete mode 100644 revanced-patcher/api/revanced-patcher.api delete mode 100644 revanced-patcher/build.gradle.kts delete mode 100644 revanced-patcher/settings.gradle.kts rename {revanced-patcher/src => src}/main/kotlin/app/revanced/patcher/IntegrationsConsumer.kt (100%) rename {revanced-patcher/src => src}/main/kotlin/app/revanced/patcher/PackageMetadata.kt (100%) rename {revanced-patcher/src => src}/main/kotlin/app/revanced/patcher/PatchBundleLoader.kt (100%) rename {revanced-patcher/src => src}/main/kotlin/app/revanced/patcher/PatchExecutorFunction.kt (100%) rename {revanced-patcher/src => src}/main/kotlin/app/revanced/patcher/Patcher.kt (100%) rename {revanced-patcher/src => src}/main/kotlin/app/revanced/patcher/PatcherContext.kt (100%) rename {revanced-patcher/src => src}/main/kotlin/app/revanced/patcher/PatcherException.kt (100%) rename {revanced-patcher/src => src}/main/kotlin/app/revanced/patcher/PatcherOptions.kt (100%) rename {revanced-patcher/src => src}/main/kotlin/app/revanced/patcher/PatcherResult.kt (100%) rename {revanced-patcher/src => src}/main/kotlin/app/revanced/patcher/PatchesConsumer.kt (100%) rename {revanced-patcher/src => src}/main/kotlin/app/revanced/patcher/data/BytecodeContext.kt (100%) rename {revanced-patcher/src => src}/main/kotlin/app/revanced/patcher/data/Context.kt (100%) rename {revanced-patcher/src => src}/main/kotlin/app/revanced/patcher/data/ResourceContext.kt (100%) rename {revanced-patcher/src => src}/main/kotlin/app/revanced/patcher/extensions/AnnotationExtensions.kt (100%) rename {revanced-patcher/src => src}/main/kotlin/app/revanced/patcher/extensions/Extensions.kt (100%) rename {revanced-patcher/src => src}/main/kotlin/app/revanced/patcher/extensions/InstructionExtensions.kt (100%) rename {revanced-patcher/src => src}/main/kotlin/app/revanced/patcher/extensions/MethodFingerprintExtensions.kt (100%) rename {revanced-patcher/src => src}/main/kotlin/app/revanced/patcher/fingerprint/Fingerprint.kt (100%) rename {revanced-patcher/src => src}/main/kotlin/app/revanced/patcher/fingerprint/method/annotation/MethodFingerprintMetadata.kt (100%) rename {revanced-patcher/src => src}/main/kotlin/app/revanced/patcher/fingerprint/method/impl/MethodFingerprint.kt (100%) rename {revanced-patcher/src => src}/main/kotlin/app/revanced/patcher/logging/Logger.kt (100%) rename {revanced-patcher/src => src}/main/kotlin/app/revanced/patcher/logging/impl/NopLogger.kt (100%) rename {revanced-patcher/src => src}/main/kotlin/app/revanced/patcher/patch/BytecodePatch.kt (100%) rename {revanced-patcher/src => src}/main/kotlin/app/revanced/patcher/patch/Patch.kt (100%) rename {revanced-patcher/src => src}/main/kotlin/app/revanced/patcher/patch/PatchException.kt (100%) rename {revanced-patcher/src => src}/main/kotlin/app/revanced/patcher/patch/PatchResult.kt (100%) rename {revanced-patcher/src => src}/main/kotlin/app/revanced/patcher/patch/ResourcePatch.kt (100%) rename {revanced-patcher/src => src}/main/kotlin/app/revanced/patcher/patch/annotation/PatchAnnotations.kt (100%) rename {revanced-patcher/src => src}/main/kotlin/app/revanced/patcher/patch/options/PatchOption.kt (100%) rename {revanced-patcher/src => src}/main/kotlin/app/revanced/patcher/patch/options/PatchOptionException.kt (100%) rename {revanced-patcher/src => src}/main/kotlin/app/revanced/patcher/patch/options/PatchOptions.kt (100%) rename {revanced-patcher/src => src}/main/kotlin/app/revanced/patcher/patch/options/types/BooleanPatchOption.kt (100%) rename {revanced-patcher/src => src}/main/kotlin/app/revanced/patcher/patch/options/types/FloatPatchOption.kt (100%) rename {revanced-patcher/src => src}/main/kotlin/app/revanced/patcher/patch/options/types/IntPatchOption.kt (100%) rename {revanced-patcher/src => src}/main/kotlin/app/revanced/patcher/patch/options/types/LongPatchOption.kt (100%) rename {revanced-patcher/src => src}/main/kotlin/app/revanced/patcher/patch/options/types/StringPatchOption.kt (100%) rename {revanced-patcher/src => src}/main/kotlin/app/revanced/patcher/patch/options/types/array/BooleanArrayPatchOption.kt (100%) rename {revanced-patcher/src => src}/main/kotlin/app/revanced/patcher/patch/options/types/array/FloatArrayPatchOption.kt (100%) rename {revanced-patcher/src => src}/main/kotlin/app/revanced/patcher/patch/options/types/array/IntArrayPatchOption.kt (100%) rename {revanced-patcher/src => src}/main/kotlin/app/revanced/patcher/patch/options/types/array/LongArrayPatchOption.kt (100%) rename {revanced-patcher/src => src}/main/kotlin/app/revanced/patcher/patch/options/types/array/StringArrayPatchOption.kt (100%) rename {revanced-patcher/src => src}/main/kotlin/app/revanced/patcher/util/ClassMerger.kt (100%) rename {revanced-patcher/src => src}/main/kotlin/app/revanced/patcher/util/DomFileEditor.kt (100%) rename {revanced-patcher/src => src}/main/kotlin/app/revanced/patcher/util/ProxyClassList.kt (100%) rename {revanced-patcher/src => src}/main/kotlin/app/revanced/patcher/util/method/MethodWalker.kt (100%) rename {revanced-patcher/src => src}/main/kotlin/app/revanced/patcher/util/proxy/ClassProxy.kt (100%) rename {revanced-patcher/src => src}/main/kotlin/app/revanced/patcher/util/proxy/mutableTypes/MutableAnnotation.kt (100%) rename {revanced-patcher/src => src}/main/kotlin/app/revanced/patcher/util/proxy/mutableTypes/MutableAnnotationElement.kt (100%) rename {revanced-patcher/src => src}/main/kotlin/app/revanced/patcher/util/proxy/mutableTypes/MutableClass.kt (100%) rename {revanced-patcher/src => src}/main/kotlin/app/revanced/patcher/util/proxy/mutableTypes/MutableField.kt (100%) rename {revanced-patcher/src => src}/main/kotlin/app/revanced/patcher/util/proxy/mutableTypes/MutableMethod.kt (100%) rename {revanced-patcher/src => src}/main/kotlin/app/revanced/patcher/util/proxy/mutableTypes/MutableMethodParameter.kt (100%) rename {revanced-patcher/src => src}/main/kotlin/app/revanced/patcher/util/proxy/mutableTypes/encodedValue/MutableAnnotationEncodedValue.kt (100%) rename {revanced-patcher/src => src}/main/kotlin/app/revanced/patcher/util/proxy/mutableTypes/encodedValue/MutableArrayEncodedValue.kt (100%) rename {revanced-patcher/src => src}/main/kotlin/app/revanced/patcher/util/proxy/mutableTypes/encodedValue/MutableBooleanEncodedValue.kt (100%) rename {revanced-patcher/src => src}/main/kotlin/app/revanced/patcher/util/proxy/mutableTypes/encodedValue/MutableByteEncodedValue.kt (100%) rename {revanced-patcher/src => src}/main/kotlin/app/revanced/patcher/util/proxy/mutableTypes/encodedValue/MutableCharEncodedValue.kt (100%) rename {revanced-patcher/src => src}/main/kotlin/app/revanced/patcher/util/proxy/mutableTypes/encodedValue/MutableDoubleEncodedValue.kt (100%) rename {revanced-patcher/src => src}/main/kotlin/app/revanced/patcher/util/proxy/mutableTypes/encodedValue/MutableEncodedValue.kt (100%) rename {revanced-patcher/src => src}/main/kotlin/app/revanced/patcher/util/proxy/mutableTypes/encodedValue/MutableEnumEncodedValue.kt (100%) rename {revanced-patcher/src => src}/main/kotlin/app/revanced/patcher/util/proxy/mutableTypes/encodedValue/MutableFieldEncodedValue.kt (100%) rename {revanced-patcher/src => src}/main/kotlin/app/revanced/patcher/util/proxy/mutableTypes/encodedValue/MutableFloatEncodedValue.kt (100%) rename {revanced-patcher/src => src}/main/kotlin/app/revanced/patcher/util/proxy/mutableTypes/encodedValue/MutableIntEncodedValue.kt (100%) rename {revanced-patcher/src => src}/main/kotlin/app/revanced/patcher/util/proxy/mutableTypes/encodedValue/MutableLongEncodedValue.kt (100%) rename {revanced-patcher/src => src}/main/kotlin/app/revanced/patcher/util/proxy/mutableTypes/encodedValue/MutableMethodEncodedValue.kt (100%) rename {revanced-patcher/src => src}/main/kotlin/app/revanced/patcher/util/proxy/mutableTypes/encodedValue/MutableMethodHandleEncodedValue.kt (100%) rename {revanced-patcher/src => src}/main/kotlin/app/revanced/patcher/util/proxy/mutableTypes/encodedValue/MutableMethodTypeEncodedValue.kt (100%) rename {revanced-patcher/src => src}/main/kotlin/app/revanced/patcher/util/proxy/mutableTypes/encodedValue/MutableNullEncodedValue.kt (100%) rename {revanced-patcher/src => src}/main/kotlin/app/revanced/patcher/util/proxy/mutableTypes/encodedValue/MutableShortEncodedValue.kt (100%) rename {revanced-patcher/src => src}/main/kotlin/app/revanced/patcher/util/proxy/mutableTypes/encodedValue/MutableStringEncodedValue.kt (100%) rename {revanced-patcher/src => src}/main/kotlin/app/revanced/patcher/util/proxy/mutableTypes/encodedValue/MutableTypeEncodedValue.kt (100%) rename {revanced-patcher/src => src}/main/kotlin/app/revanced/patcher/util/smali/ExternalLabel.kt (100%) rename {revanced-patcher/src => src}/main/kotlin/app/revanced/patcher/util/smali/InlineSmaliCompiler.kt (100%) rename {revanced-patcher/src => src}/main/resources/app/revanced/patcher/version.properties (100%) rename {revanced-patcher/src => src}/test/kotlin/app/revanced/patcher/extensions/InstructionExtensionsTest.kt (100%) rename {revanced-patcher/src => src}/test/kotlin/app/revanced/patcher/patch/options/PatchOptionsTest.kt (100%) rename {revanced-patcher/src => src}/test/kotlin/app/revanced/patcher/patch/usage/ExampleBytecodePatch.kt (100%) rename {revanced-patcher/src => src}/test/kotlin/app/revanced/patcher/patch/usage/ExampleFingerprint.kt (100%) rename {revanced-patcher/src => src}/test/kotlin/app/revanced/patcher/patch/usage/ExampleResourcePatch.kt (100%) rename {revanced-patcher/src => src}/test/kotlin/app/revanced/patcher/util/smali/InlineSmaliCompilerTest.kt (100%) diff --git a/build.gradle.kts b/build.gradle.kts index 5160dc5..8068c81 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -1,5 +1,3 @@ -import org.jetbrains.kotlin.gradle.dsl.KotlinJvmProjectExtension - plugins { kotlin("jvm") version "1.9.0" alias(libs.plugins.binary.compatibility.validator) @@ -8,38 +6,81 @@ plugins { java } -val publicationVersion = project.version.toString() +group = "app.revanced" -subprojects { - apply(plugin = "maven-publish") - apply(plugin = "signing") - apply(plugin = "java") - apply(plugin ="kotlin") - - version = pulicationVersion - - repositories { - mavenCentral() - mavenLocal() - maven { url = uri("https://jitpack.io") } - google() +tasks { + processResources { + expand("projectVersion" to project.version) } - java { - withJavadocJar() - withSourcesJar() - } - - configure { - kotlin { jvmToolchain(11) } - } - - tasks { - test { - useJUnitPlatform() - testLogging { - events("PASSED", "SKIPPED", "FAILED") - } + test { + useJUnitPlatform() + testLogging { + events("PASSED", "SKIPPED", "FAILED") } } } + +repositories { + mavenCentral() + mavenLocal() + maven { url = uri("https://jitpack.io") } + google() +} + +dependencies { + implementation(libs.kotlinx.coroutines.core) + implementation(libs.xpp3) + implementation(libs.smali) + implementation(libs.multidexlib2) + implementation(libs.apktool.lib) + implementation(libs.kotlin.reflect) + + compileOnly(libs.android) + + testImplementation(libs.kotlin.test) +} + +java { + withJavadocJar() + withSourcesJar() +} + +kotlin { + jvmToolchain(11) +} + +publishing { + publications { + create("revanced-patcher-publication") { + from(components["java"]) + + version = project.version.toString() + + pom { + name = "ReVanced Patcher" + description = "Patcher used by ReVanced." + url = "https://revanced.app" + + licenses { + license { + name = "GNU General Public License v3.0" + url = "https://www.gnu.org/licenses/gpl-3.0.en.html" + } + } + developers { + developer { + id = "ReVanced" + name = "ReVanced" + email = "contact@revanced.app" + } + } + scm { + connection = "scm:git:git://github.com/revanced/revanced-patcher.git" + developerConnection = "scm:git:git@github.com:revanced/revanced-patcher.git" + url = "https://github.com/revanced/revanced-patcher" + } + } + } + } +} \ No newline at end of file diff --git a/revanced-patcher/api/revanced-patcher.api b/revanced-patcher/api/revanced-patcher.api deleted file mode 100644 index 8c46723..0000000 --- a/revanced-patcher/api/revanced-patcher.api +++ /dev/null @@ -1,904 +0,0 @@ -public abstract interface class app/revanced/patcher/IntegrationsConsumer { - public abstract fun acceptIntegrations (Ljava/util/List;)V -} - -public final class app/revanced/patcher/PackageMetadata { - public final fun getPackageName ()Ljava/lang/String; - public final fun getPackageVersion ()Ljava/lang/String; -} - -public abstract class app/revanced/patcher/PatchBundleLoader : java/util/Set, kotlin/jvm/internal/markers/KMappedMarker { - public synthetic fun (Ljava/lang/ClassLoader;[Ljava/io/File;Lkotlin/jvm/functions/Function1;Ljava/util/Set;Lkotlin/jvm/internal/DefaultConstructorMarker;)V - public fun add (Lapp/revanced/patcher/patch/Patch;)Z - public synthetic fun add (Ljava/lang/Object;)Z - public fun addAll (Ljava/util/Collection;)Z - public fun clear ()V - public fun contains (Lapp/revanced/patcher/patch/Patch;)Z - public final fun contains (Ljava/lang/Object;)Z - public fun containsAll (Ljava/util/Collection;)Z - public fun getSize ()I - public fun isEmpty ()Z - public fun iterator ()Ljava/util/Iterator; - public fun remove (Ljava/lang/Object;)Z - public fun removeAll (Ljava/util/Collection;)Z - public fun retainAll (Ljava/util/Collection;)Z - public final fun size ()I - public fun toArray ()[Ljava/lang/Object; - public fun toArray ([Ljava/lang/Object;)[Ljava/lang/Object; -} - -public final class app/revanced/patcher/PatchBundleLoader$Dex : app/revanced/patcher/PatchBundleLoader { - public fun ([Ljava/io/File;)V - public fun ([Ljava/io/File;Ljava/io/File;)V - public synthetic fun ([Ljava/io/File;Ljava/io/File;ILkotlin/jvm/internal/DefaultConstructorMarker;)V -} - -public final class app/revanced/patcher/PatchBundleLoader$Jar : app/revanced/patcher/PatchBundleLoader { - public fun ([Ljava/io/File;)V -} - -public abstract interface class app/revanced/patcher/PatchExecutorFunction : java/util/function/Function { -} - -public final class app/revanced/patcher/Patcher : app/revanced/patcher/IntegrationsConsumer, app/revanced/patcher/PatchExecutorFunction, app/revanced/patcher/PatchesConsumer, java/io/Closeable, java/util/function/Supplier { - public fun (Lapp/revanced/patcher/PatcherOptions;)V - public fun acceptIntegrations (Ljava/util/List;)V - public fun acceptPatches (Ljava/util/List;)V - public synthetic fun apply (Ljava/lang/Object;)Ljava/lang/Object; - public fun apply (Z)Lkotlinx/coroutines/flow/Flow; - public fun close ()V - public fun get ()Lapp/revanced/patcher/PatcherResult; - public synthetic fun get ()Ljava/lang/Object; - public final fun getContext ()Lapp/revanced/patcher/PatcherContext; -} - -public final class app/revanced/patcher/PatcherContext { - public final fun getPackageMetadata ()Lapp/revanced/patcher/PackageMetadata; -} - -public abstract class app/revanced/patcher/PatcherException : java/lang/Exception { - public synthetic fun (Ljava/lang/String;Ljava/lang/Throwable;Lkotlin/jvm/internal/DefaultConstructorMarker;)V - public synthetic fun (Ljava/lang/String;Lkotlin/jvm/internal/DefaultConstructorMarker;)V -} - -public final class app/revanced/patcher/PatcherException$CircularDependencyException : app/revanced/patcher/PatcherException { -} - -public final class app/revanced/patcher/PatcherOptions { - public fun (Ljava/io/File;Ljava/io/File;Ljava/lang/String;Ljava/lang/String;)V - public synthetic fun (Ljava/io/File;Ljava/io/File;Ljava/lang/String;Ljava/lang/String;ILkotlin/jvm/internal/DefaultConstructorMarker;)V - public fun (Ljava/io/File;Ljava/io/File;Ljava/lang/String;Ljava/lang/String;Z)V - public synthetic fun (Ljava/io/File;Ljava/io/File;Ljava/lang/String;Ljava/lang/String;ZILkotlin/jvm/internal/DefaultConstructorMarker;)V - public final fun copy (Ljava/io/File;Ljava/io/File;Ljava/lang/String;Ljava/lang/String;Z)Lapp/revanced/patcher/PatcherOptions; - public static synthetic fun copy$default (Lapp/revanced/patcher/PatcherOptions;Ljava/io/File;Ljava/io/File;Ljava/lang/String;Ljava/lang/String;ZILjava/lang/Object;)Lapp/revanced/patcher/PatcherOptions; - public fun equals (Ljava/lang/Object;)Z - public fun hashCode ()I - public final fun recreateResourceCacheDirectory ()Ljava/io/File; - public fun toString ()Ljava/lang/String; -} - -public final class app/revanced/patcher/PatcherResult { - public fun (Ljava/util/List;Ljava/io/File;Ljava/util/List;)V - public synthetic fun (Ljava/util/List;Ljava/io/File;Ljava/util/List;ILkotlin/jvm/internal/DefaultConstructorMarker;)V - public final fun component1 ()Ljava/util/List; - public final fun component2 ()Ljava/io/File; - public final fun component3 ()Ljava/util/List; - public final fun copy (Ljava/util/List;Ljava/io/File;Ljava/util/List;)Lapp/revanced/patcher/PatcherResult; - public static synthetic fun copy$default (Lapp/revanced/patcher/PatcherResult;Ljava/util/List;Ljava/io/File;Ljava/util/List;ILjava/lang/Object;)Lapp/revanced/patcher/PatcherResult; - public fun equals (Ljava/lang/Object;)Z - public final fun getDexFiles ()Ljava/util/List; - public final fun getDoNotCompress ()Ljava/util/List; - public final fun getResourceFile ()Ljava/io/File; - public fun hashCode ()I - public fun toString ()Ljava/lang/String; -} - -public final class app/revanced/patcher/PatcherResult$PatchedDexFile { - public fun (Ljava/lang/String;Ljava/io/InputStream;)V - public final fun getName ()Ljava/lang/String; - public final fun getStream ()Ljava/io/InputStream; -} - -public abstract interface class app/revanced/patcher/PatchesConsumer { - public abstract fun acceptPatches (Ljava/util/List;)V -} - -public final class app/revanced/patcher/data/BytecodeContext : app/revanced/patcher/data/Context { - public final fun findClass (Ljava/lang/String;)Lapp/revanced/patcher/util/proxy/ClassProxy; - public final fun findClass (Lkotlin/jvm/functions/Function1;)Lapp/revanced/patcher/util/proxy/ClassProxy; - public synthetic fun get ()Ljava/lang/Object; - public fun get ()Ljava/util/List; - public final fun getClasses ()Lapp/revanced/patcher/util/ProxyClassList; - public final fun proxy (Lcom/android/tools/smali/dexlib2/iface/ClassDef;)Lapp/revanced/patcher/util/proxy/ClassProxy; - public final fun toMethodWalker (Lcom/android/tools/smali/dexlib2/iface/Method;)Lapp/revanced/patcher/util/method/MethodWalker; -} - -public abstract interface class app/revanced/patcher/data/Context : java/util/function/Supplier { -} - -public final class app/revanced/patcher/data/ResourceContext : app/revanced/patcher/data/Context, java/lang/Iterable, kotlin/jvm/internal/markers/KMappedMarker { - public fun get ()Ljava/io/File; - public synthetic fun get ()Ljava/lang/Object; - public final fun get (Ljava/lang/String;)Ljava/io/File; - public final fun getXmlEditor ()Lapp/revanced/patcher/data/ResourceContext$XmlFileHolder; - public fun iterator ()Ljava/util/Iterator; -} - -public final class app/revanced/patcher/data/ResourceContext$XmlFileHolder { - public fun (Lapp/revanced/patcher/data/ResourceContext;)V - public final fun get (Ljava/io/InputStream;)Lapp/revanced/patcher/util/DomFileEditor; - public final fun get (Ljava/lang/String;)Lapp/revanced/patcher/util/DomFileEditor; -} - -public final class app/revanced/patcher/extensions/ExtensionsKt { - public static final fun newLabel (Lapp/revanced/patcher/util/proxy/mutableTypes/MutableMethod;I)Lcom/android/tools/smali/dexlib2/builder/Label; - public static final fun or (ILcom/android/tools/smali/dexlib2/AccessFlags;)I - public static final fun or (Lcom/android/tools/smali/dexlib2/AccessFlags;I)I - public static final fun or (Lcom/android/tools/smali/dexlib2/AccessFlags;Lcom/android/tools/smali/dexlib2/AccessFlags;)I -} - -public final class app/revanced/patcher/extensions/InstructionExtensions { - public static final field INSTANCE Lapp/revanced/patcher/extensions/InstructionExtensions; - public final fun addInstruction (Lapp/revanced/patcher/util/proxy/mutableTypes/MutableMethod;ILcom/android/tools/smali/dexlib2/builder/BuilderInstruction;)V - public final fun addInstruction (Lapp/revanced/patcher/util/proxy/mutableTypes/MutableMethod;ILjava/lang/String;)V - public final fun addInstruction (Lapp/revanced/patcher/util/proxy/mutableTypes/MutableMethod;Lcom/android/tools/smali/dexlib2/builder/BuilderInstruction;)V - public final fun addInstruction (Lapp/revanced/patcher/util/proxy/mutableTypes/MutableMethod;Ljava/lang/String;)V - public final fun addInstructions (Lapp/revanced/patcher/util/proxy/mutableTypes/MutableMethod;ILjava/lang/String;)V - public final fun addInstructions (Lapp/revanced/patcher/util/proxy/mutableTypes/MutableMethod;ILjava/util/List;)V - public final fun addInstructions (Lapp/revanced/patcher/util/proxy/mutableTypes/MutableMethod;Ljava/lang/String;)V - public final fun addInstructions (Lapp/revanced/patcher/util/proxy/mutableTypes/MutableMethod;Ljava/util/List;)V - public final fun addInstructions (Lcom/android/tools/smali/dexlib2/builder/MutableMethodImplementation;ILjava/util/List;)V - public final fun addInstructions (Lcom/android/tools/smali/dexlib2/builder/MutableMethodImplementation;Ljava/util/List;)V - public final fun addInstructionsWithLabels (Lapp/revanced/patcher/util/proxy/mutableTypes/MutableMethod;ILjava/lang/String;[Lapp/revanced/patcher/util/smali/ExternalLabel;)V - public final fun getInstruction (Lapp/revanced/patcher/util/proxy/mutableTypes/MutableMethod;I)Lcom/android/tools/smali/dexlib2/builder/BuilderInstruction; - public final fun getInstruction (Lapp/revanced/patcher/util/proxy/mutableTypes/MutableMethod;I)Ljava/lang/Object; - public final fun getInstruction (Lcom/android/tools/smali/dexlib2/builder/MutableMethodImplementation;I)Lcom/android/tools/smali/dexlib2/builder/BuilderInstruction; - public final fun getInstruction (Lcom/android/tools/smali/dexlib2/builder/MutableMethodImplementation;I)Ljava/lang/Object; - public final fun getInstructions (Lapp/revanced/patcher/util/proxy/mutableTypes/MutableMethod;)Ljava/util/List; - public final fun removeInstruction (Lapp/revanced/patcher/util/proxy/mutableTypes/MutableMethod;I)V - public final fun removeInstructions (Lapp/revanced/patcher/util/proxy/mutableTypes/MutableMethod;I)V - public final fun removeInstructions (Lapp/revanced/patcher/util/proxy/mutableTypes/MutableMethod;II)V - public final fun removeInstructions (Lcom/android/tools/smali/dexlib2/builder/MutableMethodImplementation;I)V - public final fun removeInstructions (Lcom/android/tools/smali/dexlib2/builder/MutableMethodImplementation;II)V - public final fun replaceInstruction (Lapp/revanced/patcher/util/proxy/mutableTypes/MutableMethod;ILcom/android/tools/smali/dexlib2/builder/BuilderInstruction;)V - public final fun replaceInstruction (Lapp/revanced/patcher/util/proxy/mutableTypes/MutableMethod;ILjava/lang/String;)V - public final fun replaceInstructions (Lapp/revanced/patcher/util/proxy/mutableTypes/MutableMethod;ILjava/lang/String;)V - public final fun replaceInstructions (Lapp/revanced/patcher/util/proxy/mutableTypes/MutableMethod;ILjava/util/List;)V - public final fun replaceInstructions (Lcom/android/tools/smali/dexlib2/builder/MutableMethodImplementation;ILjava/util/List;)V -} - -public final class app/revanced/patcher/extensions/MethodFingerprintExtensions { - public static final field INSTANCE Lapp/revanced/patcher/extensions/MethodFingerprintExtensions; - public final fun getFuzzyPatternScanMethod (Lapp/revanced/patcher/fingerprint/method/impl/MethodFingerprint;)Lapp/revanced/patcher/fingerprint/method/annotation/FuzzyPatternScanMethod; -} - -public abstract interface class app/revanced/patcher/fingerprint/Fingerprint { -} - -public abstract interface annotation class app/revanced/patcher/fingerprint/method/annotation/FuzzyPatternScanMethod : java/lang/annotation/Annotation { - public abstract fun threshold ()I -} - -public abstract class app/revanced/patcher/fingerprint/method/impl/MethodFingerprint : app/revanced/patcher/fingerprint/Fingerprint { - public static final field Companion Lapp/revanced/patcher/fingerprint/method/impl/MethodFingerprint$Companion; - public fun ()V - public fun (Ljava/lang/String;Ljava/lang/Integer;Ljava/lang/Iterable;Ljava/lang/Iterable;Ljava/lang/Iterable;Lkotlin/jvm/functions/Function2;)V - public synthetic fun (Ljava/lang/String;Ljava/lang/Integer;Ljava/lang/Iterable;Ljava/lang/Iterable;Ljava/lang/Iterable;Lkotlin/jvm/functions/Function2;ILkotlin/jvm/internal/DefaultConstructorMarker;)V - public final fun getResult ()Lapp/revanced/patcher/fingerprint/method/impl/MethodFingerprintResult; - public final fun setResult (Lapp/revanced/patcher/fingerprint/method/impl/MethodFingerprintResult;)V -} - -public final class app/revanced/patcher/fingerprint/method/impl/MethodFingerprint$Companion { - public final fun resolve (Lapp/revanced/patcher/fingerprint/method/impl/MethodFingerprint;Lapp/revanced/patcher/data/BytecodeContext;Lcom/android/tools/smali/dexlib2/iface/ClassDef;)Z - public final fun resolve (Lapp/revanced/patcher/fingerprint/method/impl/MethodFingerprint;Lapp/revanced/patcher/data/BytecodeContext;Lcom/android/tools/smali/dexlib2/iface/Method;Lcom/android/tools/smali/dexlib2/iface/ClassDef;)Z - public final fun resolve (Ljava/lang/Iterable;Lapp/revanced/patcher/data/BytecodeContext;Ljava/lang/Iterable;)V -} - -public final class app/revanced/patcher/fingerprint/method/impl/MethodFingerprintResult { - public fun (Lcom/android/tools/smali/dexlib2/iface/Method;Lcom/android/tools/smali/dexlib2/iface/ClassDef;Lapp/revanced/patcher/fingerprint/method/impl/MethodFingerprintResult$MethodFingerprintScanResult;Lapp/revanced/patcher/data/BytecodeContext;)V - public final fun component1 ()Lcom/android/tools/smali/dexlib2/iface/Method; - public final fun component2 ()Lcom/android/tools/smali/dexlib2/iface/ClassDef; - public final fun component3 ()Lapp/revanced/patcher/fingerprint/method/impl/MethodFingerprintResult$MethodFingerprintScanResult; - public final fun copy (Lcom/android/tools/smali/dexlib2/iface/Method;Lcom/android/tools/smali/dexlib2/iface/ClassDef;Lapp/revanced/patcher/fingerprint/method/impl/MethodFingerprintResult$MethodFingerprintScanResult;Lapp/revanced/patcher/data/BytecodeContext;)Lapp/revanced/patcher/fingerprint/method/impl/MethodFingerprintResult; - public static synthetic fun copy$default (Lapp/revanced/patcher/fingerprint/method/impl/MethodFingerprintResult;Lcom/android/tools/smali/dexlib2/iface/Method;Lcom/android/tools/smali/dexlib2/iface/ClassDef;Lapp/revanced/patcher/fingerprint/method/impl/MethodFingerprintResult$MethodFingerprintScanResult;Lapp/revanced/patcher/data/BytecodeContext;ILjava/lang/Object;)Lapp/revanced/patcher/fingerprint/method/impl/MethodFingerprintResult; - public fun equals (Ljava/lang/Object;)Z - public final fun getClassDef ()Lcom/android/tools/smali/dexlib2/iface/ClassDef; - public final fun getMethod ()Lcom/android/tools/smali/dexlib2/iface/Method; - public final fun getMutableClass ()Lapp/revanced/patcher/util/proxy/mutableTypes/MutableClass; - public final fun getMutableMethod ()Lapp/revanced/patcher/util/proxy/mutableTypes/MutableMethod; - public final fun getScanResult ()Lapp/revanced/patcher/fingerprint/method/impl/MethodFingerprintResult$MethodFingerprintScanResult; - public fun hashCode ()I - public fun toString ()Ljava/lang/String; -} - -public final class app/revanced/patcher/fingerprint/method/impl/MethodFingerprintResult$MethodFingerprintScanResult { - public fun (Lapp/revanced/patcher/fingerprint/method/impl/MethodFingerprintResult$MethodFingerprintScanResult$PatternScanResult;Lapp/revanced/patcher/fingerprint/method/impl/MethodFingerprintResult$MethodFingerprintScanResult$StringsScanResult;)V - public final fun component1 ()Lapp/revanced/patcher/fingerprint/method/impl/MethodFingerprintResult$MethodFingerprintScanResult$PatternScanResult; - public final fun component2 ()Lapp/revanced/patcher/fingerprint/method/impl/MethodFingerprintResult$MethodFingerprintScanResult$StringsScanResult; - public final fun copy (Lapp/revanced/patcher/fingerprint/method/impl/MethodFingerprintResult$MethodFingerprintScanResult$PatternScanResult;Lapp/revanced/patcher/fingerprint/method/impl/MethodFingerprintResult$MethodFingerprintScanResult$StringsScanResult;)Lapp/revanced/patcher/fingerprint/method/impl/MethodFingerprintResult$MethodFingerprintScanResult; - public static synthetic fun copy$default (Lapp/revanced/patcher/fingerprint/method/impl/MethodFingerprintResult$MethodFingerprintScanResult;Lapp/revanced/patcher/fingerprint/method/impl/MethodFingerprintResult$MethodFingerprintScanResult$PatternScanResult;Lapp/revanced/patcher/fingerprint/method/impl/MethodFingerprintResult$MethodFingerprintScanResult$StringsScanResult;ILjava/lang/Object;)Lapp/revanced/patcher/fingerprint/method/impl/MethodFingerprintResult$MethodFingerprintScanResult; - public fun equals (Ljava/lang/Object;)Z - public final fun getPatternScanResult ()Lapp/revanced/patcher/fingerprint/method/impl/MethodFingerprintResult$MethodFingerprintScanResult$PatternScanResult; - public final fun getStringsScanResult ()Lapp/revanced/patcher/fingerprint/method/impl/MethodFingerprintResult$MethodFingerprintScanResult$StringsScanResult; - public fun hashCode ()I - public fun toString ()Ljava/lang/String; -} - -public final class app/revanced/patcher/fingerprint/method/impl/MethodFingerprintResult$MethodFingerprintScanResult$PatternScanResult { - public fun (IILjava/util/List;)V - public synthetic fun (IILjava/util/List;ILkotlin/jvm/internal/DefaultConstructorMarker;)V - public final fun component1 ()I - public final fun component2 ()I - public final fun component3 ()Ljava/util/List; - public final fun copy (IILjava/util/List;)Lapp/revanced/patcher/fingerprint/method/impl/MethodFingerprintResult$MethodFingerprintScanResult$PatternScanResult; - public static synthetic fun copy$default (Lapp/revanced/patcher/fingerprint/method/impl/MethodFingerprintResult$MethodFingerprintScanResult$PatternScanResult;IILjava/util/List;ILjava/lang/Object;)Lapp/revanced/patcher/fingerprint/method/impl/MethodFingerprintResult$MethodFingerprintScanResult$PatternScanResult; - public fun equals (Ljava/lang/Object;)Z - public final fun getEndIndex ()I - public final fun getStartIndex ()I - public final fun getWarnings ()Ljava/util/List; - public fun hashCode ()I - public final fun setWarnings (Ljava/util/List;)V - public fun toString ()Ljava/lang/String; -} - -public final class app/revanced/patcher/fingerprint/method/impl/MethodFingerprintResult$MethodFingerprintScanResult$PatternScanResult$Warning { - public fun (Lcom/android/tools/smali/dexlib2/Opcode;Lcom/android/tools/smali/dexlib2/Opcode;II)V - public final fun component1 ()Lcom/android/tools/smali/dexlib2/Opcode; - public final fun component2 ()Lcom/android/tools/smali/dexlib2/Opcode; - public final fun component3 ()I - public final fun component4 ()I - public final fun copy (Lcom/android/tools/smali/dexlib2/Opcode;Lcom/android/tools/smali/dexlib2/Opcode;II)Lapp/revanced/patcher/fingerprint/method/impl/MethodFingerprintResult$MethodFingerprintScanResult$PatternScanResult$Warning; - public static synthetic fun copy$default (Lapp/revanced/patcher/fingerprint/method/impl/MethodFingerprintResult$MethodFingerprintScanResult$PatternScanResult$Warning;Lcom/android/tools/smali/dexlib2/Opcode;Lcom/android/tools/smali/dexlib2/Opcode;IIILjava/lang/Object;)Lapp/revanced/patcher/fingerprint/method/impl/MethodFingerprintResult$MethodFingerprintScanResult$PatternScanResult$Warning; - public fun equals (Ljava/lang/Object;)Z - public final fun getCorrectOpcode ()Lcom/android/tools/smali/dexlib2/Opcode; - public final fun getInstructionIndex ()I - public final fun getPatternIndex ()I - public final fun getWrongOpcode ()Lcom/android/tools/smali/dexlib2/Opcode; - public fun hashCode ()I - public fun toString ()Ljava/lang/String; -} - -public final class app/revanced/patcher/fingerprint/method/impl/MethodFingerprintResult$MethodFingerprintScanResult$StringsScanResult { - public fun (Ljava/util/List;)V - public final fun component1 ()Ljava/util/List; - public final fun copy (Ljava/util/List;)Lapp/revanced/patcher/fingerprint/method/impl/MethodFingerprintResult$MethodFingerprintScanResult$StringsScanResult; - public static synthetic fun copy$default (Lapp/revanced/patcher/fingerprint/method/impl/MethodFingerprintResult$MethodFingerprintScanResult$StringsScanResult;Ljava/util/List;ILjava/lang/Object;)Lapp/revanced/patcher/fingerprint/method/impl/MethodFingerprintResult$MethodFingerprintScanResult$StringsScanResult; - public fun equals (Ljava/lang/Object;)Z - public final fun getMatches ()Ljava/util/List; - public fun hashCode ()I - public fun toString ()Ljava/lang/String; -} - -public final class app/revanced/patcher/fingerprint/method/impl/MethodFingerprintResult$MethodFingerprintScanResult$StringsScanResult$StringMatch { - public fun (Ljava/lang/String;I)V - public final fun component1 ()Ljava/lang/String; - public final fun component2 ()I - public final fun copy (Ljava/lang/String;I)Lapp/revanced/patcher/fingerprint/method/impl/MethodFingerprintResult$MethodFingerprintScanResult$StringsScanResult$StringMatch; - public static synthetic fun copy$default (Lapp/revanced/patcher/fingerprint/method/impl/MethodFingerprintResult$MethodFingerprintScanResult$StringsScanResult$StringMatch;Ljava/lang/String;IILjava/lang/Object;)Lapp/revanced/patcher/fingerprint/method/impl/MethodFingerprintResult$MethodFingerprintScanResult$StringsScanResult$StringMatch; - public fun equals (Ljava/lang/Object;)Z - public final fun getIndex ()I - public final fun getString ()Ljava/lang/String; - public fun hashCode ()I - public fun toString ()Ljava/lang/String; -} - -public abstract interface class app/revanced/patcher/logging/Logger { - public abstract fun error (Ljava/lang/String;)V - public abstract fun info (Ljava/lang/String;)V - public abstract fun trace (Ljava/lang/String;)V - public abstract fun warn (Ljava/lang/String;)V -} - -public final class app/revanced/patcher/logging/Logger$DefaultImpls { - public static fun error (Lapp/revanced/patcher/logging/Logger;Ljava/lang/String;)V - public static fun info (Lapp/revanced/patcher/logging/Logger;Ljava/lang/String;)V - public static fun trace (Lapp/revanced/patcher/logging/Logger;Ljava/lang/String;)V - public static fun warn (Lapp/revanced/patcher/logging/Logger;Ljava/lang/String;)V -} - -public final class app/revanced/patcher/logging/impl/NopLogger : app/revanced/patcher/logging/Logger { - public static final field INSTANCE Lapp/revanced/patcher/logging/impl/NopLogger; - public fun error (Ljava/lang/String;)V - public fun info (Ljava/lang/String;)V - public fun trace (Ljava/lang/String;)V - public fun warn (Ljava/lang/String;)V -} - -public abstract class app/revanced/patcher/patch/BytecodePatch : app/revanced/patcher/patch/Patch { - public fun ()V - public fun (Ljava/util/Set;Ljava/lang/String;Ljava/lang/String;Ljava/util/Set;Ljava/util/Set;ZZ)V - public synthetic fun (Ljava/util/Set;Ljava/lang/String;Ljava/lang/String;Ljava/util/Set;Ljava/util/Set;ZZILkotlin/jvm/internal/DefaultConstructorMarker;)V -} - -public abstract class app/revanced/patcher/patch/Patch { - public synthetic fun (Ljava/lang/String;Ljava/lang/String;Ljava/util/Set;Ljava/util/Set;ZZILkotlin/jvm/internal/DefaultConstructorMarker;)V - public synthetic fun (Ljava/lang/String;Ljava/lang/String;Ljava/util/Set;Ljava/util/Set;ZZLkotlin/jvm/internal/DefaultConstructorMarker;)V - public fun equals (Ljava/lang/Object;)Z - public abstract fun execute (Lapp/revanced/patcher/data/Context;)V - public final fun getCompatiblePackages ()Ljava/util/Set; - public final fun getDependencies ()Ljava/util/Set; - public final fun getDescription ()Ljava/lang/String; - public final fun getName ()Ljava/lang/String; - public final fun getOptions ()Lapp/revanced/patcher/patch/options/PatchOptions; - public final fun getRequiresIntegrations ()Z - public final fun getUse ()Z - public fun hashCode ()I - public fun toString ()Ljava/lang/String; -} - -public final class app/revanced/patcher/patch/Patch$CompatiblePackage { - public fun (Ljava/lang/String;Ljava/util/Set;)V - public synthetic fun (Ljava/lang/String;Ljava/util/Set;ILkotlin/jvm/internal/DefaultConstructorMarker;)V - public final fun getName ()Ljava/lang/String; - public final fun getVersions ()Ljava/util/Set; -} - -public final class app/revanced/patcher/patch/PatchException : java/lang/Exception { - public fun (Ljava/lang/String;)V - public fun (Ljava/lang/String;Ljava/lang/Throwable;)V - public fun (Ljava/lang/Throwable;)V -} - -public final class app/revanced/patcher/patch/PatchResult { - public final fun getException ()Lapp/revanced/patcher/patch/PatchException; - public final fun getPatch ()Lapp/revanced/patcher/patch/Patch; -} - -public abstract class app/revanced/patcher/patch/ResourcePatch : app/revanced/patcher/patch/Patch { - public fun ()V - public fun (Ljava/lang/String;Ljava/lang/String;Ljava/util/Set;Ljava/util/Set;ZZ)V - public synthetic fun (Ljava/lang/String;Ljava/lang/String;Ljava/util/Set;Ljava/util/Set;ZZILkotlin/jvm/internal/DefaultConstructorMarker;)V -} - -public abstract class app/revanced/patcher/patch/options/PatchOption { - public fun (Ljava/lang/String;Ljava/lang/Object;Ljava/lang/String;Ljava/lang/String;ZLkotlin/jvm/functions/Function1;)V - public final fun getDescription ()Ljava/lang/String; - public final fun getKey ()Ljava/lang/String; - public final fun getRequired ()Z - public final fun getTitle ()Ljava/lang/String; - public final fun getValidate ()Lkotlin/jvm/functions/Function1; - public final fun getValue ()Ljava/lang/Object; - public final fun getValue (Ljava/lang/Object;Lkotlin/reflect/KProperty;)Ljava/lang/Object; - public final fun setValue (Ljava/lang/Object;)V - public final fun setValue (Ljava/lang/Object;Lkotlin/reflect/KProperty;Ljava/lang/Object;)V -} - -public abstract class app/revanced/patcher/patch/options/PatchOptionException : java/lang/Exception { - public synthetic fun (Ljava/lang/String;Lkotlin/jvm/internal/DefaultConstructorMarker;)V -} - -public final class app/revanced/patcher/patch/options/PatchOptionException$InvalidValueTypeException : app/revanced/patcher/patch/options/PatchOptionException { - public fun (Ljava/lang/String;Ljava/lang/String;)V -} - -public final class app/revanced/patcher/patch/options/PatchOptionException$PatchOptionNotFoundException : app/revanced/patcher/patch/options/PatchOptionException { - public fun (Ljava/lang/String;)V -} - -public final class app/revanced/patcher/patch/options/PatchOptionException$ValueRequiredException : app/revanced/patcher/patch/options/PatchOptionException { - public fun (Lapp/revanced/patcher/patch/options/PatchOption;)V -} - -public final class app/revanced/patcher/patch/options/PatchOptionException$ValueValidationException : app/revanced/patcher/patch/options/PatchOptionException { - public fun (Ljava/lang/Object;Lapp/revanced/patcher/patch/options/PatchOption;)V -} - -public final class app/revanced/patcher/patch/options/PatchOptions : java/util/Map, kotlin/jvm/internal/markers/KMutableMap { - public fun ()V - public fun clear ()V - public final fun containsKey (Ljava/lang/Object;)Z - public fun containsKey (Ljava/lang/String;)Z - public fun containsValue (Lapp/revanced/patcher/patch/options/PatchOption;)Z - public final fun containsValue (Ljava/lang/Object;)Z - public final fun entrySet ()Ljava/util/Set; - public final fun get (Ljava/lang/Object;)Lapp/revanced/patcher/patch/options/PatchOption; - public final synthetic fun get (Ljava/lang/Object;)Ljava/lang/Object; - public fun get (Ljava/lang/String;)Lapp/revanced/patcher/patch/options/PatchOption; - public fun getEntries ()Ljava/util/Set; - public fun getKeys ()Ljava/util/Set; - public fun getSize ()I - public fun getValues ()Ljava/util/Collection; - public fun isEmpty ()Z - public final fun keySet ()Ljava/util/Set; - public synthetic fun put (Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; - public fun put (Ljava/lang/String;Lapp/revanced/patcher/patch/options/PatchOption;)Lapp/revanced/patcher/patch/options/PatchOption; - public fun putAll (Ljava/util/Map;)V - public final fun register (Lapp/revanced/patcher/patch/options/PatchOption;)V - public final fun remove (Ljava/lang/Object;)Lapp/revanced/patcher/patch/options/PatchOption; - public final synthetic fun remove (Ljava/lang/Object;)Ljava/lang/Object; - public fun remove (Ljava/lang/String;)Lapp/revanced/patcher/patch/options/PatchOption; - public final fun set (Ljava/lang/String;Ljava/lang/Object;)V - public final fun size ()I - public final fun values ()Ljava/util/Collection; -} - -public final class app/revanced/patcher/patch/options/types/BooleanPatchOption : app/revanced/patcher/patch/options/PatchOption { - public static final field Companion Lapp/revanced/patcher/patch/options/types/BooleanPatchOption$Companion; - public synthetic fun (Ljava/lang/String;Ljava/lang/Boolean;Ljava/lang/String;Ljava/lang/String;ZLkotlin/jvm/functions/Function1;Lkotlin/jvm/internal/DefaultConstructorMarker;)V -} - -public final class app/revanced/patcher/patch/options/types/BooleanPatchOption$Companion { - public final fun booleanPatchOption (Lapp/revanced/patcher/patch/Patch;Ljava/lang/String;Ljava/lang/Boolean;Ljava/lang/String;Ljava/lang/String;ZLkotlin/jvm/functions/Function1;)Lapp/revanced/patcher/patch/options/types/BooleanPatchOption; - public static synthetic fun booleanPatchOption$default (Lapp/revanced/patcher/patch/options/types/BooleanPatchOption$Companion;Lapp/revanced/patcher/patch/Patch;Ljava/lang/String;Ljava/lang/Boolean;Ljava/lang/String;Ljava/lang/String;ZLkotlin/jvm/functions/Function1;ILjava/lang/Object;)Lapp/revanced/patcher/patch/options/types/BooleanPatchOption; -} - -public final class app/revanced/patcher/patch/options/types/FloatPatchOption : app/revanced/patcher/patch/options/PatchOption { - public static final field Companion Lapp/revanced/patcher/patch/options/types/FloatPatchOption$Companion; - public synthetic fun (Ljava/lang/String;Ljava/lang/Float;Ljava/lang/String;Ljava/lang/String;ZLkotlin/jvm/functions/Function1;Lkotlin/jvm/internal/DefaultConstructorMarker;)V -} - -public final class app/revanced/patcher/patch/options/types/FloatPatchOption$Companion { - public final fun floatPatchOption (Lapp/revanced/patcher/patch/Patch;Ljava/lang/String;Ljava/lang/Float;Ljava/lang/String;Ljava/lang/String;ZLkotlin/jvm/functions/Function1;)Lapp/revanced/patcher/patch/options/types/FloatPatchOption; - public static synthetic fun floatPatchOption$default (Lapp/revanced/patcher/patch/options/types/FloatPatchOption$Companion;Lapp/revanced/patcher/patch/Patch;Ljava/lang/String;Ljava/lang/Float;Ljava/lang/String;Ljava/lang/String;ZLkotlin/jvm/functions/Function1;ILjava/lang/Object;)Lapp/revanced/patcher/patch/options/types/FloatPatchOption; -} - -public final class app/revanced/patcher/patch/options/types/IntPatchOption : app/revanced/patcher/patch/options/PatchOption { - public static final field Companion Lapp/revanced/patcher/patch/options/types/IntPatchOption$Companion; - public synthetic fun (Ljava/lang/String;Ljava/lang/Integer;Ljava/lang/String;Ljava/lang/String;ZLkotlin/jvm/functions/Function1;Lkotlin/jvm/internal/DefaultConstructorMarker;)V -} - -public final class app/revanced/patcher/patch/options/types/IntPatchOption$Companion { - public final fun intPatchOption (Lapp/revanced/patcher/patch/Patch;Ljava/lang/String;Ljava/lang/Integer;Ljava/lang/String;Ljava/lang/String;ZLkotlin/jvm/functions/Function1;)Lapp/revanced/patcher/patch/options/types/IntPatchOption; - public static synthetic fun intPatchOption$default (Lapp/revanced/patcher/patch/options/types/IntPatchOption$Companion;Lapp/revanced/patcher/patch/Patch;Ljava/lang/String;Ljava/lang/Integer;Ljava/lang/String;Ljava/lang/String;ZLkotlin/jvm/functions/Function1;ILjava/lang/Object;)Lapp/revanced/patcher/patch/options/types/IntPatchOption; -} - -public final class app/revanced/patcher/patch/options/types/LongPatchOption : app/revanced/patcher/patch/options/PatchOption { - public static final field Companion Lapp/revanced/patcher/patch/options/types/LongPatchOption$Companion; - public synthetic fun (Ljava/lang/String;Ljava/lang/Long;Ljava/lang/String;Ljava/lang/String;ZLkotlin/jvm/functions/Function1;Lkotlin/jvm/internal/DefaultConstructorMarker;)V -} - -public final class app/revanced/patcher/patch/options/types/LongPatchOption$Companion { - public final fun longPatchOption (Lapp/revanced/patcher/patch/Patch;Ljava/lang/String;Ljava/lang/Long;Ljava/lang/String;Ljava/lang/String;ZLkotlin/jvm/functions/Function1;)Lapp/revanced/patcher/patch/options/types/LongPatchOption; - public static synthetic fun longPatchOption$default (Lapp/revanced/patcher/patch/options/types/LongPatchOption$Companion;Lapp/revanced/patcher/patch/Patch;Ljava/lang/String;Ljava/lang/Long;Ljava/lang/String;Ljava/lang/String;ZLkotlin/jvm/functions/Function1;ILjava/lang/Object;)Lapp/revanced/patcher/patch/options/types/LongPatchOption; -} - -public final class app/revanced/patcher/patch/options/types/StringPatchOption : app/revanced/patcher/patch/options/PatchOption { - public static final field Companion Lapp/revanced/patcher/patch/options/types/StringPatchOption$Companion; - public synthetic fun (Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;ZLkotlin/jvm/functions/Function1;Lkotlin/jvm/internal/DefaultConstructorMarker;)V -} - -public final class app/revanced/patcher/patch/options/types/StringPatchOption$Companion { - public final fun stringPatchOption (Lapp/revanced/patcher/patch/Patch;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;ZLkotlin/jvm/functions/Function1;)Lapp/revanced/patcher/patch/options/types/StringPatchOption; - public static synthetic fun stringPatchOption$default (Lapp/revanced/patcher/patch/options/types/StringPatchOption$Companion;Lapp/revanced/patcher/patch/Patch;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;ZLkotlin/jvm/functions/Function1;ILjava/lang/Object;)Lapp/revanced/patcher/patch/options/types/StringPatchOption; -} - -public final class app/revanced/patcher/patch/options/types/array/BooleanArrayPatchOption : app/revanced/patcher/patch/options/PatchOption { - public static final field Companion Lapp/revanced/patcher/patch/options/types/array/BooleanArrayPatchOption$Companion; - public synthetic fun (Ljava/lang/String;[Ljava/lang/Boolean;Ljava/lang/String;Ljava/lang/String;ZLkotlin/jvm/functions/Function1;Lkotlin/jvm/internal/DefaultConstructorMarker;)V -} - -public final class app/revanced/patcher/patch/options/types/array/BooleanArrayPatchOption$Companion { - public final fun booleanArrayPatchOption (Lapp/revanced/patcher/patch/Patch;Ljava/lang/String;[Ljava/lang/Boolean;Ljava/lang/String;Ljava/lang/String;ZLkotlin/jvm/functions/Function1;)Lapp/revanced/patcher/patch/options/types/array/BooleanArrayPatchOption; - public static synthetic fun booleanArrayPatchOption$default (Lapp/revanced/patcher/patch/options/types/array/BooleanArrayPatchOption$Companion;Lapp/revanced/patcher/patch/Patch;Ljava/lang/String;[Ljava/lang/Boolean;Ljava/lang/String;Ljava/lang/String;ZLkotlin/jvm/functions/Function1;ILjava/lang/Object;)Lapp/revanced/patcher/patch/options/types/array/BooleanArrayPatchOption; -} - -public final class app/revanced/patcher/patch/options/types/array/FloatArrayPatchOption : app/revanced/patcher/patch/options/PatchOption { - public static final field Companion Lapp/revanced/patcher/patch/options/types/array/FloatArrayPatchOption$Companion; - public synthetic fun (Ljava/lang/String;[Ljava/lang/Float;Ljava/lang/String;Ljava/lang/String;ZLkotlin/jvm/functions/Function1;Lkotlin/jvm/internal/DefaultConstructorMarker;)V -} - -public final class app/revanced/patcher/patch/options/types/array/FloatArrayPatchOption$Companion { - public final fun floatArrayPatchOption (Lapp/revanced/patcher/patch/Patch;Ljava/lang/String;[Ljava/lang/Float;Ljava/lang/String;Ljava/lang/String;ZLkotlin/jvm/functions/Function1;)Lapp/revanced/patcher/patch/options/types/array/FloatArrayPatchOption; - public static synthetic fun floatArrayPatchOption$default (Lapp/revanced/patcher/patch/options/types/array/FloatArrayPatchOption$Companion;Lapp/revanced/patcher/patch/Patch;Ljava/lang/String;[Ljava/lang/Float;Ljava/lang/String;Ljava/lang/String;ZLkotlin/jvm/functions/Function1;ILjava/lang/Object;)Lapp/revanced/patcher/patch/options/types/array/FloatArrayPatchOption; -} - -public final class app/revanced/patcher/patch/options/types/array/IntArrayPatchOption : app/revanced/patcher/patch/options/PatchOption { - public static final field Companion Lapp/revanced/patcher/patch/options/types/array/IntArrayPatchOption$Companion; - public synthetic fun (Ljava/lang/String;[Ljava/lang/Integer;Ljava/lang/String;Ljava/lang/String;ZLkotlin/jvm/functions/Function1;Lkotlin/jvm/internal/DefaultConstructorMarker;)V -} - -public final class app/revanced/patcher/patch/options/types/array/IntArrayPatchOption$Companion { - public final fun intArrayPatchOption (Lapp/revanced/patcher/patch/Patch;Ljava/lang/String;[Ljava/lang/Integer;Ljava/lang/String;Ljava/lang/String;ZLkotlin/jvm/functions/Function1;)Lapp/revanced/patcher/patch/options/types/array/IntArrayPatchOption; - public static synthetic fun intArrayPatchOption$default (Lapp/revanced/patcher/patch/options/types/array/IntArrayPatchOption$Companion;Lapp/revanced/patcher/patch/Patch;Ljava/lang/String;[Ljava/lang/Integer;Ljava/lang/String;Ljava/lang/String;ZLkotlin/jvm/functions/Function1;ILjava/lang/Object;)Lapp/revanced/patcher/patch/options/types/array/IntArrayPatchOption; -} - -public final class app/revanced/patcher/patch/options/types/array/LongArrayPatchOption : app/revanced/patcher/patch/options/PatchOption { - public static final field Companion Lapp/revanced/patcher/patch/options/types/array/LongArrayPatchOption$Companion; - public synthetic fun (Ljava/lang/String;[Ljava/lang/Long;Ljava/lang/String;Ljava/lang/String;ZLkotlin/jvm/functions/Function1;Lkotlin/jvm/internal/DefaultConstructorMarker;)V -} - -public final class app/revanced/patcher/patch/options/types/array/LongArrayPatchOption$Companion { - public final fun longArrayPatchOption (Lapp/revanced/patcher/patch/Patch;Ljava/lang/String;[Ljava/lang/Long;Ljava/lang/String;Ljava/lang/String;ZLkotlin/jvm/functions/Function1;)Lapp/revanced/patcher/patch/options/types/array/LongArrayPatchOption; - public static synthetic fun longArrayPatchOption$default (Lapp/revanced/patcher/patch/options/types/array/LongArrayPatchOption$Companion;Lapp/revanced/patcher/patch/Patch;Ljava/lang/String;[Ljava/lang/Long;Ljava/lang/String;Ljava/lang/String;ZLkotlin/jvm/functions/Function1;ILjava/lang/Object;)Lapp/revanced/patcher/patch/options/types/array/LongArrayPatchOption; -} - -public final class app/revanced/patcher/patch/options/types/array/StringArrayPatchOption : app/revanced/patcher/patch/options/PatchOption { - public static final field Companion Lapp/revanced/patcher/patch/options/types/array/StringArrayPatchOption$Companion; - public synthetic fun (Ljava/lang/String;[Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;ZLkotlin/jvm/functions/Function1;Lkotlin/jvm/internal/DefaultConstructorMarker;)V -} - -public final class app/revanced/patcher/patch/options/types/array/StringArrayPatchOption$Companion { - public final fun stringArrayPatchOption (Lapp/revanced/patcher/patch/Patch;Ljava/lang/String;[Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;ZLkotlin/jvm/functions/Function1;)Lapp/revanced/patcher/patch/options/types/array/StringArrayPatchOption; - public static synthetic fun stringArrayPatchOption$default (Lapp/revanced/patcher/patch/options/types/array/StringArrayPatchOption$Companion;Lapp/revanced/patcher/patch/Patch;Ljava/lang/String;[Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;ZLkotlin/jvm/functions/Function1;ILjava/lang/Object;)Lapp/revanced/patcher/patch/options/types/array/StringArrayPatchOption; -} - -public final class app/revanced/patcher/util/DomFileEditor : java/io/Closeable { - public fun (Ljava/io/File;)V - public fun close ()V - public final fun getFile ()Lorg/w3c/dom/Document; -} - -public final class app/revanced/patcher/util/ProxyClassList : java/util/Set, kotlin/jvm/internal/markers/KMutableSet { - public final fun add (Lapp/revanced/patcher/util/proxy/ClassProxy;)Z - public fun add (Lcom/android/tools/smali/dexlib2/iface/ClassDef;)Z - public synthetic fun add (Ljava/lang/Object;)Z - public fun addAll (Ljava/util/Collection;)Z - public fun clear ()V - public fun contains (Lcom/android/tools/smali/dexlib2/iface/ClassDef;)Z - public final fun contains (Ljava/lang/Object;)Z - public fun containsAll (Ljava/util/Collection;)Z - public fun getSize ()I - public fun isEmpty ()Z - public fun iterator ()Ljava/util/Iterator; - public fun remove (Lcom/android/tools/smali/dexlib2/iface/ClassDef;)Z - public final fun remove (Ljava/lang/Object;)Z - public fun removeAll (Ljava/util/Collection;)Z - public fun retainAll (Ljava/util/Collection;)Z - public final fun size ()I - public fun toArray ()[Ljava/lang/Object; - public fun toArray ([Ljava/lang/Object;)[Ljava/lang/Object; -} - -public final class app/revanced/patcher/util/method/MethodWalker { - public final fun getMethod ()Lcom/android/tools/smali/dexlib2/iface/Method; - public final fun nextMethod (IZ)Lapp/revanced/patcher/util/method/MethodWalker; - public static synthetic fun nextMethod$default (Lapp/revanced/patcher/util/method/MethodWalker;IZILjava/lang/Object;)Lapp/revanced/patcher/util/method/MethodWalker; -} - -public final class app/revanced/patcher/util/proxy/ClassProxy { - public final fun getImmutableClass ()Lcom/android/tools/smali/dexlib2/iface/ClassDef; - public final fun getMutableClass ()Lapp/revanced/patcher/util/proxy/mutableTypes/MutableClass; -} - -public final class app/revanced/patcher/util/proxy/mutableTypes/MutableAnnotation : com/android/tools/smali/dexlib2/base/BaseAnnotation { - public static final field Companion Lapp/revanced/patcher/util/proxy/mutableTypes/MutableAnnotation$Companion; - public fun (Lcom/android/tools/smali/dexlib2/iface/Annotation;)V - public fun getElements ()Ljava/util/Set; - public fun getType ()Ljava/lang/String; - public fun getVisibility ()I -} - -public final class app/revanced/patcher/util/proxy/mutableTypes/MutableAnnotation$Companion { - public final fun toMutable (Lcom/android/tools/smali/dexlib2/iface/Annotation;)Lapp/revanced/patcher/util/proxy/mutableTypes/MutableAnnotation; -} - -public final class app/revanced/patcher/util/proxy/mutableTypes/MutableAnnotationElement : com/android/tools/smali/dexlib2/base/BaseAnnotationElement { - public static final field Companion Lapp/revanced/patcher/util/proxy/mutableTypes/MutableAnnotationElement$Companion; - public fun (Lcom/android/tools/smali/dexlib2/iface/AnnotationElement;)V - public fun getName ()Ljava/lang/String; - public fun getValue ()Lcom/android/tools/smali/dexlib2/iface/value/EncodedValue; - public final fun setName (Ljava/lang/String;)V - public final fun setValue (Lapp/revanced/patcher/util/proxy/mutableTypes/encodedValue/MutableEncodedValue;)V -} - -public final class app/revanced/patcher/util/proxy/mutableTypes/MutableAnnotationElement$Companion { - public final fun toMutable (Lcom/android/tools/smali/dexlib2/iface/AnnotationElement;)Lapp/revanced/patcher/util/proxy/mutableTypes/MutableAnnotationElement; -} - -public final class app/revanced/patcher/util/proxy/mutableTypes/MutableClass : com/android/tools/smali/dexlib2/base/reference/BaseTypeReference, com/android/tools/smali/dexlib2/iface/ClassDef { - public static final field Companion Lapp/revanced/patcher/util/proxy/mutableTypes/MutableClass$Companion; - public fun (Lcom/android/tools/smali/dexlib2/iface/ClassDef;)V - public final fun charAt (I)C - public fun get (I)C - public fun getAccessFlags ()I - public fun getAnnotations ()Ljava/util/Set; - public synthetic fun getDirectMethods ()Ljava/lang/Iterable; - public fun getDirectMethods ()Ljava/util/Set; - public synthetic fun getFields ()Ljava/lang/Iterable; - public fun getFields ()Ljava/util/Set; - public synthetic fun getInstanceFields ()Ljava/lang/Iterable; - public fun getInstanceFields ()Ljava/util/Set; - public fun getInterfaces ()Ljava/util/List; - public fun getLength ()I - public synthetic fun getMethods ()Ljava/lang/Iterable; - public fun getMethods ()Ljava/util/Set; - public fun getSourceFile ()Ljava/lang/String; - public synthetic fun getStaticFields ()Ljava/lang/Iterable; - public fun getStaticFields ()Ljava/util/Set; - public fun getSuperclass ()Ljava/lang/String; - public fun getType ()Ljava/lang/String; - public synthetic fun getVirtualMethods ()Ljava/lang/Iterable; - public fun getVirtualMethods ()Ljava/util/Set; - public final fun length ()I - public final fun setAccessFlags (I)V - public final fun setSourceFile (Ljava/lang/String;)V - public final fun setSuperClass (Ljava/lang/String;)V - public final fun setType (Ljava/lang/String;)V -} - -public final class app/revanced/patcher/util/proxy/mutableTypes/MutableClass$Companion { - public final fun toMutable (Lcom/android/tools/smali/dexlib2/iface/ClassDef;)Lapp/revanced/patcher/util/proxy/mutableTypes/MutableClass; -} - -public final class app/revanced/patcher/util/proxy/mutableTypes/MutableField : com/android/tools/smali/dexlib2/base/reference/BaseFieldReference, com/android/tools/smali/dexlib2/iface/Field { - public static final field Companion Lapp/revanced/patcher/util/proxy/mutableTypes/MutableField$Companion; - public fun (Lcom/android/tools/smali/dexlib2/iface/Field;)V - public fun getAccessFlags ()I - public fun getAnnotations ()Ljava/util/Set; - public fun getDefiningClass ()Ljava/lang/String; - public fun getHiddenApiRestrictions ()Ljava/util/Set; - public fun getInitialValue ()Lapp/revanced/patcher/util/proxy/mutableTypes/encodedValue/MutableEncodedValue; - public synthetic fun getInitialValue ()Lcom/android/tools/smali/dexlib2/iface/value/EncodedValue; - public fun getName ()Ljava/lang/String; - public fun getType ()Ljava/lang/String; - public final fun setAccessFlags (I)V - public final fun setDefiningClass (Ljava/lang/String;)V - public final fun setInitialValue (Lapp/revanced/patcher/util/proxy/mutableTypes/encodedValue/MutableEncodedValue;)V - public final fun setName (Ljava/lang/String;)V - public final fun setType (Ljava/lang/String;)V -} - -public final class app/revanced/patcher/util/proxy/mutableTypes/MutableField$Companion { - public final fun toMutable (Lcom/android/tools/smali/dexlib2/iface/Field;)Lapp/revanced/patcher/util/proxy/mutableTypes/MutableField; -} - -public final class app/revanced/patcher/util/proxy/mutableTypes/MutableMethod : com/android/tools/smali/dexlib2/base/reference/BaseMethodReference, com/android/tools/smali/dexlib2/iface/Method { - public static final field Companion Lapp/revanced/patcher/util/proxy/mutableTypes/MutableMethod$Companion; - public fun (Lcom/android/tools/smali/dexlib2/iface/Method;)V - public fun getAccessFlags ()I - public fun getAnnotations ()Ljava/util/Set; - public fun getDefiningClass ()Ljava/lang/String; - public fun getHiddenApiRestrictions ()Ljava/util/Set; - public fun getImplementation ()Lcom/android/tools/smali/dexlib2/builder/MutableMethodImplementation; - public synthetic fun getImplementation ()Lcom/android/tools/smali/dexlib2/iface/MethodImplementation; - public fun getName ()Ljava/lang/String; - public fun getParameterTypes ()Ljava/util/List; - public fun getParameters ()Ljava/util/List; - public fun getReturnType ()Ljava/lang/String; - public final fun setAccessFlags (I)V - public final fun setDefiningClass (Ljava/lang/String;)V - public final fun setName (Ljava/lang/String;)V - public final fun setReturnType (Ljava/lang/String;)V -} - -public final class app/revanced/patcher/util/proxy/mutableTypes/MutableMethod$Companion { - public final fun toMutable (Lcom/android/tools/smali/dexlib2/iface/Method;)Lapp/revanced/patcher/util/proxy/mutableTypes/MutableMethod; -} - -public final class app/revanced/patcher/util/proxy/mutableTypes/MutableMethodParameter : com/android/tools/smali/dexlib2/base/BaseMethodParameter, com/android/tools/smali/dexlib2/iface/MethodParameter { - public static final field Companion Lapp/revanced/patcher/util/proxy/mutableTypes/MutableMethodParameter$Companion; - public fun (Lcom/android/tools/smali/dexlib2/iface/MethodParameter;)V - public final fun charAt (I)C - public fun get (I)C - public fun getAnnotations ()Ljava/util/Set; - public fun getLength ()I - public fun getName ()Ljava/lang/String; - public fun getSignature ()Ljava/lang/String; - public fun getType ()Ljava/lang/String; - public final fun length ()I -} - -public final class app/revanced/patcher/util/proxy/mutableTypes/MutableMethodParameter$Companion { - public final fun toMutable (Lcom/android/tools/smali/dexlib2/iface/MethodParameter;)Lapp/revanced/patcher/util/proxy/mutableTypes/MutableMethodParameter; -} - -public final class app/revanced/patcher/util/proxy/mutableTypes/encodedValue/MutableAnnotationEncodedValue : com/android/tools/smali/dexlib2/base/value/BaseAnnotationEncodedValue, app/revanced/patcher/util/proxy/mutableTypes/encodedValue/MutableEncodedValue { - public static final field Companion Lapp/revanced/patcher/util/proxy/mutableTypes/encodedValue/MutableAnnotationEncodedValue$Companion; - public fun (Lcom/android/tools/smali/dexlib2/iface/value/AnnotationEncodedValue;)V - public fun getElements ()Ljava/util/Set; - public fun getType ()Ljava/lang/String; - public final fun setType (Ljava/lang/String;)V -} - -public final class app/revanced/patcher/util/proxy/mutableTypes/encodedValue/MutableAnnotationEncodedValue$Companion { - public final fun toMutable (Lcom/android/tools/smali/dexlib2/iface/value/AnnotationEncodedValue;)Lapp/revanced/patcher/util/proxy/mutableTypes/encodedValue/MutableAnnotationEncodedValue; -} - -public final class app/revanced/patcher/util/proxy/mutableTypes/encodedValue/MutableArrayEncodedValue : com/android/tools/smali/dexlib2/base/value/BaseArrayEncodedValue, app/revanced/patcher/util/proxy/mutableTypes/encodedValue/MutableEncodedValue { - public static final field Companion Lapp/revanced/patcher/util/proxy/mutableTypes/encodedValue/MutableArrayEncodedValue$Companion; - public fun (Lcom/android/tools/smali/dexlib2/iface/value/ArrayEncodedValue;)V - public fun getValue ()Ljava/util/List; -} - -public final class app/revanced/patcher/util/proxy/mutableTypes/encodedValue/MutableArrayEncodedValue$Companion { - public final fun toMutable (Lcom/android/tools/smali/dexlib2/iface/value/ArrayEncodedValue;)Lapp/revanced/patcher/util/proxy/mutableTypes/encodedValue/MutableArrayEncodedValue; -} - -public final class app/revanced/patcher/util/proxy/mutableTypes/encodedValue/MutableBooleanEncodedValue : com/android/tools/smali/dexlib2/base/value/BaseBooleanEncodedValue, app/revanced/patcher/util/proxy/mutableTypes/encodedValue/MutableEncodedValue { - public static final field Companion Lapp/revanced/patcher/util/proxy/mutableTypes/encodedValue/MutableBooleanEncodedValue$Companion; - public fun (Lcom/android/tools/smali/dexlib2/iface/value/BooleanEncodedValue;)V - public fun getValue ()Z - public final fun setValue (Z)V -} - -public final class app/revanced/patcher/util/proxy/mutableTypes/encodedValue/MutableBooleanEncodedValue$Companion { - public final fun toMutable (Lcom/android/tools/smali/dexlib2/iface/value/BooleanEncodedValue;)Lapp/revanced/patcher/util/proxy/mutableTypes/encodedValue/MutableBooleanEncodedValue; -} - -public final class app/revanced/patcher/util/proxy/mutableTypes/encodedValue/MutableByteEncodedValue : com/android/tools/smali/dexlib2/base/value/BaseByteEncodedValue, app/revanced/patcher/util/proxy/mutableTypes/encodedValue/MutableEncodedValue { - public static final field Companion Lapp/revanced/patcher/util/proxy/mutableTypes/encodedValue/MutableByteEncodedValue$Companion; - public fun (Lcom/android/tools/smali/dexlib2/iface/value/ByteEncodedValue;)V - public fun getValue ()B - public final fun setValue (B)V -} - -public final class app/revanced/patcher/util/proxy/mutableTypes/encodedValue/MutableByteEncodedValue$Companion { - public final fun toMutable (Lcom/android/tools/smali/dexlib2/iface/value/ByteEncodedValue;)Lapp/revanced/patcher/util/proxy/mutableTypes/encodedValue/MutableByteEncodedValue; -} - -public final class app/revanced/patcher/util/proxy/mutableTypes/encodedValue/MutableCharEncodedValue : com/android/tools/smali/dexlib2/base/value/BaseCharEncodedValue, app/revanced/patcher/util/proxy/mutableTypes/encodedValue/MutableEncodedValue { - public static final field Companion Lapp/revanced/patcher/util/proxy/mutableTypes/encodedValue/MutableCharEncodedValue$Companion; - public fun (Lcom/android/tools/smali/dexlib2/iface/value/CharEncodedValue;)V - public fun getValue ()C - public final fun setValue (C)V -} - -public final class app/revanced/patcher/util/proxy/mutableTypes/encodedValue/MutableCharEncodedValue$Companion { - public final fun toMutable (Lcom/android/tools/smali/dexlib2/iface/value/CharEncodedValue;)Lapp/revanced/patcher/util/proxy/mutableTypes/encodedValue/MutableCharEncodedValue; -} - -public final class app/revanced/patcher/util/proxy/mutableTypes/encodedValue/MutableDoubleEncodedValue : com/android/tools/smali/dexlib2/base/value/BaseDoubleEncodedValue, app/revanced/patcher/util/proxy/mutableTypes/encodedValue/MutableEncodedValue { - public static final field Companion Lapp/revanced/patcher/util/proxy/mutableTypes/encodedValue/MutableDoubleEncodedValue$Companion; - public fun (Lcom/android/tools/smali/dexlib2/iface/value/DoubleEncodedValue;)V - public fun getValue ()D - public final fun setValue (D)V -} - -public final class app/revanced/patcher/util/proxy/mutableTypes/encodedValue/MutableDoubleEncodedValue$Companion { - public final fun toMutable (Lcom/android/tools/smali/dexlib2/iface/value/DoubleEncodedValue;)Lapp/revanced/patcher/util/proxy/mutableTypes/encodedValue/MutableDoubleEncodedValue; -} - -public abstract interface class app/revanced/patcher/util/proxy/mutableTypes/encodedValue/MutableEncodedValue : com/android/tools/smali/dexlib2/iface/value/EncodedValue { - public static final field Companion Lapp/revanced/patcher/util/proxy/mutableTypes/encodedValue/MutableEncodedValue$Companion; -} - -public final class app/revanced/patcher/util/proxy/mutableTypes/encodedValue/MutableEncodedValue$Companion { - public final fun toMutable (Lcom/android/tools/smali/dexlib2/iface/value/EncodedValue;)Lapp/revanced/patcher/util/proxy/mutableTypes/encodedValue/MutableEncodedValue; -} - -public final class app/revanced/patcher/util/proxy/mutableTypes/encodedValue/MutableEnumEncodedValue : com/android/tools/smali/dexlib2/base/value/BaseEnumEncodedValue, app/revanced/patcher/util/proxy/mutableTypes/encodedValue/MutableEncodedValue { - public static final field Companion Lapp/revanced/patcher/util/proxy/mutableTypes/encodedValue/MutableEnumEncodedValue$Companion; - public fun (Lcom/android/tools/smali/dexlib2/iface/value/EnumEncodedValue;)V - public fun getValue ()Lcom/android/tools/smali/dexlib2/iface/reference/FieldReference; - public final fun setValue (Lcom/android/tools/smali/dexlib2/iface/reference/FieldReference;)V -} - -public final class app/revanced/patcher/util/proxy/mutableTypes/encodedValue/MutableEnumEncodedValue$Companion { - public final fun toMutable (Lcom/android/tools/smali/dexlib2/iface/value/EnumEncodedValue;)Lapp/revanced/patcher/util/proxy/mutableTypes/encodedValue/MutableEnumEncodedValue; -} - -public final class app/revanced/patcher/util/proxy/mutableTypes/encodedValue/MutableFieldEncodedValue : com/android/tools/smali/dexlib2/base/value/BaseFieldEncodedValue, app/revanced/patcher/util/proxy/mutableTypes/encodedValue/MutableEncodedValue { - public static final field Companion Lapp/revanced/patcher/util/proxy/mutableTypes/encodedValue/MutableFieldEncodedValue$Companion; - public fun (Lcom/android/tools/smali/dexlib2/iface/value/FieldEncodedValue;)V - public fun getValue ()Lcom/android/tools/smali/dexlib2/iface/reference/FieldReference; - public fun getValueType ()I - public final fun setValue (Lcom/android/tools/smali/dexlib2/iface/reference/FieldReference;)V -} - -public final class app/revanced/patcher/util/proxy/mutableTypes/encodedValue/MutableFieldEncodedValue$Companion { - public final fun toMutable (Lcom/android/tools/smali/dexlib2/iface/value/FieldEncodedValue;)Lapp/revanced/patcher/util/proxy/mutableTypes/encodedValue/MutableFieldEncodedValue; -} - -public final class app/revanced/patcher/util/proxy/mutableTypes/encodedValue/MutableFloatEncodedValue : com/android/tools/smali/dexlib2/base/value/BaseFloatEncodedValue, app/revanced/patcher/util/proxy/mutableTypes/encodedValue/MutableEncodedValue { - public static final field Companion Lapp/revanced/patcher/util/proxy/mutableTypes/encodedValue/MutableFloatEncodedValue$Companion; - public fun (Lcom/android/tools/smali/dexlib2/iface/value/FloatEncodedValue;)V - public fun getValue ()F - public final fun setValue (F)V -} - -public final class app/revanced/patcher/util/proxy/mutableTypes/encodedValue/MutableFloatEncodedValue$Companion { - public final fun toMutable (Lcom/android/tools/smali/dexlib2/iface/value/FloatEncodedValue;)Lapp/revanced/patcher/util/proxy/mutableTypes/encodedValue/MutableFloatEncodedValue; -} - -public final class app/revanced/patcher/util/proxy/mutableTypes/encodedValue/MutableIntEncodedValue : com/android/tools/smali/dexlib2/base/value/BaseIntEncodedValue, app/revanced/patcher/util/proxy/mutableTypes/encodedValue/MutableEncodedValue { - public static final field Companion Lapp/revanced/patcher/util/proxy/mutableTypes/encodedValue/MutableIntEncodedValue$Companion; - public fun (Lcom/android/tools/smali/dexlib2/iface/value/IntEncodedValue;)V - public fun getValue ()I - public final fun setValue (I)V -} - -public final class app/revanced/patcher/util/proxy/mutableTypes/encodedValue/MutableIntEncodedValue$Companion { - public final fun toMutable (Lcom/android/tools/smali/dexlib2/iface/value/IntEncodedValue;)Lapp/revanced/patcher/util/proxy/mutableTypes/encodedValue/MutableIntEncodedValue; -} - -public final class app/revanced/patcher/util/proxy/mutableTypes/encodedValue/MutableLongEncodedValue : com/android/tools/smali/dexlib2/base/value/BaseLongEncodedValue, app/revanced/patcher/util/proxy/mutableTypes/encodedValue/MutableEncodedValue { - public static final field Companion Lapp/revanced/patcher/util/proxy/mutableTypes/encodedValue/MutableLongEncodedValue$Companion; - public fun (Lcom/android/tools/smali/dexlib2/iface/value/LongEncodedValue;)V - public fun getValue ()J - public final fun setValue (J)V -} - -public final class app/revanced/patcher/util/proxy/mutableTypes/encodedValue/MutableLongEncodedValue$Companion { - public final fun toMutable (Lcom/android/tools/smali/dexlib2/iface/value/LongEncodedValue;)Lapp/revanced/patcher/util/proxy/mutableTypes/encodedValue/MutableLongEncodedValue; -} - -public final class app/revanced/patcher/util/proxy/mutableTypes/encodedValue/MutableMethodEncodedValue : com/android/tools/smali/dexlib2/base/value/BaseMethodEncodedValue, app/revanced/patcher/util/proxy/mutableTypes/encodedValue/MutableEncodedValue { - public static final field Companion Lapp/revanced/patcher/util/proxy/mutableTypes/encodedValue/MutableMethodEncodedValue$Companion; - public fun (Lcom/android/tools/smali/dexlib2/iface/value/MethodEncodedValue;)V - public fun getValue ()Lcom/android/tools/smali/dexlib2/iface/reference/MethodReference; - public final fun setValue (Lcom/android/tools/smali/dexlib2/iface/reference/MethodReference;)V -} - -public final class app/revanced/patcher/util/proxy/mutableTypes/encodedValue/MutableMethodEncodedValue$Companion { - public final fun toMutable (Lcom/android/tools/smali/dexlib2/iface/value/MethodEncodedValue;)Lapp/revanced/patcher/util/proxy/mutableTypes/encodedValue/MutableMethodEncodedValue; -} - -public final class app/revanced/patcher/util/proxy/mutableTypes/encodedValue/MutableMethodHandleEncodedValue : com/android/tools/smali/dexlib2/base/value/BaseMethodHandleEncodedValue, app/revanced/patcher/util/proxy/mutableTypes/encodedValue/MutableEncodedValue { - public static final field Companion Lapp/revanced/patcher/util/proxy/mutableTypes/encodedValue/MutableMethodHandleEncodedValue$Companion; - public fun (Lcom/android/tools/smali/dexlib2/iface/value/MethodHandleEncodedValue;)V - public fun getValue ()Lcom/android/tools/smali/dexlib2/iface/reference/MethodHandleReference; - public final fun setValue (Lcom/android/tools/smali/dexlib2/iface/reference/MethodHandleReference;)V -} - -public final class app/revanced/patcher/util/proxy/mutableTypes/encodedValue/MutableMethodHandleEncodedValue$Companion { - public final fun toMutable (Lcom/android/tools/smali/dexlib2/iface/value/MethodHandleEncodedValue;)Lapp/revanced/patcher/util/proxy/mutableTypes/encodedValue/MutableMethodHandleEncodedValue; -} - -public final class app/revanced/patcher/util/proxy/mutableTypes/encodedValue/MutableMethodTypeEncodedValue : com/android/tools/smali/dexlib2/base/value/BaseMethodTypeEncodedValue, app/revanced/patcher/util/proxy/mutableTypes/encodedValue/MutableEncodedValue { - public static final field Companion Lapp/revanced/patcher/util/proxy/mutableTypes/encodedValue/MutableMethodTypeEncodedValue$Companion; - public fun (Lcom/android/tools/smali/dexlib2/iface/value/MethodTypeEncodedValue;)V - public fun getValue ()Lcom/android/tools/smali/dexlib2/iface/reference/MethodProtoReference; - public final fun setValue (Lcom/android/tools/smali/dexlib2/iface/reference/MethodProtoReference;)V -} - -public final class app/revanced/patcher/util/proxy/mutableTypes/encodedValue/MutableMethodTypeEncodedValue$Companion { - public final fun toMutable (Lcom/android/tools/smali/dexlib2/iface/value/MethodTypeEncodedValue;)Lapp/revanced/patcher/util/proxy/mutableTypes/encodedValue/MutableMethodTypeEncodedValue; -} - -public final class app/revanced/patcher/util/proxy/mutableTypes/encodedValue/MutableNullEncodedValue : com/android/tools/smali/dexlib2/base/value/BaseNullEncodedValue, app/revanced/patcher/util/proxy/mutableTypes/encodedValue/MutableEncodedValue { - public static final field Companion Lapp/revanced/patcher/util/proxy/mutableTypes/encodedValue/MutableNullEncodedValue$Companion; - public fun ()V -} - -public final class app/revanced/patcher/util/proxy/mutableTypes/encodedValue/MutableNullEncodedValue$Companion { - public final fun toMutable (Lcom/android/tools/smali/dexlib2/iface/value/ByteEncodedValue;)Lapp/revanced/patcher/util/proxy/mutableTypes/encodedValue/MutableByteEncodedValue; -} - -public final class app/revanced/patcher/util/proxy/mutableTypes/encodedValue/MutableShortEncodedValue : com/android/tools/smali/dexlib2/base/value/BaseShortEncodedValue, app/revanced/patcher/util/proxy/mutableTypes/encodedValue/MutableEncodedValue { - public static final field Companion Lapp/revanced/patcher/util/proxy/mutableTypes/encodedValue/MutableShortEncodedValue$Companion; - public fun (Lcom/android/tools/smali/dexlib2/iface/value/ShortEncodedValue;)V - public fun getValue ()S - public final fun setValue (S)V -} - -public final class app/revanced/patcher/util/proxy/mutableTypes/encodedValue/MutableShortEncodedValue$Companion { - public final fun toMutable (Lcom/android/tools/smali/dexlib2/iface/value/ShortEncodedValue;)Lapp/revanced/patcher/util/proxy/mutableTypes/encodedValue/MutableShortEncodedValue; -} - -public final class app/revanced/patcher/util/proxy/mutableTypes/encodedValue/MutableStringEncodedValue : com/android/tools/smali/dexlib2/base/value/BaseStringEncodedValue, app/revanced/patcher/util/proxy/mutableTypes/encodedValue/MutableEncodedValue { - public static final field Companion Lapp/revanced/patcher/util/proxy/mutableTypes/encodedValue/MutableStringEncodedValue$Companion; - public fun (Lcom/android/tools/smali/dexlib2/iface/value/StringEncodedValue;)V - public fun getValue ()Ljava/lang/String; - public final fun setValue (Ljava/lang/String;)V -} - -public final class app/revanced/patcher/util/proxy/mutableTypes/encodedValue/MutableStringEncodedValue$Companion { - public final fun toMutable (Lcom/android/tools/smali/dexlib2/iface/value/ByteEncodedValue;)Lapp/revanced/patcher/util/proxy/mutableTypes/encodedValue/MutableByteEncodedValue; -} - -public final class app/revanced/patcher/util/proxy/mutableTypes/encodedValue/MutableTypeEncodedValue : com/android/tools/smali/dexlib2/base/value/BaseTypeEncodedValue, app/revanced/patcher/util/proxy/mutableTypes/encodedValue/MutableEncodedValue { - public static final field Companion Lapp/revanced/patcher/util/proxy/mutableTypes/encodedValue/MutableTypeEncodedValue$Companion; - public fun (Lcom/android/tools/smali/dexlib2/iface/value/TypeEncodedValue;)V - public fun getValue ()Ljava/lang/String; - public final fun setValue (Ljava/lang/String;)V -} - -public final class app/revanced/patcher/util/proxy/mutableTypes/encodedValue/MutableTypeEncodedValue$Companion { - public final fun toMutable (Lcom/android/tools/smali/dexlib2/iface/value/TypeEncodedValue;)Lapp/revanced/patcher/util/proxy/mutableTypes/encodedValue/MutableTypeEncodedValue; -} - -public final class app/revanced/patcher/util/smali/ExternalLabel { - public fun (Ljava/lang/String;Lcom/android/tools/smali/dexlib2/iface/instruction/Instruction;)V - public final fun copy (Ljava/lang/String;Lcom/android/tools/smali/dexlib2/iface/instruction/Instruction;)Lapp/revanced/patcher/util/smali/ExternalLabel; - public static synthetic fun copy$default (Lapp/revanced/patcher/util/smali/ExternalLabel;Ljava/lang/String;Lcom/android/tools/smali/dexlib2/iface/instruction/Instruction;ILjava/lang/Object;)Lapp/revanced/patcher/util/smali/ExternalLabel; - public fun equals (Ljava/lang/Object;)Z - public fun hashCode ()I - public fun toString ()Ljava/lang/String; -} - -public final class app/revanced/patcher/util/smali/InlineSmaliCompiler { - public static final field Companion Lapp/revanced/patcher/util/smali/InlineSmaliCompiler$Companion; - public fun ()V -} - -public final class app/revanced/patcher/util/smali/InlineSmaliCompiler$Companion { - public final fun compile (Ljava/lang/String;Ljava/lang/String;IZ)Ljava/util/List; -} - -public final class app/revanced/patcher/util/smali/InlineSmaliCompilerKt { - public static final fun toInstruction (Ljava/lang/String;Lapp/revanced/patcher/util/proxy/mutableTypes/MutableMethod;)Lcom/android/tools/smali/dexlib2/builder/BuilderInstruction; - public static synthetic fun toInstruction$default (Ljava/lang/String;Lapp/revanced/patcher/util/proxy/mutableTypes/MutableMethod;ILjava/lang/Object;)Lcom/android/tools/smali/dexlib2/builder/BuilderInstruction; - public static final fun toInstructions (Ljava/lang/String;Lapp/revanced/patcher/util/proxy/mutableTypes/MutableMethod;)Ljava/util/List; - public static synthetic fun toInstructions$default (Ljava/lang/String;Lapp/revanced/patcher/util/proxy/mutableTypes/MutableMethod;ILjava/lang/Object;)Ljava/util/List; -} - diff --git a/revanced-patcher/build.gradle.kts b/revanced-patcher/build.gradle.kts deleted file mode 100644 index 832f981..0000000 --- a/revanced-patcher/build.gradle.kts +++ /dev/null @@ -1,51 +0,0 @@ -dependencies { - implementation(libs.kotlinx.coroutines.core) - implementation(libs.xpp3) - implementation(libs.smali) - implementation(libs.multidexlib2) - implementation(libs.apktool.lib) - implementation(libs.kotlin.reflect) - - compileOnly(libs.android) - - testImplementation(libs.kotlin.test) -} - -tasks { - processResources { - expand("projectVersion" to project.version) - } -} - -publishing { - publications { - create("revanced-patcher-publication") { - from(components["java"]) - - pom { - name = "ReVanced Patcher" - description = "Patcher used by ReVanced." - url = "https://revanced.app" - - licenses { - license { - name = "GNU General Public License v3.0" - url = "https://www.gnu.org/licenses/gpl-3.0.en.html" - } - } - developers { - developer { - id = "ReVanced" - name = "ReVanced" - email = "contact@revanced.app" - } - } - scm { - connection = "scm:git:git://github.com/revanced/revanced-patcher.git" - developerConnection = "scm:git:git@github.com:revanced/revanced-patcher.git" - url = "https://github.com/revanced/revanced-patcher" - } - } - } - } -} diff --git a/revanced-patcher/settings.gradle.kts b/revanced-patcher/settings.gradle.kts deleted file mode 100644 index 2a8c853..0000000 --- a/revanced-patcher/settings.gradle.kts +++ /dev/null @@ -1 +0,0 @@ -rootProject.name = "revanced-patcher" \ No newline at end of file diff --git a/settings.gradle.kts b/settings.gradle.kts index 5c99423..2a8c853 100644 --- a/settings.gradle.kts +++ b/settings.gradle.kts @@ -1 +1 @@ -include("revanced-patcher") +rootProject.name = "revanced-patcher" \ No newline at end of file diff --git a/revanced-patcher/src/main/kotlin/app/revanced/patcher/IntegrationsConsumer.kt b/src/main/kotlin/app/revanced/patcher/IntegrationsConsumer.kt similarity index 100% rename from revanced-patcher/src/main/kotlin/app/revanced/patcher/IntegrationsConsumer.kt rename to src/main/kotlin/app/revanced/patcher/IntegrationsConsumer.kt diff --git a/revanced-patcher/src/main/kotlin/app/revanced/patcher/PackageMetadata.kt b/src/main/kotlin/app/revanced/patcher/PackageMetadata.kt similarity index 100% rename from revanced-patcher/src/main/kotlin/app/revanced/patcher/PackageMetadata.kt rename to src/main/kotlin/app/revanced/patcher/PackageMetadata.kt diff --git a/revanced-patcher/src/main/kotlin/app/revanced/patcher/PatchBundleLoader.kt b/src/main/kotlin/app/revanced/patcher/PatchBundleLoader.kt similarity index 100% rename from revanced-patcher/src/main/kotlin/app/revanced/patcher/PatchBundleLoader.kt rename to src/main/kotlin/app/revanced/patcher/PatchBundleLoader.kt diff --git a/revanced-patcher/src/main/kotlin/app/revanced/patcher/PatchExecutorFunction.kt b/src/main/kotlin/app/revanced/patcher/PatchExecutorFunction.kt similarity index 100% rename from revanced-patcher/src/main/kotlin/app/revanced/patcher/PatchExecutorFunction.kt rename to src/main/kotlin/app/revanced/patcher/PatchExecutorFunction.kt diff --git a/revanced-patcher/src/main/kotlin/app/revanced/patcher/Patcher.kt b/src/main/kotlin/app/revanced/patcher/Patcher.kt similarity index 100% rename from revanced-patcher/src/main/kotlin/app/revanced/patcher/Patcher.kt rename to src/main/kotlin/app/revanced/patcher/Patcher.kt diff --git a/revanced-patcher/src/main/kotlin/app/revanced/patcher/PatcherContext.kt b/src/main/kotlin/app/revanced/patcher/PatcherContext.kt similarity index 100% rename from revanced-patcher/src/main/kotlin/app/revanced/patcher/PatcherContext.kt rename to src/main/kotlin/app/revanced/patcher/PatcherContext.kt diff --git a/revanced-patcher/src/main/kotlin/app/revanced/patcher/PatcherException.kt b/src/main/kotlin/app/revanced/patcher/PatcherException.kt similarity index 100% rename from revanced-patcher/src/main/kotlin/app/revanced/patcher/PatcherException.kt rename to src/main/kotlin/app/revanced/patcher/PatcherException.kt diff --git a/revanced-patcher/src/main/kotlin/app/revanced/patcher/PatcherOptions.kt b/src/main/kotlin/app/revanced/patcher/PatcherOptions.kt similarity index 100% rename from revanced-patcher/src/main/kotlin/app/revanced/patcher/PatcherOptions.kt rename to src/main/kotlin/app/revanced/patcher/PatcherOptions.kt diff --git a/revanced-patcher/src/main/kotlin/app/revanced/patcher/PatcherResult.kt b/src/main/kotlin/app/revanced/patcher/PatcherResult.kt similarity index 100% rename from revanced-patcher/src/main/kotlin/app/revanced/patcher/PatcherResult.kt rename to src/main/kotlin/app/revanced/patcher/PatcherResult.kt diff --git a/revanced-patcher/src/main/kotlin/app/revanced/patcher/PatchesConsumer.kt b/src/main/kotlin/app/revanced/patcher/PatchesConsumer.kt similarity index 100% rename from revanced-patcher/src/main/kotlin/app/revanced/patcher/PatchesConsumer.kt rename to src/main/kotlin/app/revanced/patcher/PatchesConsumer.kt diff --git a/revanced-patcher/src/main/kotlin/app/revanced/patcher/data/BytecodeContext.kt b/src/main/kotlin/app/revanced/patcher/data/BytecodeContext.kt similarity index 100% rename from revanced-patcher/src/main/kotlin/app/revanced/patcher/data/BytecodeContext.kt rename to src/main/kotlin/app/revanced/patcher/data/BytecodeContext.kt diff --git a/revanced-patcher/src/main/kotlin/app/revanced/patcher/data/Context.kt b/src/main/kotlin/app/revanced/patcher/data/Context.kt similarity index 100% rename from revanced-patcher/src/main/kotlin/app/revanced/patcher/data/Context.kt rename to src/main/kotlin/app/revanced/patcher/data/Context.kt diff --git a/revanced-patcher/src/main/kotlin/app/revanced/patcher/data/ResourceContext.kt b/src/main/kotlin/app/revanced/patcher/data/ResourceContext.kt similarity index 100% rename from revanced-patcher/src/main/kotlin/app/revanced/patcher/data/ResourceContext.kt rename to src/main/kotlin/app/revanced/patcher/data/ResourceContext.kt diff --git a/revanced-patcher/src/main/kotlin/app/revanced/patcher/extensions/AnnotationExtensions.kt b/src/main/kotlin/app/revanced/patcher/extensions/AnnotationExtensions.kt similarity index 100% rename from revanced-patcher/src/main/kotlin/app/revanced/patcher/extensions/AnnotationExtensions.kt rename to src/main/kotlin/app/revanced/patcher/extensions/AnnotationExtensions.kt diff --git a/revanced-patcher/src/main/kotlin/app/revanced/patcher/extensions/Extensions.kt b/src/main/kotlin/app/revanced/patcher/extensions/Extensions.kt similarity index 100% rename from revanced-patcher/src/main/kotlin/app/revanced/patcher/extensions/Extensions.kt rename to src/main/kotlin/app/revanced/patcher/extensions/Extensions.kt diff --git a/revanced-patcher/src/main/kotlin/app/revanced/patcher/extensions/InstructionExtensions.kt b/src/main/kotlin/app/revanced/patcher/extensions/InstructionExtensions.kt similarity index 100% rename from revanced-patcher/src/main/kotlin/app/revanced/patcher/extensions/InstructionExtensions.kt rename to src/main/kotlin/app/revanced/patcher/extensions/InstructionExtensions.kt diff --git a/revanced-patcher/src/main/kotlin/app/revanced/patcher/extensions/MethodFingerprintExtensions.kt b/src/main/kotlin/app/revanced/patcher/extensions/MethodFingerprintExtensions.kt similarity index 100% rename from revanced-patcher/src/main/kotlin/app/revanced/patcher/extensions/MethodFingerprintExtensions.kt rename to src/main/kotlin/app/revanced/patcher/extensions/MethodFingerprintExtensions.kt diff --git a/revanced-patcher/src/main/kotlin/app/revanced/patcher/fingerprint/Fingerprint.kt b/src/main/kotlin/app/revanced/patcher/fingerprint/Fingerprint.kt similarity index 100% rename from revanced-patcher/src/main/kotlin/app/revanced/patcher/fingerprint/Fingerprint.kt rename to src/main/kotlin/app/revanced/patcher/fingerprint/Fingerprint.kt diff --git a/revanced-patcher/src/main/kotlin/app/revanced/patcher/fingerprint/method/annotation/MethodFingerprintMetadata.kt b/src/main/kotlin/app/revanced/patcher/fingerprint/method/annotation/MethodFingerprintMetadata.kt similarity index 100% rename from revanced-patcher/src/main/kotlin/app/revanced/patcher/fingerprint/method/annotation/MethodFingerprintMetadata.kt rename to src/main/kotlin/app/revanced/patcher/fingerprint/method/annotation/MethodFingerprintMetadata.kt diff --git a/revanced-patcher/src/main/kotlin/app/revanced/patcher/fingerprint/method/impl/MethodFingerprint.kt b/src/main/kotlin/app/revanced/patcher/fingerprint/method/impl/MethodFingerprint.kt similarity index 100% rename from revanced-patcher/src/main/kotlin/app/revanced/patcher/fingerprint/method/impl/MethodFingerprint.kt rename to src/main/kotlin/app/revanced/patcher/fingerprint/method/impl/MethodFingerprint.kt diff --git a/revanced-patcher/src/main/kotlin/app/revanced/patcher/logging/Logger.kt b/src/main/kotlin/app/revanced/patcher/logging/Logger.kt similarity index 100% rename from revanced-patcher/src/main/kotlin/app/revanced/patcher/logging/Logger.kt rename to src/main/kotlin/app/revanced/patcher/logging/Logger.kt diff --git a/revanced-patcher/src/main/kotlin/app/revanced/patcher/logging/impl/NopLogger.kt b/src/main/kotlin/app/revanced/patcher/logging/impl/NopLogger.kt similarity index 100% rename from revanced-patcher/src/main/kotlin/app/revanced/patcher/logging/impl/NopLogger.kt rename to src/main/kotlin/app/revanced/patcher/logging/impl/NopLogger.kt diff --git a/revanced-patcher/src/main/kotlin/app/revanced/patcher/patch/BytecodePatch.kt b/src/main/kotlin/app/revanced/patcher/patch/BytecodePatch.kt similarity index 100% rename from revanced-patcher/src/main/kotlin/app/revanced/patcher/patch/BytecodePatch.kt rename to src/main/kotlin/app/revanced/patcher/patch/BytecodePatch.kt diff --git a/revanced-patcher/src/main/kotlin/app/revanced/patcher/patch/Patch.kt b/src/main/kotlin/app/revanced/patcher/patch/Patch.kt similarity index 100% rename from revanced-patcher/src/main/kotlin/app/revanced/patcher/patch/Patch.kt rename to src/main/kotlin/app/revanced/patcher/patch/Patch.kt diff --git a/revanced-patcher/src/main/kotlin/app/revanced/patcher/patch/PatchException.kt b/src/main/kotlin/app/revanced/patcher/patch/PatchException.kt similarity index 100% rename from revanced-patcher/src/main/kotlin/app/revanced/patcher/patch/PatchException.kt rename to src/main/kotlin/app/revanced/patcher/patch/PatchException.kt diff --git a/revanced-patcher/src/main/kotlin/app/revanced/patcher/patch/PatchResult.kt b/src/main/kotlin/app/revanced/patcher/patch/PatchResult.kt similarity index 100% rename from revanced-patcher/src/main/kotlin/app/revanced/patcher/patch/PatchResult.kt rename to src/main/kotlin/app/revanced/patcher/patch/PatchResult.kt diff --git a/revanced-patcher/src/main/kotlin/app/revanced/patcher/patch/ResourcePatch.kt b/src/main/kotlin/app/revanced/patcher/patch/ResourcePatch.kt similarity index 100% rename from revanced-patcher/src/main/kotlin/app/revanced/patcher/patch/ResourcePatch.kt rename to src/main/kotlin/app/revanced/patcher/patch/ResourcePatch.kt diff --git a/revanced-patcher/src/main/kotlin/app/revanced/patcher/patch/annotation/PatchAnnotations.kt b/src/main/kotlin/app/revanced/patcher/patch/annotation/PatchAnnotations.kt similarity index 100% rename from revanced-patcher/src/main/kotlin/app/revanced/patcher/patch/annotation/PatchAnnotations.kt rename to src/main/kotlin/app/revanced/patcher/patch/annotation/PatchAnnotations.kt diff --git a/revanced-patcher/src/main/kotlin/app/revanced/patcher/patch/options/PatchOption.kt b/src/main/kotlin/app/revanced/patcher/patch/options/PatchOption.kt similarity index 100% rename from revanced-patcher/src/main/kotlin/app/revanced/patcher/patch/options/PatchOption.kt rename to src/main/kotlin/app/revanced/patcher/patch/options/PatchOption.kt diff --git a/revanced-patcher/src/main/kotlin/app/revanced/patcher/patch/options/PatchOptionException.kt b/src/main/kotlin/app/revanced/patcher/patch/options/PatchOptionException.kt similarity index 100% rename from revanced-patcher/src/main/kotlin/app/revanced/patcher/patch/options/PatchOptionException.kt rename to src/main/kotlin/app/revanced/patcher/patch/options/PatchOptionException.kt diff --git a/revanced-patcher/src/main/kotlin/app/revanced/patcher/patch/options/PatchOptions.kt b/src/main/kotlin/app/revanced/patcher/patch/options/PatchOptions.kt similarity index 100% rename from revanced-patcher/src/main/kotlin/app/revanced/patcher/patch/options/PatchOptions.kt rename to src/main/kotlin/app/revanced/patcher/patch/options/PatchOptions.kt diff --git a/revanced-patcher/src/main/kotlin/app/revanced/patcher/patch/options/types/BooleanPatchOption.kt b/src/main/kotlin/app/revanced/patcher/patch/options/types/BooleanPatchOption.kt similarity index 100% rename from revanced-patcher/src/main/kotlin/app/revanced/patcher/patch/options/types/BooleanPatchOption.kt rename to src/main/kotlin/app/revanced/patcher/patch/options/types/BooleanPatchOption.kt diff --git a/revanced-patcher/src/main/kotlin/app/revanced/patcher/patch/options/types/FloatPatchOption.kt b/src/main/kotlin/app/revanced/patcher/patch/options/types/FloatPatchOption.kt similarity index 100% rename from revanced-patcher/src/main/kotlin/app/revanced/patcher/patch/options/types/FloatPatchOption.kt rename to src/main/kotlin/app/revanced/patcher/patch/options/types/FloatPatchOption.kt diff --git a/revanced-patcher/src/main/kotlin/app/revanced/patcher/patch/options/types/IntPatchOption.kt b/src/main/kotlin/app/revanced/patcher/patch/options/types/IntPatchOption.kt similarity index 100% rename from revanced-patcher/src/main/kotlin/app/revanced/patcher/patch/options/types/IntPatchOption.kt rename to src/main/kotlin/app/revanced/patcher/patch/options/types/IntPatchOption.kt diff --git a/revanced-patcher/src/main/kotlin/app/revanced/patcher/patch/options/types/LongPatchOption.kt b/src/main/kotlin/app/revanced/patcher/patch/options/types/LongPatchOption.kt similarity index 100% rename from revanced-patcher/src/main/kotlin/app/revanced/patcher/patch/options/types/LongPatchOption.kt rename to src/main/kotlin/app/revanced/patcher/patch/options/types/LongPatchOption.kt diff --git a/revanced-patcher/src/main/kotlin/app/revanced/patcher/patch/options/types/StringPatchOption.kt b/src/main/kotlin/app/revanced/patcher/patch/options/types/StringPatchOption.kt similarity index 100% rename from revanced-patcher/src/main/kotlin/app/revanced/patcher/patch/options/types/StringPatchOption.kt rename to src/main/kotlin/app/revanced/patcher/patch/options/types/StringPatchOption.kt diff --git a/revanced-patcher/src/main/kotlin/app/revanced/patcher/patch/options/types/array/BooleanArrayPatchOption.kt b/src/main/kotlin/app/revanced/patcher/patch/options/types/array/BooleanArrayPatchOption.kt similarity index 100% rename from revanced-patcher/src/main/kotlin/app/revanced/patcher/patch/options/types/array/BooleanArrayPatchOption.kt rename to src/main/kotlin/app/revanced/patcher/patch/options/types/array/BooleanArrayPatchOption.kt diff --git a/revanced-patcher/src/main/kotlin/app/revanced/patcher/patch/options/types/array/FloatArrayPatchOption.kt b/src/main/kotlin/app/revanced/patcher/patch/options/types/array/FloatArrayPatchOption.kt similarity index 100% rename from revanced-patcher/src/main/kotlin/app/revanced/patcher/patch/options/types/array/FloatArrayPatchOption.kt rename to src/main/kotlin/app/revanced/patcher/patch/options/types/array/FloatArrayPatchOption.kt diff --git a/revanced-patcher/src/main/kotlin/app/revanced/patcher/patch/options/types/array/IntArrayPatchOption.kt b/src/main/kotlin/app/revanced/patcher/patch/options/types/array/IntArrayPatchOption.kt similarity index 100% rename from revanced-patcher/src/main/kotlin/app/revanced/patcher/patch/options/types/array/IntArrayPatchOption.kt rename to src/main/kotlin/app/revanced/patcher/patch/options/types/array/IntArrayPatchOption.kt diff --git a/revanced-patcher/src/main/kotlin/app/revanced/patcher/patch/options/types/array/LongArrayPatchOption.kt b/src/main/kotlin/app/revanced/patcher/patch/options/types/array/LongArrayPatchOption.kt similarity index 100% rename from revanced-patcher/src/main/kotlin/app/revanced/patcher/patch/options/types/array/LongArrayPatchOption.kt rename to src/main/kotlin/app/revanced/patcher/patch/options/types/array/LongArrayPatchOption.kt diff --git a/revanced-patcher/src/main/kotlin/app/revanced/patcher/patch/options/types/array/StringArrayPatchOption.kt b/src/main/kotlin/app/revanced/patcher/patch/options/types/array/StringArrayPatchOption.kt similarity index 100% rename from revanced-patcher/src/main/kotlin/app/revanced/patcher/patch/options/types/array/StringArrayPatchOption.kt rename to src/main/kotlin/app/revanced/patcher/patch/options/types/array/StringArrayPatchOption.kt diff --git a/revanced-patcher/src/main/kotlin/app/revanced/patcher/util/ClassMerger.kt b/src/main/kotlin/app/revanced/patcher/util/ClassMerger.kt similarity index 100% rename from revanced-patcher/src/main/kotlin/app/revanced/patcher/util/ClassMerger.kt rename to src/main/kotlin/app/revanced/patcher/util/ClassMerger.kt diff --git a/revanced-patcher/src/main/kotlin/app/revanced/patcher/util/DomFileEditor.kt b/src/main/kotlin/app/revanced/patcher/util/DomFileEditor.kt similarity index 100% rename from revanced-patcher/src/main/kotlin/app/revanced/patcher/util/DomFileEditor.kt rename to src/main/kotlin/app/revanced/patcher/util/DomFileEditor.kt diff --git a/revanced-patcher/src/main/kotlin/app/revanced/patcher/util/ProxyClassList.kt b/src/main/kotlin/app/revanced/patcher/util/ProxyClassList.kt similarity index 100% rename from revanced-patcher/src/main/kotlin/app/revanced/patcher/util/ProxyClassList.kt rename to src/main/kotlin/app/revanced/patcher/util/ProxyClassList.kt diff --git a/revanced-patcher/src/main/kotlin/app/revanced/patcher/util/method/MethodWalker.kt b/src/main/kotlin/app/revanced/patcher/util/method/MethodWalker.kt similarity index 100% rename from revanced-patcher/src/main/kotlin/app/revanced/patcher/util/method/MethodWalker.kt rename to src/main/kotlin/app/revanced/patcher/util/method/MethodWalker.kt diff --git a/revanced-patcher/src/main/kotlin/app/revanced/patcher/util/proxy/ClassProxy.kt b/src/main/kotlin/app/revanced/patcher/util/proxy/ClassProxy.kt similarity index 100% rename from revanced-patcher/src/main/kotlin/app/revanced/patcher/util/proxy/ClassProxy.kt rename to src/main/kotlin/app/revanced/patcher/util/proxy/ClassProxy.kt diff --git a/revanced-patcher/src/main/kotlin/app/revanced/patcher/util/proxy/mutableTypes/MutableAnnotation.kt b/src/main/kotlin/app/revanced/patcher/util/proxy/mutableTypes/MutableAnnotation.kt similarity index 100% rename from revanced-patcher/src/main/kotlin/app/revanced/patcher/util/proxy/mutableTypes/MutableAnnotation.kt rename to src/main/kotlin/app/revanced/patcher/util/proxy/mutableTypes/MutableAnnotation.kt diff --git a/revanced-patcher/src/main/kotlin/app/revanced/patcher/util/proxy/mutableTypes/MutableAnnotationElement.kt b/src/main/kotlin/app/revanced/patcher/util/proxy/mutableTypes/MutableAnnotationElement.kt similarity index 100% rename from revanced-patcher/src/main/kotlin/app/revanced/patcher/util/proxy/mutableTypes/MutableAnnotationElement.kt rename to src/main/kotlin/app/revanced/patcher/util/proxy/mutableTypes/MutableAnnotationElement.kt diff --git a/revanced-patcher/src/main/kotlin/app/revanced/patcher/util/proxy/mutableTypes/MutableClass.kt b/src/main/kotlin/app/revanced/patcher/util/proxy/mutableTypes/MutableClass.kt similarity index 100% rename from revanced-patcher/src/main/kotlin/app/revanced/patcher/util/proxy/mutableTypes/MutableClass.kt rename to src/main/kotlin/app/revanced/patcher/util/proxy/mutableTypes/MutableClass.kt diff --git a/revanced-patcher/src/main/kotlin/app/revanced/patcher/util/proxy/mutableTypes/MutableField.kt b/src/main/kotlin/app/revanced/patcher/util/proxy/mutableTypes/MutableField.kt similarity index 100% rename from revanced-patcher/src/main/kotlin/app/revanced/patcher/util/proxy/mutableTypes/MutableField.kt rename to src/main/kotlin/app/revanced/patcher/util/proxy/mutableTypes/MutableField.kt diff --git a/revanced-patcher/src/main/kotlin/app/revanced/patcher/util/proxy/mutableTypes/MutableMethod.kt b/src/main/kotlin/app/revanced/patcher/util/proxy/mutableTypes/MutableMethod.kt similarity index 100% rename from revanced-patcher/src/main/kotlin/app/revanced/patcher/util/proxy/mutableTypes/MutableMethod.kt rename to src/main/kotlin/app/revanced/patcher/util/proxy/mutableTypes/MutableMethod.kt diff --git a/revanced-patcher/src/main/kotlin/app/revanced/patcher/util/proxy/mutableTypes/MutableMethodParameter.kt b/src/main/kotlin/app/revanced/patcher/util/proxy/mutableTypes/MutableMethodParameter.kt similarity index 100% rename from revanced-patcher/src/main/kotlin/app/revanced/patcher/util/proxy/mutableTypes/MutableMethodParameter.kt rename to src/main/kotlin/app/revanced/patcher/util/proxy/mutableTypes/MutableMethodParameter.kt diff --git a/revanced-patcher/src/main/kotlin/app/revanced/patcher/util/proxy/mutableTypes/encodedValue/MutableAnnotationEncodedValue.kt b/src/main/kotlin/app/revanced/patcher/util/proxy/mutableTypes/encodedValue/MutableAnnotationEncodedValue.kt similarity index 100% rename from revanced-patcher/src/main/kotlin/app/revanced/patcher/util/proxy/mutableTypes/encodedValue/MutableAnnotationEncodedValue.kt rename to src/main/kotlin/app/revanced/patcher/util/proxy/mutableTypes/encodedValue/MutableAnnotationEncodedValue.kt diff --git a/revanced-patcher/src/main/kotlin/app/revanced/patcher/util/proxy/mutableTypes/encodedValue/MutableArrayEncodedValue.kt b/src/main/kotlin/app/revanced/patcher/util/proxy/mutableTypes/encodedValue/MutableArrayEncodedValue.kt similarity index 100% rename from revanced-patcher/src/main/kotlin/app/revanced/patcher/util/proxy/mutableTypes/encodedValue/MutableArrayEncodedValue.kt rename to src/main/kotlin/app/revanced/patcher/util/proxy/mutableTypes/encodedValue/MutableArrayEncodedValue.kt diff --git a/revanced-patcher/src/main/kotlin/app/revanced/patcher/util/proxy/mutableTypes/encodedValue/MutableBooleanEncodedValue.kt b/src/main/kotlin/app/revanced/patcher/util/proxy/mutableTypes/encodedValue/MutableBooleanEncodedValue.kt similarity index 100% rename from revanced-patcher/src/main/kotlin/app/revanced/patcher/util/proxy/mutableTypes/encodedValue/MutableBooleanEncodedValue.kt rename to src/main/kotlin/app/revanced/patcher/util/proxy/mutableTypes/encodedValue/MutableBooleanEncodedValue.kt diff --git a/revanced-patcher/src/main/kotlin/app/revanced/patcher/util/proxy/mutableTypes/encodedValue/MutableByteEncodedValue.kt b/src/main/kotlin/app/revanced/patcher/util/proxy/mutableTypes/encodedValue/MutableByteEncodedValue.kt similarity index 100% rename from revanced-patcher/src/main/kotlin/app/revanced/patcher/util/proxy/mutableTypes/encodedValue/MutableByteEncodedValue.kt rename to src/main/kotlin/app/revanced/patcher/util/proxy/mutableTypes/encodedValue/MutableByteEncodedValue.kt diff --git a/revanced-patcher/src/main/kotlin/app/revanced/patcher/util/proxy/mutableTypes/encodedValue/MutableCharEncodedValue.kt b/src/main/kotlin/app/revanced/patcher/util/proxy/mutableTypes/encodedValue/MutableCharEncodedValue.kt similarity index 100% rename from revanced-patcher/src/main/kotlin/app/revanced/patcher/util/proxy/mutableTypes/encodedValue/MutableCharEncodedValue.kt rename to src/main/kotlin/app/revanced/patcher/util/proxy/mutableTypes/encodedValue/MutableCharEncodedValue.kt diff --git a/revanced-patcher/src/main/kotlin/app/revanced/patcher/util/proxy/mutableTypes/encodedValue/MutableDoubleEncodedValue.kt b/src/main/kotlin/app/revanced/patcher/util/proxy/mutableTypes/encodedValue/MutableDoubleEncodedValue.kt similarity index 100% rename from revanced-patcher/src/main/kotlin/app/revanced/patcher/util/proxy/mutableTypes/encodedValue/MutableDoubleEncodedValue.kt rename to src/main/kotlin/app/revanced/patcher/util/proxy/mutableTypes/encodedValue/MutableDoubleEncodedValue.kt diff --git a/revanced-patcher/src/main/kotlin/app/revanced/patcher/util/proxy/mutableTypes/encodedValue/MutableEncodedValue.kt b/src/main/kotlin/app/revanced/patcher/util/proxy/mutableTypes/encodedValue/MutableEncodedValue.kt similarity index 100% rename from revanced-patcher/src/main/kotlin/app/revanced/patcher/util/proxy/mutableTypes/encodedValue/MutableEncodedValue.kt rename to src/main/kotlin/app/revanced/patcher/util/proxy/mutableTypes/encodedValue/MutableEncodedValue.kt diff --git a/revanced-patcher/src/main/kotlin/app/revanced/patcher/util/proxy/mutableTypes/encodedValue/MutableEnumEncodedValue.kt b/src/main/kotlin/app/revanced/patcher/util/proxy/mutableTypes/encodedValue/MutableEnumEncodedValue.kt similarity index 100% rename from revanced-patcher/src/main/kotlin/app/revanced/patcher/util/proxy/mutableTypes/encodedValue/MutableEnumEncodedValue.kt rename to src/main/kotlin/app/revanced/patcher/util/proxy/mutableTypes/encodedValue/MutableEnumEncodedValue.kt diff --git a/revanced-patcher/src/main/kotlin/app/revanced/patcher/util/proxy/mutableTypes/encodedValue/MutableFieldEncodedValue.kt b/src/main/kotlin/app/revanced/patcher/util/proxy/mutableTypes/encodedValue/MutableFieldEncodedValue.kt similarity index 100% rename from revanced-patcher/src/main/kotlin/app/revanced/patcher/util/proxy/mutableTypes/encodedValue/MutableFieldEncodedValue.kt rename to src/main/kotlin/app/revanced/patcher/util/proxy/mutableTypes/encodedValue/MutableFieldEncodedValue.kt diff --git a/revanced-patcher/src/main/kotlin/app/revanced/patcher/util/proxy/mutableTypes/encodedValue/MutableFloatEncodedValue.kt b/src/main/kotlin/app/revanced/patcher/util/proxy/mutableTypes/encodedValue/MutableFloatEncodedValue.kt similarity index 100% rename from revanced-patcher/src/main/kotlin/app/revanced/patcher/util/proxy/mutableTypes/encodedValue/MutableFloatEncodedValue.kt rename to src/main/kotlin/app/revanced/patcher/util/proxy/mutableTypes/encodedValue/MutableFloatEncodedValue.kt diff --git a/revanced-patcher/src/main/kotlin/app/revanced/patcher/util/proxy/mutableTypes/encodedValue/MutableIntEncodedValue.kt b/src/main/kotlin/app/revanced/patcher/util/proxy/mutableTypes/encodedValue/MutableIntEncodedValue.kt similarity index 100% rename from revanced-patcher/src/main/kotlin/app/revanced/patcher/util/proxy/mutableTypes/encodedValue/MutableIntEncodedValue.kt rename to src/main/kotlin/app/revanced/patcher/util/proxy/mutableTypes/encodedValue/MutableIntEncodedValue.kt diff --git a/revanced-patcher/src/main/kotlin/app/revanced/patcher/util/proxy/mutableTypes/encodedValue/MutableLongEncodedValue.kt b/src/main/kotlin/app/revanced/patcher/util/proxy/mutableTypes/encodedValue/MutableLongEncodedValue.kt similarity index 100% rename from revanced-patcher/src/main/kotlin/app/revanced/patcher/util/proxy/mutableTypes/encodedValue/MutableLongEncodedValue.kt rename to src/main/kotlin/app/revanced/patcher/util/proxy/mutableTypes/encodedValue/MutableLongEncodedValue.kt diff --git a/revanced-patcher/src/main/kotlin/app/revanced/patcher/util/proxy/mutableTypes/encodedValue/MutableMethodEncodedValue.kt b/src/main/kotlin/app/revanced/patcher/util/proxy/mutableTypes/encodedValue/MutableMethodEncodedValue.kt similarity index 100% rename from revanced-patcher/src/main/kotlin/app/revanced/patcher/util/proxy/mutableTypes/encodedValue/MutableMethodEncodedValue.kt rename to src/main/kotlin/app/revanced/patcher/util/proxy/mutableTypes/encodedValue/MutableMethodEncodedValue.kt diff --git a/revanced-patcher/src/main/kotlin/app/revanced/patcher/util/proxy/mutableTypes/encodedValue/MutableMethodHandleEncodedValue.kt b/src/main/kotlin/app/revanced/patcher/util/proxy/mutableTypes/encodedValue/MutableMethodHandleEncodedValue.kt similarity index 100% rename from revanced-patcher/src/main/kotlin/app/revanced/patcher/util/proxy/mutableTypes/encodedValue/MutableMethodHandleEncodedValue.kt rename to src/main/kotlin/app/revanced/patcher/util/proxy/mutableTypes/encodedValue/MutableMethodHandleEncodedValue.kt diff --git a/revanced-patcher/src/main/kotlin/app/revanced/patcher/util/proxy/mutableTypes/encodedValue/MutableMethodTypeEncodedValue.kt b/src/main/kotlin/app/revanced/patcher/util/proxy/mutableTypes/encodedValue/MutableMethodTypeEncodedValue.kt similarity index 100% rename from revanced-patcher/src/main/kotlin/app/revanced/patcher/util/proxy/mutableTypes/encodedValue/MutableMethodTypeEncodedValue.kt rename to src/main/kotlin/app/revanced/patcher/util/proxy/mutableTypes/encodedValue/MutableMethodTypeEncodedValue.kt diff --git a/revanced-patcher/src/main/kotlin/app/revanced/patcher/util/proxy/mutableTypes/encodedValue/MutableNullEncodedValue.kt b/src/main/kotlin/app/revanced/patcher/util/proxy/mutableTypes/encodedValue/MutableNullEncodedValue.kt similarity index 100% rename from revanced-patcher/src/main/kotlin/app/revanced/patcher/util/proxy/mutableTypes/encodedValue/MutableNullEncodedValue.kt rename to src/main/kotlin/app/revanced/patcher/util/proxy/mutableTypes/encodedValue/MutableNullEncodedValue.kt diff --git a/revanced-patcher/src/main/kotlin/app/revanced/patcher/util/proxy/mutableTypes/encodedValue/MutableShortEncodedValue.kt b/src/main/kotlin/app/revanced/patcher/util/proxy/mutableTypes/encodedValue/MutableShortEncodedValue.kt similarity index 100% rename from revanced-patcher/src/main/kotlin/app/revanced/patcher/util/proxy/mutableTypes/encodedValue/MutableShortEncodedValue.kt rename to src/main/kotlin/app/revanced/patcher/util/proxy/mutableTypes/encodedValue/MutableShortEncodedValue.kt diff --git a/revanced-patcher/src/main/kotlin/app/revanced/patcher/util/proxy/mutableTypes/encodedValue/MutableStringEncodedValue.kt b/src/main/kotlin/app/revanced/patcher/util/proxy/mutableTypes/encodedValue/MutableStringEncodedValue.kt similarity index 100% rename from revanced-patcher/src/main/kotlin/app/revanced/patcher/util/proxy/mutableTypes/encodedValue/MutableStringEncodedValue.kt rename to src/main/kotlin/app/revanced/patcher/util/proxy/mutableTypes/encodedValue/MutableStringEncodedValue.kt diff --git a/revanced-patcher/src/main/kotlin/app/revanced/patcher/util/proxy/mutableTypes/encodedValue/MutableTypeEncodedValue.kt b/src/main/kotlin/app/revanced/patcher/util/proxy/mutableTypes/encodedValue/MutableTypeEncodedValue.kt similarity index 100% rename from revanced-patcher/src/main/kotlin/app/revanced/patcher/util/proxy/mutableTypes/encodedValue/MutableTypeEncodedValue.kt rename to src/main/kotlin/app/revanced/patcher/util/proxy/mutableTypes/encodedValue/MutableTypeEncodedValue.kt diff --git a/revanced-patcher/src/main/kotlin/app/revanced/patcher/util/smali/ExternalLabel.kt b/src/main/kotlin/app/revanced/patcher/util/smali/ExternalLabel.kt similarity index 100% rename from revanced-patcher/src/main/kotlin/app/revanced/patcher/util/smali/ExternalLabel.kt rename to src/main/kotlin/app/revanced/patcher/util/smali/ExternalLabel.kt diff --git a/revanced-patcher/src/main/kotlin/app/revanced/patcher/util/smali/InlineSmaliCompiler.kt b/src/main/kotlin/app/revanced/patcher/util/smali/InlineSmaliCompiler.kt similarity index 100% rename from revanced-patcher/src/main/kotlin/app/revanced/patcher/util/smali/InlineSmaliCompiler.kt rename to src/main/kotlin/app/revanced/patcher/util/smali/InlineSmaliCompiler.kt diff --git a/revanced-patcher/src/main/resources/app/revanced/patcher/version.properties b/src/main/resources/app/revanced/patcher/version.properties similarity index 100% rename from revanced-patcher/src/main/resources/app/revanced/patcher/version.properties rename to src/main/resources/app/revanced/patcher/version.properties diff --git a/revanced-patcher/src/test/kotlin/app/revanced/patcher/extensions/InstructionExtensionsTest.kt b/src/test/kotlin/app/revanced/patcher/extensions/InstructionExtensionsTest.kt similarity index 100% rename from revanced-patcher/src/test/kotlin/app/revanced/patcher/extensions/InstructionExtensionsTest.kt rename to src/test/kotlin/app/revanced/patcher/extensions/InstructionExtensionsTest.kt diff --git a/revanced-patcher/src/test/kotlin/app/revanced/patcher/patch/options/PatchOptionsTest.kt b/src/test/kotlin/app/revanced/patcher/patch/options/PatchOptionsTest.kt similarity index 100% rename from revanced-patcher/src/test/kotlin/app/revanced/patcher/patch/options/PatchOptionsTest.kt rename to src/test/kotlin/app/revanced/patcher/patch/options/PatchOptionsTest.kt diff --git a/revanced-patcher/src/test/kotlin/app/revanced/patcher/patch/usage/ExampleBytecodePatch.kt b/src/test/kotlin/app/revanced/patcher/patch/usage/ExampleBytecodePatch.kt similarity index 100% rename from revanced-patcher/src/test/kotlin/app/revanced/patcher/patch/usage/ExampleBytecodePatch.kt rename to src/test/kotlin/app/revanced/patcher/patch/usage/ExampleBytecodePatch.kt diff --git a/revanced-patcher/src/test/kotlin/app/revanced/patcher/patch/usage/ExampleFingerprint.kt b/src/test/kotlin/app/revanced/patcher/patch/usage/ExampleFingerprint.kt similarity index 100% rename from revanced-patcher/src/test/kotlin/app/revanced/patcher/patch/usage/ExampleFingerprint.kt rename to src/test/kotlin/app/revanced/patcher/patch/usage/ExampleFingerprint.kt diff --git a/revanced-patcher/src/test/kotlin/app/revanced/patcher/patch/usage/ExampleResourcePatch.kt b/src/test/kotlin/app/revanced/patcher/patch/usage/ExampleResourcePatch.kt similarity index 100% rename from revanced-patcher/src/test/kotlin/app/revanced/patcher/patch/usage/ExampleResourcePatch.kt rename to src/test/kotlin/app/revanced/patcher/patch/usage/ExampleResourcePatch.kt diff --git a/revanced-patcher/src/test/kotlin/app/revanced/patcher/util/smali/InlineSmaliCompilerTest.kt b/src/test/kotlin/app/revanced/patcher/util/smali/InlineSmaliCompilerTest.kt similarity index 100% rename from revanced-patcher/src/test/kotlin/app/revanced/patcher/util/smali/InlineSmaliCompilerTest.kt rename to src/test/kotlin/app/revanced/patcher/util/smali/InlineSmaliCompilerTest.kt From 155e787ff4c64cc932fc410d55e763da8720cecc Mon Sep 17 00:00:00 2001 From: semantic-release-bot Date: Sat, 14 Oct 2023 18:43:40 +0000 Subject: [PATCH 06/36] chore(release): 18.0.0-dev.1 [skip ci] # [18.0.0-dev.1](https://github.com/ReVanced/revanced-patcher/compare/v17.0.1-dev.1...v18.0.0-dev.1) (2023-10-14) ### Features * Remove patch annotation processor ([4456031](https://github.com/ReVanced/revanced-patcher/commit/445603145979a6f67823a79f9d6cd140299cff37)) ### BREAKING CHANGES * Various patch constructor signatures have changed. --- CHANGELOG.md | 12 ++++++++++++ gradle.properties | 2 +- 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 97a63a5..43b9c56 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,15 @@ +# [18.0.0-dev.1](https://github.com/ReVanced/revanced-patcher/compare/v17.0.1-dev.1...v18.0.0-dev.1) (2023-10-14) + + +### Features + +* Remove patch annotation processor ([4456031](https://github.com/ReVanced/revanced-patcher/commit/445603145979a6f67823a79f9d6cd140299cff37)) + + +### BREAKING CHANGES + +* Various patch constructor signatures have changed. + ## [17.0.1-dev.1](https://github.com/ReVanced/revanced-patcher/compare/v17.0.0...v17.0.1-dev.1) (2023-10-10) diff --git a/gradle.properties b/gradle.properties index 0276c9a..62752a0 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,4 +1,4 @@ org.gradle.parallel = true org.gradle.caching = true kotlin.code.style = official -version = 17.0.1-dev.1 +version = 18.0.0-dev.1 From f28bfe0dbde8a7db87b521aa055df9665b4a4630 Mon Sep 17 00:00:00 2001 From: oSumAtrIX Date: Sat, 21 Oct 2023 23:49:40 +0200 Subject: [PATCH 07/36] chore: Add missing inline docs --- .../patcher/patch/options/types/BooleanPatchOption.kt | 9 +++++---- .../patcher/patch/options/types/FloatPatchOption.kt | 11 +++++++---- .../patcher/patch/options/types/IntPatchOption.kt | 11 +++++++---- .../patcher/patch/options/types/LongPatchOption.kt | 9 +++++---- .../patcher/patch/options/types/StringPatchOption.kt | 11 +++++++---- .../options/types/array/BooleanArrayPatchOption.kt | 11 +++++++---- .../options/types/array/FloatArrayPatchOption.kt | 11 +++++++---- .../patch/options/types/array/IntArrayPatchOption.kt | 11 +++++++---- .../patch/options/types/array/LongArrayPatchOption.kt | 11 +++++++---- .../options/types/array/StringArrayPatchOption.kt | 11 +++++++---- 10 files changed, 66 insertions(+), 40 deletions(-) diff --git a/src/main/kotlin/app/revanced/patcher/patch/options/types/BooleanPatchOption.kt b/src/main/kotlin/app/revanced/patcher/patch/options/types/BooleanPatchOption.kt index 471478c..7d808cd 100644 --- a/src/main/kotlin/app/revanced/patcher/patch/options/types/BooleanPatchOption.kt +++ b/src/main/kotlin/app/revanced/patcher/patch/options/types/BooleanPatchOption.kt @@ -11,6 +11,7 @@ import app.revanced.patcher.patch.options.PatchOption * @param title The title. * @param description A description. * @param required Whether the option is required. + * @param validate The function to validate values of the option. * * @see PatchOption */ @@ -20,8 +21,8 @@ class BooleanPatchOption private constructor( title: String?, description: String?, required: Boolean, - validator: (Boolean?) -> Boolean -) : PatchOption(key, default, title, description, required, validator) { + validate: (Boolean?) -> Boolean +) : PatchOption(key, default, title, description, required, validate) { companion object { /** * Create a new [BooleanPatchOption] and add it to the current [Patch]. @@ -42,7 +43,7 @@ class BooleanPatchOption private constructor( title: String? = null, description: String? = null, required: Boolean = false, - validator: (Boolean?) -> Boolean = { true } - ) = BooleanPatchOption(key, default, title, description, required, validator).also { options.register(it) } + validate: (Boolean?) -> Boolean = { true } + ) = BooleanPatchOption(key, default, title, description, required, validate).also { options.register(it) } } } diff --git a/src/main/kotlin/app/revanced/patcher/patch/options/types/FloatPatchOption.kt b/src/main/kotlin/app/revanced/patcher/patch/options/types/FloatPatchOption.kt index beec13a..6beb874 100644 --- a/src/main/kotlin/app/revanced/patcher/patch/options/types/FloatPatchOption.kt +++ b/src/main/kotlin/app/revanced/patcher/patch/options/types/FloatPatchOption.kt @@ -11,6 +11,7 @@ import app.revanced.patcher.patch.options.PatchOption * @param title The title. * @param description A description. * @param required Whether the option is required. + * @param validate The function to validate values of the option. * * @see PatchOption */ @@ -20,8 +21,8 @@ class FloatPatchOption private constructor( title: String?, description: String?, required: Boolean, - validator: (Float?) -> Boolean -) : PatchOption(key, default, title, description, required, validator) { + validate: (Float?) -> Boolean +) : PatchOption(key, default, title, description, required, validate) { companion object { /** * Create a new [FloatPatchOption] and add it to the current [Patch]. @@ -31,6 +32,8 @@ class FloatPatchOption private constructor( * @param title The title. * @param description A description. * @param required Whether the option is required. + * @param validate The function to validate values of the option. + * * @return The created [FloatPatchOption]. * * @see FloatPatchOption @@ -42,7 +45,7 @@ class FloatPatchOption private constructor( title: String? = null, description: String? = null, required: Boolean = false, - validator: (Float?) -> Boolean = { true } - ) = FloatPatchOption(key, default, title, description, required, validator).also { options.register(it) } + validate: (Float?) -> Boolean = { true } + ) = FloatPatchOption(key, default, title, description, required, validate).also { options.register(it) } } } diff --git a/src/main/kotlin/app/revanced/patcher/patch/options/types/IntPatchOption.kt b/src/main/kotlin/app/revanced/patcher/patch/options/types/IntPatchOption.kt index c815b59..21f5344 100644 --- a/src/main/kotlin/app/revanced/patcher/patch/options/types/IntPatchOption.kt +++ b/src/main/kotlin/app/revanced/patcher/patch/options/types/IntPatchOption.kt @@ -11,6 +11,7 @@ import app.revanced.patcher.patch.options.PatchOption * @param title The title. * @param description A description. * @param required Whether the option is required. + * @param validate The function to validate values of the option. * * @see PatchOption */ @@ -20,8 +21,8 @@ class IntPatchOption private constructor( title: String?, description: String?, required: Boolean, - validator: (Int?) -> Boolean -) : PatchOption(key, default, title, description, required, validator) { + validate: (Int?) -> Boolean +) : PatchOption(key, default, title, description, required, validate) { companion object { /** * Create a new [IntPatchOption] and add it to the current [Patch]. @@ -31,6 +32,8 @@ class IntPatchOption private constructor( * @param title The title. * @param description A description. * @param required Whether the option is required. + * @param validate The function to validate values of the option. + * * @return The created [IntPatchOption]. * * @see IntPatchOption @@ -42,7 +45,7 @@ class IntPatchOption private constructor( title: String? = null, description: String? = null, required: Boolean = false, - validator: (Int?) -> Boolean = { true } - ) = IntPatchOption(key, default, title, description, required, validator).also { options.register(it) } + validate: (Int?) -> Boolean = { true } + ) = IntPatchOption(key, default, title, description, required, validate).also { options.register(it) } } } diff --git a/src/main/kotlin/app/revanced/patcher/patch/options/types/LongPatchOption.kt b/src/main/kotlin/app/revanced/patcher/patch/options/types/LongPatchOption.kt index 563fa21..15702d0 100644 --- a/src/main/kotlin/app/revanced/patcher/patch/options/types/LongPatchOption.kt +++ b/src/main/kotlin/app/revanced/patcher/patch/options/types/LongPatchOption.kt @@ -11,6 +11,7 @@ import app.revanced.patcher.patch.options.PatchOption * @param title The title. * @param description A description. * @param required Whether the option is required. + * @param validate The function to validate values of the option. * * @see PatchOption */ @@ -20,8 +21,8 @@ class LongPatchOption private constructor( title: String?, description: String?, required: Boolean, - validator: (Long?) -> Boolean -) : PatchOption(key, default, title, description, required, validator) { + validate: (Long?) -> Boolean +) : PatchOption(key, default, title, description, required, validate) { companion object { /** * Create a new [LongPatchOption] and add it to the current [Patch]. @@ -42,7 +43,7 @@ class LongPatchOption private constructor( title: String? = null, description: String? = null, required: Boolean = false, - validator: (Long?) -> Boolean = { true } - ) = LongPatchOption(key, default, title, description, required, validator).also { options.register(it) } + validate: (Long?) -> Boolean = { true } + ) = LongPatchOption(key, default, title, description, required, validate).also { options.register(it) } } } diff --git a/src/main/kotlin/app/revanced/patcher/patch/options/types/StringPatchOption.kt b/src/main/kotlin/app/revanced/patcher/patch/options/types/StringPatchOption.kt index 5e2677f..dc21c74 100644 --- a/src/main/kotlin/app/revanced/patcher/patch/options/types/StringPatchOption.kt +++ b/src/main/kotlin/app/revanced/patcher/patch/options/types/StringPatchOption.kt @@ -11,6 +11,7 @@ import app.revanced.patcher.patch.options.PatchOption * @param title The title. * @param description A description. * @param required Whether the option is required. + * @param validate The function to validate values of the option. * * @see PatchOption */ @@ -20,8 +21,8 @@ class StringPatchOption private constructor( title: String?, description: String?, required: Boolean, - validator: (String?) -> Boolean -) : PatchOption(key, default, title, description, required, validator) { + validate: (String?) -> Boolean +) : PatchOption(key, default, title, description, required, validate) { companion object { /** * Create a new [StringPatchOption] and add it to the current [Patch]. @@ -31,6 +32,8 @@ class StringPatchOption private constructor( * @param title The title. * @param description A description. * @param required Whether the option is required. + * @param validate The function to validate values of the option. + * * @return The created [StringPatchOption]. * * @see StringPatchOption @@ -42,7 +45,7 @@ class StringPatchOption private constructor( title: String? = null, description: String? = null, required: Boolean = false, - validator: (String?) -> Boolean = { true } - ) = StringPatchOption(key, default, title, description, required, validator).also { options.register(it) } + validate: (String?) -> Boolean = { true } + ) = StringPatchOption(key, default, title, description, required, validate).also { options.register(it) } } } diff --git a/src/main/kotlin/app/revanced/patcher/patch/options/types/array/BooleanArrayPatchOption.kt b/src/main/kotlin/app/revanced/patcher/patch/options/types/array/BooleanArrayPatchOption.kt index 84bd809..52dceaf 100644 --- a/src/main/kotlin/app/revanced/patcher/patch/options/types/array/BooleanArrayPatchOption.kt +++ b/src/main/kotlin/app/revanced/patcher/patch/options/types/array/BooleanArrayPatchOption.kt @@ -11,6 +11,7 @@ import app.revanced.patcher.patch.options.PatchOption * @param title The title. * @param description A description. * @param required Whether the option is required. + * @param validate The function to validate values of the option. * * @see PatchOption */ @@ -20,8 +21,8 @@ class BooleanArrayPatchOption private constructor( title: String?, description: String?, required: Boolean, - validator: (Array?) -> Boolean -) : PatchOption>(key, default, title, description, required, validator) { + validate: (Array?) -> Boolean +) : PatchOption>(key, default, title, description, required, validate) { companion object { /** * Create a new [BooleanArrayPatchOption] and add it to the current [Patch]. @@ -31,6 +32,8 @@ class BooleanArrayPatchOption private constructor( * @param title The title. * @param description A description. * @param required Whether the option is required. + * @param validate The function to validate values of the option. + * * @return The created [BooleanArrayPatchOption]. * * @see BooleanArrayPatchOption @@ -42,7 +45,7 @@ class BooleanArrayPatchOption private constructor( title: String? = null, description: String? = null, required: Boolean = false, - validator: (Array?) -> Boolean = { true } - ) = BooleanArrayPatchOption(key, default, title, description, required, validator).also { options.register(it) } + validate: (Array?) -> Boolean = { true } + ) = BooleanArrayPatchOption(key, default, title, description, required, validate).also { options.register(it) } } } diff --git a/src/main/kotlin/app/revanced/patcher/patch/options/types/array/FloatArrayPatchOption.kt b/src/main/kotlin/app/revanced/patcher/patch/options/types/array/FloatArrayPatchOption.kt index c9e829d..83d950e 100644 --- a/src/main/kotlin/app/revanced/patcher/patch/options/types/array/FloatArrayPatchOption.kt +++ b/src/main/kotlin/app/revanced/patcher/patch/options/types/array/FloatArrayPatchOption.kt @@ -11,6 +11,7 @@ import app.revanced.patcher.patch.options.PatchOption * @param title The title. * @param description A description. * @param required Whether the option is required. + * @param validate The function to validate values of the option. * * @see PatchOption */ @@ -20,8 +21,8 @@ class FloatArrayPatchOption private constructor( title: String?, description: String?, required: Boolean, - validator: (Array?) -> Boolean -) : PatchOption>(key, default, title, description, required, validator) { + validate: (Array?) -> Boolean +) : PatchOption>(key, default, title, description, required, validate) { companion object { /** * Create a new [FloatArrayPatchOption] and add it to the current [Patch]. @@ -31,6 +32,8 @@ class FloatArrayPatchOption private constructor( * @param title The title. * @param description A description. * @param required Whether the option is required. + * @param validate The function to validate values of the option. + * * @return The created [FloatArrayPatchOption]. * * @see FloatArrayPatchOption @@ -42,7 +45,7 @@ class FloatArrayPatchOption private constructor( title: String? = null, description: String? = null, required: Boolean = false, - validator: (Array?) -> Boolean = { true } - ) = FloatArrayPatchOption(key, default, title, description, required, validator).also { options.register(it) } + validate: (Array?) -> Boolean = { true } + ) = FloatArrayPatchOption(key, default, title, description, required, validate).also { options.register(it) } } } diff --git a/src/main/kotlin/app/revanced/patcher/patch/options/types/array/IntArrayPatchOption.kt b/src/main/kotlin/app/revanced/patcher/patch/options/types/array/IntArrayPatchOption.kt index 28211cf..18d8a2d 100644 --- a/src/main/kotlin/app/revanced/patcher/patch/options/types/array/IntArrayPatchOption.kt +++ b/src/main/kotlin/app/revanced/patcher/patch/options/types/array/IntArrayPatchOption.kt @@ -11,6 +11,7 @@ import app.revanced.patcher.patch.options.PatchOption * @param title The title. * @param description A description. * @param required Whether the option is required. + * @param validate The function to validate values of the option. * * @see PatchOption */ @@ -20,8 +21,8 @@ class IntArrayPatchOption private constructor( title: String?, description: String?, required: Boolean, - validator: (Array?) -> Boolean -) : PatchOption>(key, default, title, description, required, validator) { + validate: (Array?) -> Boolean +) : PatchOption>(key, default, title, description, required, validate) { companion object { /** * Create a new [IntArrayPatchOption] and add it to the current [Patch]. @@ -31,6 +32,8 @@ class IntArrayPatchOption private constructor( * @param title The title. * @param description A description. * @param required Whether the option is required. + * @param validate The function to validate values of the option. + * * @return The created [IntArrayPatchOption]. * * @see IntArrayPatchOption @@ -42,7 +45,7 @@ class IntArrayPatchOption private constructor( title: String? = null, description: String? = null, required: Boolean = false, - validator: (Array?) -> Boolean = { true } - ) = IntArrayPatchOption(key, default, title, description, required, validator).also { options.register(it) } + validate: (Array?) -> Boolean = { true } + ) = IntArrayPatchOption(key, default, title, description, required, validate).also { options.register(it) } } } diff --git a/src/main/kotlin/app/revanced/patcher/patch/options/types/array/LongArrayPatchOption.kt b/src/main/kotlin/app/revanced/patcher/patch/options/types/array/LongArrayPatchOption.kt index babb690..93a7ad8 100644 --- a/src/main/kotlin/app/revanced/patcher/patch/options/types/array/LongArrayPatchOption.kt +++ b/src/main/kotlin/app/revanced/patcher/patch/options/types/array/LongArrayPatchOption.kt @@ -11,6 +11,7 @@ import app.revanced.patcher.patch.options.PatchOption * @param title The title. * @param description A description. * @param required Whether the option is required. + * @param validate The function to validate values of the option. * * @see PatchOption */ @@ -20,8 +21,8 @@ class LongArrayPatchOption private constructor( title: String?, description: String?, required: Boolean, - validator: (Array?) -> Boolean -) : PatchOption>(key, default, title, description, required, validator) { + validate: (Array?) -> Boolean +) : PatchOption>(key, default, title, description, required, validate) { companion object { /** * Create a new [LongArrayPatchOption] and add it to the current [Patch]. @@ -31,6 +32,8 @@ class LongArrayPatchOption private constructor( * @param title The title. * @param description A description. * @param required Whether the option is required. + * @param validate The function to validate values of the option. + * * @return The created [LongArrayPatchOption]. * * @see LongArrayPatchOption @@ -42,7 +45,7 @@ class LongArrayPatchOption private constructor( title: String? = null, description: String? = null, required: Boolean = false, - validator: (Array?) -> Boolean = { true } - ) = LongArrayPatchOption(key, default, title, description, required, validator).also { options.register(it) } + validate: (Array?) -> Boolean = { true } + ) = LongArrayPatchOption(key, default, title, description, required, validate).also { options.register(it) } } } diff --git a/src/main/kotlin/app/revanced/patcher/patch/options/types/array/StringArrayPatchOption.kt b/src/main/kotlin/app/revanced/patcher/patch/options/types/array/StringArrayPatchOption.kt index a73053c..ccab4a1 100644 --- a/src/main/kotlin/app/revanced/patcher/patch/options/types/array/StringArrayPatchOption.kt +++ b/src/main/kotlin/app/revanced/patcher/patch/options/types/array/StringArrayPatchOption.kt @@ -11,6 +11,7 @@ import app.revanced.patcher.patch.options.PatchOption * @param title The title. * @param description A description. * @param required Whether the option is required. + * @param validate The function to validate values of the option. * * @see PatchOption */ @@ -20,8 +21,8 @@ class StringArrayPatchOption private constructor( title: String?, description: String?, required: Boolean, - validator: (Array?) -> Boolean -) : PatchOption>(key, default, title, description, required, validator) { + validate: (Array?) -> Boolean +) : PatchOption>(key, default, title, description, required, validate) { companion object { /** * Create a new [StringArrayPatchOption] and add it to the current [Patch]. @@ -31,6 +32,8 @@ class StringArrayPatchOption private constructor( * @param title The title. * @param description A description. * @param required Whether the option is required. + * @param validate The function to validate values of the option. + * * @return The created [StringArrayPatchOption]. * * @see StringArrayPatchOption @@ -42,7 +45,7 @@ class StringArrayPatchOption private constructor( title: String? = null, description: String? = null, required: Boolean = false, - validator: (Array?) -> Boolean = { true } - ) = StringArrayPatchOption(key, default, title, description, required, validator).also { options.register(it) } + validate: (Array?) -> Boolean = { true } + ) = StringArrayPatchOption(key, default, title, description, required, validate).also { options.register(it) } } } From caa634fac6d7a717f54e3b015827c8858fd637b9 Mon Sep 17 00:00:00 2001 From: oSumAtrIX Date: Sat, 21 Oct 2023 23:51:44 +0200 Subject: [PATCH 08/36] feat: Name patch option value validator property correctly BREAKING CHANGE: This changes the getter name of the property. --- api/revanced-patcher.api | 2 +- .../revanced/patcher/patch/options/PatchOption.kt | 6 +++--- .../patch/options/types/BooleanPatchOption.kt | 10 +++++----- .../patcher/patch/options/types/FloatPatchOption.kt | 12 ++++++------ .../patcher/patch/options/types/IntPatchOption.kt | 12 ++++++------ .../patcher/patch/options/types/LongPatchOption.kt | 10 +++++----- .../patcher/patch/options/types/StringPatchOption.kt | 12 ++++++------ .../options/types/array/BooleanArrayPatchOption.kt | 12 ++++++------ .../options/types/array/FloatArrayPatchOption.kt | 12 ++++++------ .../patch/options/types/array/IntArrayPatchOption.kt | 12 ++++++------ .../options/types/array/LongArrayPatchOption.kt | 12 ++++++------ .../options/types/array/StringArrayPatchOption.kt | 12 ++++++------ 12 files changed, 62 insertions(+), 62 deletions(-) diff --git a/api/revanced-patcher.api b/api/revanced-patcher.api index d727f2d..c4eefa4 100644 --- a/api/revanced-patcher.api +++ b/api/revanced-patcher.api @@ -366,7 +366,7 @@ public abstract class app/revanced/patcher/patch/options/PatchOption { public final fun getKey ()Ljava/lang/String; public final fun getRequired ()Z public final fun getTitle ()Ljava/lang/String; - public final fun getValidate ()Lkotlin/jvm/functions/Function1; + public final fun getValidator ()Lkotlin/jvm/functions/Function1; public final fun getValue ()Ljava/lang/Object; public final fun getValue (Ljava/lang/Object;Lkotlin/reflect/KProperty;)Ljava/lang/Object; public final fun setValue (Ljava/lang/Object;)V diff --git a/src/main/kotlin/app/revanced/patcher/patch/options/PatchOption.kt b/src/main/kotlin/app/revanced/patcher/patch/options/PatchOption.kt index df130bf..35daaff 100644 --- a/src/main/kotlin/app/revanced/patcher/patch/options/PatchOption.kt +++ b/src/main/kotlin/app/revanced/patcher/patch/options/PatchOption.kt @@ -10,7 +10,7 @@ import kotlin.reflect.KProperty * @param title The title. * @param description A description. * @param required Whether the option is required. - * @param validate The function to validate values of the option. + * @param validator The function to validator values of the option. * @param T The value type of the option. */ abstract class PatchOption( @@ -19,7 +19,7 @@ abstract class PatchOption( val title: String?, val description: String?, val required: Boolean, - val validate: (T?) -> Boolean + val validator: (T?) -> Boolean ) { /** * The value of the [PatchOption]. @@ -27,7 +27,7 @@ abstract class PatchOption( var value: T? = default set(value) { if (required && value == null) throw PatchOptionException.ValueRequiredException(this) - if (!validate(value)) throw PatchOptionException.ValueValidationException(value, this) + if (!validator(value)) throw PatchOptionException.ValueValidationException(value, this) field = value } diff --git a/src/main/kotlin/app/revanced/patcher/patch/options/types/BooleanPatchOption.kt b/src/main/kotlin/app/revanced/patcher/patch/options/types/BooleanPatchOption.kt index 7d808cd..b2941dd 100644 --- a/src/main/kotlin/app/revanced/patcher/patch/options/types/BooleanPatchOption.kt +++ b/src/main/kotlin/app/revanced/patcher/patch/options/types/BooleanPatchOption.kt @@ -11,7 +11,7 @@ import app.revanced.patcher.patch.options.PatchOption * @param title The title. * @param description A description. * @param required Whether the option is required. - * @param validate The function to validate values of the option. + * @param validator The function to validator values of the option. * * @see PatchOption */ @@ -21,8 +21,8 @@ class BooleanPatchOption private constructor( title: String?, description: String?, required: Boolean, - validate: (Boolean?) -> Boolean -) : PatchOption(key, default, title, description, required, validate) { + validator: (Boolean?) -> Boolean +) : PatchOption(key, default, title, description, required, validator) { companion object { /** * Create a new [BooleanPatchOption] and add it to the current [Patch]. @@ -43,7 +43,7 @@ class BooleanPatchOption private constructor( title: String? = null, description: String? = null, required: Boolean = false, - validate: (Boolean?) -> Boolean = { true } - ) = BooleanPatchOption(key, default, title, description, required, validate).also { options.register(it) } + validator: (Boolean?) -> Boolean = { true } + ) = BooleanPatchOption(key, default, title, description, required, validator).also { options.register(it) } } } diff --git a/src/main/kotlin/app/revanced/patcher/patch/options/types/FloatPatchOption.kt b/src/main/kotlin/app/revanced/patcher/patch/options/types/FloatPatchOption.kt index 6beb874..7e89774 100644 --- a/src/main/kotlin/app/revanced/patcher/patch/options/types/FloatPatchOption.kt +++ b/src/main/kotlin/app/revanced/patcher/patch/options/types/FloatPatchOption.kt @@ -11,7 +11,7 @@ import app.revanced.patcher.patch.options.PatchOption * @param title The title. * @param description A description. * @param required Whether the option is required. - * @param validate The function to validate values of the option. + * @param validator The function to validator values of the option. * * @see PatchOption */ @@ -21,8 +21,8 @@ class FloatPatchOption private constructor( title: String?, description: String?, required: Boolean, - validate: (Float?) -> Boolean -) : PatchOption(key, default, title, description, required, validate) { + validator: (Float?) -> Boolean +) : PatchOption(key, default, title, description, required, validator) { companion object { /** * Create a new [FloatPatchOption] and add it to the current [Patch]. @@ -32,7 +32,7 @@ class FloatPatchOption private constructor( * @param title The title. * @param description A description. * @param required Whether the option is required. - * @param validate The function to validate values of the option. + * @param validator The function to validator values of the option. * * @return The created [FloatPatchOption]. * @@ -45,7 +45,7 @@ class FloatPatchOption private constructor( title: String? = null, description: String? = null, required: Boolean = false, - validate: (Float?) -> Boolean = { true } - ) = FloatPatchOption(key, default, title, description, required, validate).also { options.register(it) } + validator: (Float?) -> Boolean = { true } + ) = FloatPatchOption(key, default, title, description, required, validator).also { options.register(it) } } } diff --git a/src/main/kotlin/app/revanced/patcher/patch/options/types/IntPatchOption.kt b/src/main/kotlin/app/revanced/patcher/patch/options/types/IntPatchOption.kt index 21f5344..4b500f3 100644 --- a/src/main/kotlin/app/revanced/patcher/patch/options/types/IntPatchOption.kt +++ b/src/main/kotlin/app/revanced/patcher/patch/options/types/IntPatchOption.kt @@ -11,7 +11,7 @@ import app.revanced.patcher.patch.options.PatchOption * @param title The title. * @param description A description. * @param required Whether the option is required. - * @param validate The function to validate values of the option. + * @param validator The function to validator values of the option. * * @see PatchOption */ @@ -21,8 +21,8 @@ class IntPatchOption private constructor( title: String?, description: String?, required: Boolean, - validate: (Int?) -> Boolean -) : PatchOption(key, default, title, description, required, validate) { + validator: (Int?) -> Boolean +) : PatchOption(key, default, title, description, required, validator) { companion object { /** * Create a new [IntPatchOption] and add it to the current [Patch]. @@ -32,7 +32,7 @@ class IntPatchOption private constructor( * @param title The title. * @param description A description. * @param required Whether the option is required. - * @param validate The function to validate values of the option. + * @param validator The function to validator values of the option. * * @return The created [IntPatchOption]. * @@ -45,7 +45,7 @@ class IntPatchOption private constructor( title: String? = null, description: String? = null, required: Boolean = false, - validate: (Int?) -> Boolean = { true } - ) = IntPatchOption(key, default, title, description, required, validate).also { options.register(it) } + validator: (Int?) -> Boolean = { true } + ) = IntPatchOption(key, default, title, description, required, validator).also { options.register(it) } } } diff --git a/src/main/kotlin/app/revanced/patcher/patch/options/types/LongPatchOption.kt b/src/main/kotlin/app/revanced/patcher/patch/options/types/LongPatchOption.kt index 15702d0..33e8e08 100644 --- a/src/main/kotlin/app/revanced/patcher/patch/options/types/LongPatchOption.kt +++ b/src/main/kotlin/app/revanced/patcher/patch/options/types/LongPatchOption.kt @@ -11,7 +11,7 @@ import app.revanced.patcher.patch.options.PatchOption * @param title The title. * @param description A description. * @param required Whether the option is required. - * @param validate The function to validate values of the option. + * @param validator The function to validator values of the option. * * @see PatchOption */ @@ -21,8 +21,8 @@ class LongPatchOption private constructor( title: String?, description: String?, required: Boolean, - validate: (Long?) -> Boolean -) : PatchOption(key, default, title, description, required, validate) { + validator: (Long?) -> Boolean +) : PatchOption(key, default, title, description, required, validator) { companion object { /** * Create a new [LongPatchOption] and add it to the current [Patch]. @@ -43,7 +43,7 @@ class LongPatchOption private constructor( title: String? = null, description: String? = null, required: Boolean = false, - validate: (Long?) -> Boolean = { true } - ) = LongPatchOption(key, default, title, description, required, validate).also { options.register(it) } + validator: (Long?) -> Boolean = { true } + ) = LongPatchOption(key, default, title, description, required, validator).also { options.register(it) } } } diff --git a/src/main/kotlin/app/revanced/patcher/patch/options/types/StringPatchOption.kt b/src/main/kotlin/app/revanced/patcher/patch/options/types/StringPatchOption.kt index dc21c74..31cc6b4 100644 --- a/src/main/kotlin/app/revanced/patcher/patch/options/types/StringPatchOption.kt +++ b/src/main/kotlin/app/revanced/patcher/patch/options/types/StringPatchOption.kt @@ -11,7 +11,7 @@ import app.revanced.patcher.patch.options.PatchOption * @param title The title. * @param description A description. * @param required Whether the option is required. - * @param validate The function to validate values of the option. + * @param validator The function to validator values of the option. * * @see PatchOption */ @@ -21,8 +21,8 @@ class StringPatchOption private constructor( title: String?, description: String?, required: Boolean, - validate: (String?) -> Boolean -) : PatchOption(key, default, title, description, required, validate) { + validator: (String?) -> Boolean +) : PatchOption(key, default, title, description, required, validator) { companion object { /** * Create a new [StringPatchOption] and add it to the current [Patch]. @@ -32,7 +32,7 @@ class StringPatchOption private constructor( * @param title The title. * @param description A description. * @param required Whether the option is required. - * @param validate The function to validate values of the option. + * @param validator The function to validator values of the option. * * @return The created [StringPatchOption]. * @@ -45,7 +45,7 @@ class StringPatchOption private constructor( title: String? = null, description: String? = null, required: Boolean = false, - validate: (String?) -> Boolean = { true } - ) = StringPatchOption(key, default, title, description, required, validate).also { options.register(it) } + validator: (String?) -> Boolean = { true } + ) = StringPatchOption(key, default, title, description, required, validator).also { options.register(it) } } } diff --git a/src/main/kotlin/app/revanced/patcher/patch/options/types/array/BooleanArrayPatchOption.kt b/src/main/kotlin/app/revanced/patcher/patch/options/types/array/BooleanArrayPatchOption.kt index 52dceaf..6f3dff2 100644 --- a/src/main/kotlin/app/revanced/patcher/patch/options/types/array/BooleanArrayPatchOption.kt +++ b/src/main/kotlin/app/revanced/patcher/patch/options/types/array/BooleanArrayPatchOption.kt @@ -11,7 +11,7 @@ import app.revanced.patcher.patch.options.PatchOption * @param title The title. * @param description A description. * @param required Whether the option is required. - * @param validate The function to validate values of the option. + * @param validator The function to validator values of the option. * * @see PatchOption */ @@ -21,8 +21,8 @@ class BooleanArrayPatchOption private constructor( title: String?, description: String?, required: Boolean, - validate: (Array?) -> Boolean -) : PatchOption>(key, default, title, description, required, validate) { + validator: (Array?) -> Boolean +) : PatchOption>(key, default, title, description, required, validator) { companion object { /** * Create a new [BooleanArrayPatchOption] and add it to the current [Patch]. @@ -32,7 +32,7 @@ class BooleanArrayPatchOption private constructor( * @param title The title. * @param description A description. * @param required Whether the option is required. - * @param validate The function to validate values of the option. + * @param validator The function to validator values of the option. * * @return The created [BooleanArrayPatchOption]. * @@ -45,7 +45,7 @@ class BooleanArrayPatchOption private constructor( title: String? = null, description: String? = null, required: Boolean = false, - validate: (Array?) -> Boolean = { true } - ) = BooleanArrayPatchOption(key, default, title, description, required, validate).also { options.register(it) } + validator: (Array?) -> Boolean = { true } + ) = BooleanArrayPatchOption(key, default, title, description, required, validator).also { options.register(it) } } } diff --git a/src/main/kotlin/app/revanced/patcher/patch/options/types/array/FloatArrayPatchOption.kt b/src/main/kotlin/app/revanced/patcher/patch/options/types/array/FloatArrayPatchOption.kt index 83d950e..890f909 100644 --- a/src/main/kotlin/app/revanced/patcher/patch/options/types/array/FloatArrayPatchOption.kt +++ b/src/main/kotlin/app/revanced/patcher/patch/options/types/array/FloatArrayPatchOption.kt @@ -11,7 +11,7 @@ import app.revanced.patcher.patch.options.PatchOption * @param title The title. * @param description A description. * @param required Whether the option is required. - * @param validate The function to validate values of the option. + * @param validator The function to validator values of the option. * * @see PatchOption */ @@ -21,8 +21,8 @@ class FloatArrayPatchOption private constructor( title: String?, description: String?, required: Boolean, - validate: (Array?) -> Boolean -) : PatchOption>(key, default, title, description, required, validate) { + validator: (Array?) -> Boolean +) : PatchOption>(key, default, title, description, required, validator) { companion object { /** * Create a new [FloatArrayPatchOption] and add it to the current [Patch]. @@ -32,7 +32,7 @@ class FloatArrayPatchOption private constructor( * @param title The title. * @param description A description. * @param required Whether the option is required. - * @param validate The function to validate values of the option. + * @param validator The function to validator values of the option. * * @return The created [FloatArrayPatchOption]. * @@ -45,7 +45,7 @@ class FloatArrayPatchOption private constructor( title: String? = null, description: String? = null, required: Boolean = false, - validate: (Array?) -> Boolean = { true } - ) = FloatArrayPatchOption(key, default, title, description, required, validate).also { options.register(it) } + validator: (Array?) -> Boolean = { true } + ) = FloatArrayPatchOption(key, default, title, description, required, validator).also { options.register(it) } } } diff --git a/src/main/kotlin/app/revanced/patcher/patch/options/types/array/IntArrayPatchOption.kt b/src/main/kotlin/app/revanced/patcher/patch/options/types/array/IntArrayPatchOption.kt index 18d8a2d..dff47d5 100644 --- a/src/main/kotlin/app/revanced/patcher/patch/options/types/array/IntArrayPatchOption.kt +++ b/src/main/kotlin/app/revanced/patcher/patch/options/types/array/IntArrayPatchOption.kt @@ -11,7 +11,7 @@ import app.revanced.patcher.patch.options.PatchOption * @param title The title. * @param description A description. * @param required Whether the option is required. - * @param validate The function to validate values of the option. + * @param validator The function to validator values of the option. * * @see PatchOption */ @@ -21,8 +21,8 @@ class IntArrayPatchOption private constructor( title: String?, description: String?, required: Boolean, - validate: (Array?) -> Boolean -) : PatchOption>(key, default, title, description, required, validate) { + validator: (Array?) -> Boolean +) : PatchOption>(key, default, title, description, required, validator) { companion object { /** * Create a new [IntArrayPatchOption] and add it to the current [Patch]. @@ -32,7 +32,7 @@ class IntArrayPatchOption private constructor( * @param title The title. * @param description A description. * @param required Whether the option is required. - * @param validate The function to validate values of the option. + * @param validator The function to validator values of the option. * * @return The created [IntArrayPatchOption]. * @@ -45,7 +45,7 @@ class IntArrayPatchOption private constructor( title: String? = null, description: String? = null, required: Boolean = false, - validate: (Array?) -> Boolean = { true } - ) = IntArrayPatchOption(key, default, title, description, required, validate).also { options.register(it) } + validator: (Array?) -> Boolean = { true } + ) = IntArrayPatchOption(key, default, title, description, required, validator).also { options.register(it) } } } diff --git a/src/main/kotlin/app/revanced/patcher/patch/options/types/array/LongArrayPatchOption.kt b/src/main/kotlin/app/revanced/patcher/patch/options/types/array/LongArrayPatchOption.kt index 93a7ad8..0b6ad8f 100644 --- a/src/main/kotlin/app/revanced/patcher/patch/options/types/array/LongArrayPatchOption.kt +++ b/src/main/kotlin/app/revanced/patcher/patch/options/types/array/LongArrayPatchOption.kt @@ -11,7 +11,7 @@ import app.revanced.patcher.patch.options.PatchOption * @param title The title. * @param description A description. * @param required Whether the option is required. - * @param validate The function to validate values of the option. + * @param validator The function to validator values of the option. * * @see PatchOption */ @@ -21,8 +21,8 @@ class LongArrayPatchOption private constructor( title: String?, description: String?, required: Boolean, - validate: (Array?) -> Boolean -) : PatchOption>(key, default, title, description, required, validate) { + validator: (Array?) -> Boolean +) : PatchOption>(key, default, title, description, required, validator) { companion object { /** * Create a new [LongArrayPatchOption] and add it to the current [Patch]. @@ -32,7 +32,7 @@ class LongArrayPatchOption private constructor( * @param title The title. * @param description A description. * @param required Whether the option is required. - * @param validate The function to validate values of the option. + * @param validator The function to validator values of the option. * * @return The created [LongArrayPatchOption]. * @@ -45,7 +45,7 @@ class LongArrayPatchOption private constructor( title: String? = null, description: String? = null, required: Boolean = false, - validate: (Array?) -> Boolean = { true } - ) = LongArrayPatchOption(key, default, title, description, required, validate).also { options.register(it) } + validator: (Array?) -> Boolean = { true } + ) = LongArrayPatchOption(key, default, title, description, required, validator).also { options.register(it) } } } diff --git a/src/main/kotlin/app/revanced/patcher/patch/options/types/array/StringArrayPatchOption.kt b/src/main/kotlin/app/revanced/patcher/patch/options/types/array/StringArrayPatchOption.kt index ccab4a1..c5d7c55 100644 --- a/src/main/kotlin/app/revanced/patcher/patch/options/types/array/StringArrayPatchOption.kt +++ b/src/main/kotlin/app/revanced/patcher/patch/options/types/array/StringArrayPatchOption.kt @@ -11,7 +11,7 @@ import app.revanced.patcher.patch.options.PatchOption * @param title The title. * @param description A description. * @param required Whether the option is required. - * @param validate The function to validate values of the option. + * @param validator The function to validator values of the option. * * @see PatchOption */ @@ -21,8 +21,8 @@ class StringArrayPatchOption private constructor( title: String?, description: String?, required: Boolean, - validate: (Array?) -> Boolean -) : PatchOption>(key, default, title, description, required, validate) { + validator: (Array?) -> Boolean +) : PatchOption>(key, default, title, description, required, validator) { companion object { /** * Create a new [StringArrayPatchOption] and add it to the current [Patch]. @@ -32,7 +32,7 @@ class StringArrayPatchOption private constructor( * @param title The title. * @param description A description. * @param required Whether the option is required. - * @param validate The function to validate values of the option. + * @param validator The function to validator values of the option. * * @return The created [StringArrayPatchOption]. * @@ -45,7 +45,7 @@ class StringArrayPatchOption private constructor( title: String? = null, description: String? = null, required: Boolean = false, - validate: (Array?) -> Boolean = { true } - ) = StringArrayPatchOption(key, default, title, description, required, validate).also { options.register(it) } + validator: (Array?) -> Boolean = { true } + ) = StringArrayPatchOption(key, default, title, description, required, validator).also { options.register(it) } } } From c1f4c0445a190c437a89a8b293f0ef051f2ccc4c Mon Sep 17 00:00:00 2001 From: oSumAtrIX Date: Sat, 21 Oct 2023 23:52:47 +0200 Subject: [PATCH 09/36] chore: Fix inline docs wording --- .../kotlin/app/revanced/patcher/patch/options/PatchOption.kt | 2 +- .../patcher/patch/options/types/BooleanPatchOption.kt | 2 +- .../revanced/patcher/patch/options/types/FloatPatchOption.kt | 4 ++-- .../revanced/patcher/patch/options/types/IntPatchOption.kt | 4 ++-- .../revanced/patcher/patch/options/types/LongPatchOption.kt | 2 +- .../revanced/patcher/patch/options/types/StringPatchOption.kt | 4 ++-- .../patch/options/types/array/BooleanArrayPatchOption.kt | 4 ++-- .../patch/options/types/array/FloatArrayPatchOption.kt | 4 ++-- .../patcher/patch/options/types/array/IntArrayPatchOption.kt | 4 ++-- .../patcher/patch/options/types/array/LongArrayPatchOption.kt | 4 ++-- .../patch/options/types/array/StringArrayPatchOption.kt | 4 ++-- 11 files changed, 19 insertions(+), 19 deletions(-) diff --git a/src/main/kotlin/app/revanced/patcher/patch/options/PatchOption.kt b/src/main/kotlin/app/revanced/patcher/patch/options/PatchOption.kt index 35daaff..9c76c42 100644 --- a/src/main/kotlin/app/revanced/patcher/patch/options/PatchOption.kt +++ b/src/main/kotlin/app/revanced/patcher/patch/options/PatchOption.kt @@ -10,7 +10,7 @@ import kotlin.reflect.KProperty * @param title The title. * @param description A description. * @param required Whether the option is required. - * @param validator The function to validator values of the option. + * @param validator The function to validate the option value. * @param T The value type of the option. */ abstract class PatchOption( diff --git a/src/main/kotlin/app/revanced/patcher/patch/options/types/BooleanPatchOption.kt b/src/main/kotlin/app/revanced/patcher/patch/options/types/BooleanPatchOption.kt index b2941dd..7744002 100644 --- a/src/main/kotlin/app/revanced/patcher/patch/options/types/BooleanPatchOption.kt +++ b/src/main/kotlin/app/revanced/patcher/patch/options/types/BooleanPatchOption.kt @@ -11,7 +11,7 @@ import app.revanced.patcher.patch.options.PatchOption * @param title The title. * @param description A description. * @param required Whether the option is required. - * @param validator The function to validator values of the option. + * @param validator The function to validate the option value. * * @see PatchOption */ diff --git a/src/main/kotlin/app/revanced/patcher/patch/options/types/FloatPatchOption.kt b/src/main/kotlin/app/revanced/patcher/patch/options/types/FloatPatchOption.kt index 7e89774..8afd2dd 100644 --- a/src/main/kotlin/app/revanced/patcher/patch/options/types/FloatPatchOption.kt +++ b/src/main/kotlin/app/revanced/patcher/patch/options/types/FloatPatchOption.kt @@ -11,7 +11,7 @@ import app.revanced.patcher.patch.options.PatchOption * @param title The title. * @param description A description. * @param required Whether the option is required. - * @param validator The function to validator values of the option. + * @param validator The function to validate the option value. * * @see PatchOption */ @@ -32,7 +32,7 @@ class FloatPatchOption private constructor( * @param title The title. * @param description A description. * @param required Whether the option is required. - * @param validator The function to validator values of the option. + * @param validator The function to validate the option value. * * @return The created [FloatPatchOption]. * diff --git a/src/main/kotlin/app/revanced/patcher/patch/options/types/IntPatchOption.kt b/src/main/kotlin/app/revanced/patcher/patch/options/types/IntPatchOption.kt index 4b500f3..f59ea86 100644 --- a/src/main/kotlin/app/revanced/patcher/patch/options/types/IntPatchOption.kt +++ b/src/main/kotlin/app/revanced/patcher/patch/options/types/IntPatchOption.kt @@ -11,7 +11,7 @@ import app.revanced.patcher.patch.options.PatchOption * @param title The title. * @param description A description. * @param required Whether the option is required. - * @param validator The function to validator values of the option. + * @param validator The function to validate the option value. * * @see PatchOption */ @@ -32,7 +32,7 @@ class IntPatchOption private constructor( * @param title The title. * @param description A description. * @param required Whether the option is required. - * @param validator The function to validator values of the option. + * @param validator The function to validate the option value. * * @return The created [IntPatchOption]. * diff --git a/src/main/kotlin/app/revanced/patcher/patch/options/types/LongPatchOption.kt b/src/main/kotlin/app/revanced/patcher/patch/options/types/LongPatchOption.kt index 33e8e08..ca8d613 100644 --- a/src/main/kotlin/app/revanced/patcher/patch/options/types/LongPatchOption.kt +++ b/src/main/kotlin/app/revanced/patcher/patch/options/types/LongPatchOption.kt @@ -11,7 +11,7 @@ import app.revanced.patcher.patch.options.PatchOption * @param title The title. * @param description A description. * @param required Whether the option is required. - * @param validator The function to validator values of the option. + * @param validator The function to validate the option value. * * @see PatchOption */ diff --git a/src/main/kotlin/app/revanced/patcher/patch/options/types/StringPatchOption.kt b/src/main/kotlin/app/revanced/patcher/patch/options/types/StringPatchOption.kt index 31cc6b4..dae966a 100644 --- a/src/main/kotlin/app/revanced/patcher/patch/options/types/StringPatchOption.kt +++ b/src/main/kotlin/app/revanced/patcher/patch/options/types/StringPatchOption.kt @@ -11,7 +11,7 @@ import app.revanced.patcher.patch.options.PatchOption * @param title The title. * @param description A description. * @param required Whether the option is required. - * @param validator The function to validator values of the option. + * @param validator The function to validate the option value. * * @see PatchOption */ @@ -32,7 +32,7 @@ class StringPatchOption private constructor( * @param title The title. * @param description A description. * @param required Whether the option is required. - * @param validator The function to validator values of the option. + * @param validator The function to validate the option value. * * @return The created [StringPatchOption]. * diff --git a/src/main/kotlin/app/revanced/patcher/patch/options/types/array/BooleanArrayPatchOption.kt b/src/main/kotlin/app/revanced/patcher/patch/options/types/array/BooleanArrayPatchOption.kt index 6f3dff2..713e6f2 100644 --- a/src/main/kotlin/app/revanced/patcher/patch/options/types/array/BooleanArrayPatchOption.kt +++ b/src/main/kotlin/app/revanced/patcher/patch/options/types/array/BooleanArrayPatchOption.kt @@ -11,7 +11,7 @@ import app.revanced.patcher.patch.options.PatchOption * @param title The title. * @param description A description. * @param required Whether the option is required. - * @param validator The function to validator values of the option. + * @param validator The function to validate the option value. * * @see PatchOption */ @@ -32,7 +32,7 @@ class BooleanArrayPatchOption private constructor( * @param title The title. * @param description A description. * @param required Whether the option is required. - * @param validator The function to validator values of the option. + * @param validator The function to validate the option value. * * @return The created [BooleanArrayPatchOption]. * diff --git a/src/main/kotlin/app/revanced/patcher/patch/options/types/array/FloatArrayPatchOption.kt b/src/main/kotlin/app/revanced/patcher/patch/options/types/array/FloatArrayPatchOption.kt index 890f909..8cb5a66 100644 --- a/src/main/kotlin/app/revanced/patcher/patch/options/types/array/FloatArrayPatchOption.kt +++ b/src/main/kotlin/app/revanced/patcher/patch/options/types/array/FloatArrayPatchOption.kt @@ -11,7 +11,7 @@ import app.revanced.patcher.patch.options.PatchOption * @param title The title. * @param description A description. * @param required Whether the option is required. - * @param validator The function to validator values of the option. + * @param validator The function to validate the option value. * * @see PatchOption */ @@ -32,7 +32,7 @@ class FloatArrayPatchOption private constructor( * @param title The title. * @param description A description. * @param required Whether the option is required. - * @param validator The function to validator values of the option. + * @param validator The function to validate the option value. * * @return The created [FloatArrayPatchOption]. * diff --git a/src/main/kotlin/app/revanced/patcher/patch/options/types/array/IntArrayPatchOption.kt b/src/main/kotlin/app/revanced/patcher/patch/options/types/array/IntArrayPatchOption.kt index dff47d5..cc3e157 100644 --- a/src/main/kotlin/app/revanced/patcher/patch/options/types/array/IntArrayPatchOption.kt +++ b/src/main/kotlin/app/revanced/patcher/patch/options/types/array/IntArrayPatchOption.kt @@ -11,7 +11,7 @@ import app.revanced.patcher.patch.options.PatchOption * @param title The title. * @param description A description. * @param required Whether the option is required. - * @param validator The function to validator values of the option. + * @param validator The function to validate the option value. * * @see PatchOption */ @@ -32,7 +32,7 @@ class IntArrayPatchOption private constructor( * @param title The title. * @param description A description. * @param required Whether the option is required. - * @param validator The function to validator values of the option. + * @param validator The function to validate the option value. * * @return The created [IntArrayPatchOption]. * diff --git a/src/main/kotlin/app/revanced/patcher/patch/options/types/array/LongArrayPatchOption.kt b/src/main/kotlin/app/revanced/patcher/patch/options/types/array/LongArrayPatchOption.kt index 0b6ad8f..5c25f0e 100644 --- a/src/main/kotlin/app/revanced/patcher/patch/options/types/array/LongArrayPatchOption.kt +++ b/src/main/kotlin/app/revanced/patcher/patch/options/types/array/LongArrayPatchOption.kt @@ -11,7 +11,7 @@ import app.revanced.patcher.patch.options.PatchOption * @param title The title. * @param description A description. * @param required Whether the option is required. - * @param validator The function to validator values of the option. + * @param validator The function to validate the option value. * * @see PatchOption */ @@ -32,7 +32,7 @@ class LongArrayPatchOption private constructor( * @param title The title. * @param description A description. * @param required Whether the option is required. - * @param validator The function to validator values of the option. + * @param validator The function to validate the option value. * * @return The created [LongArrayPatchOption]. * diff --git a/src/main/kotlin/app/revanced/patcher/patch/options/types/array/StringArrayPatchOption.kt b/src/main/kotlin/app/revanced/patcher/patch/options/types/array/StringArrayPatchOption.kt index c5d7c55..a1ca299 100644 --- a/src/main/kotlin/app/revanced/patcher/patch/options/types/array/StringArrayPatchOption.kt +++ b/src/main/kotlin/app/revanced/patcher/patch/options/types/array/StringArrayPatchOption.kt @@ -11,7 +11,7 @@ import app.revanced.patcher.patch.options.PatchOption * @param title The title. * @param description A description. * @param required Whether the option is required. - * @param validator The function to validator values of the option. + * @param validator The function to validate the option value. * * @see PatchOption */ @@ -32,7 +32,7 @@ class StringArrayPatchOption private constructor( * @param title The title. * @param description A description. * @param required Whether the option is required. - * @param validator The function to validator values of the option. + * @param validator The function to validate the option value. * * @return The created [StringArrayPatchOption]. * From c7922e90d0c6ae83f513611c706ebea33c1a2b63 Mon Sep 17 00:00:00 2001 From: oSumAtrIX Date: Sat, 21 Oct 2023 23:58:55 +0200 Subject: [PATCH 10/36] feat: Add getter for default option value --- api/revanced-patcher.api | 1 + .../patcher/patch/options/PatchOption.kt | 36 +++++++++++++++++-- 2 files changed, 34 insertions(+), 3 deletions(-) diff --git a/api/revanced-patcher.api b/api/revanced-patcher.api index c4eefa4..bd4b222 100644 --- a/api/revanced-patcher.api +++ b/api/revanced-patcher.api @@ -362,6 +362,7 @@ public abstract interface annotation class app/revanced/patcher/patch/annotation public abstract class app/revanced/patcher/patch/options/PatchOption { public fun (Ljava/lang/String;Ljava/lang/Object;Ljava/lang/String;Ljava/lang/String;ZLkotlin/jvm/functions/Function1;)V + public final fun getDefault ()Ljava/lang/Object; public final fun getDescription ()Ljava/lang/String; public final fun getKey ()Ljava/lang/String; public final fun getRequired ()Z diff --git a/src/main/kotlin/app/revanced/patcher/patch/options/PatchOption.kt b/src/main/kotlin/app/revanced/patcher/patch/options/PatchOption.kt index 9c76c42..e737d52 100644 --- a/src/main/kotlin/app/revanced/patcher/patch/options/PatchOption.kt +++ b/src/main/kotlin/app/revanced/patcher/patch/options/PatchOption.kt @@ -15,7 +15,7 @@ import kotlin.reflect.KProperty */ abstract class PatchOption( val key: String, - default: T?, + val default: T?, val title: String?, val description: String?, val required: Boolean, @@ -25,12 +25,42 @@ abstract class PatchOption( * The value of the [PatchOption]. */ var value: T? = default + /** + * Set the value of the [PatchOption]. + * + * @param value The value to set. + * + * @throws PatchOptionException.ValueRequiredException If the value is required but null. + * @throws PatchOptionException.ValueValidationException If the value is invalid. + */ set(value) { - if (required && value == null) throw PatchOptionException.ValueRequiredException(this) - if (!validator(value)) throw PatchOptionException.ValueValidationException(value, this) + assertRequiredButNotNull(value) + assertValid(value) field = value } + /** + * Get the value of the [PatchOption]. + * + * @return The value. + * + * @throws PatchOptionException.ValueRequiredException If the value is required but null. + * @throws PatchOptionException.ValueValidationException If the value is invalid. + */ + get() { + assertRequiredButNotNull(field) + assertValid(field) + + return field + } + + private fun assertRequiredButNotNull(value: T?) { + if (required && value == null) throw PatchOptionException.ValueRequiredException(this) + } + + private fun assertValid(value: T?) { + if (!validator(value)) throw PatchOptionException.ValueValidationException(value, this) + } operator fun getValue(thisRef: Any?, property: KProperty<*>) = value From e6de90d300bc9c82ca1696cb898db04c65a1cd5b Mon Sep 17 00:00:00 2001 From: oSumAtrIX Date: Sun, 22 Oct 2023 01:03:07 +0200 Subject: [PATCH 11/36] feat: Add function to reset options to their default value --- api/revanced-patcher.api | 1 + .../patcher/patch/options/PatchOption.kt | 20 ++++++++++++++----- 2 files changed, 16 insertions(+), 5 deletions(-) diff --git a/api/revanced-patcher.api b/api/revanced-patcher.api index bd4b222..dccb89d 100644 --- a/api/revanced-patcher.api +++ b/api/revanced-patcher.api @@ -370,6 +370,7 @@ public abstract class app/revanced/patcher/patch/options/PatchOption { public final fun getValidator ()Lkotlin/jvm/functions/Function1; public final fun getValue ()Ljava/lang/Object; public final fun getValue (Ljava/lang/Object;Lkotlin/reflect/KProperty;)Ljava/lang/Object; + public fun reset ()V public final fun setValue (Ljava/lang/Object;)V public final fun setValue (Ljava/lang/Object;Lkotlin/reflect/KProperty;Ljava/lang/Object;)V } diff --git a/src/main/kotlin/app/revanced/patcher/patch/options/PatchOption.kt b/src/main/kotlin/app/revanced/patcher/patch/options/PatchOption.kt index e737d52..62d05ff 100644 --- a/src/main/kotlin/app/revanced/patcher/patch/options/PatchOption.kt +++ b/src/main/kotlin/app/revanced/patcher/patch/options/PatchOption.kt @@ -24,7 +24,7 @@ abstract class PatchOption( /** * The value of the [PatchOption]. */ - var value: T? = default + var value: T? /** * Set the value of the [PatchOption]. * @@ -37,7 +37,7 @@ abstract class PatchOption( assertRequiredButNotNull(value) assertValid(value) - field = value + uncheckedValue = value } /** * Get the value of the [PatchOption]. @@ -48,12 +48,22 @@ abstract class PatchOption( * @throws PatchOptionException.ValueValidationException If the value is invalid. */ get() { - assertRequiredButNotNull(field) - assertValid(field) + assertRequiredButNotNull(uncheckedValue) + assertValid(uncheckedValue) - return field + return uncheckedValue } + // The unchecked value is used to allow setting the value without validation. + private var uncheckedValue = default + + /** + * Reset the [PatchOption] to its default value. + */ + open fun reset() { + uncheckedValue = default + } + private fun assertRequiredButNotNull(value: T?) { if (required && value == null) throw PatchOptionException.ValueRequiredException(this) } From ebbaafb78e88f34faeafe9ff8532afe29231bd79 Mon Sep 17 00:00:00 2001 From: oSumAtrIX Date: Sun, 22 Oct 2023 01:14:48 +0200 Subject: [PATCH 12/36] feat: Add function to reset options to their default value --- .../kotlin/app/revanced/patcher/patch/options/PatchOption.kt | 1 + 1 file changed, 1 insertion(+) diff --git a/src/main/kotlin/app/revanced/patcher/patch/options/PatchOption.kt b/src/main/kotlin/app/revanced/patcher/patch/options/PatchOption.kt index 62d05ff..db95ee4 100644 --- a/src/main/kotlin/app/revanced/patcher/patch/options/PatchOption.kt +++ b/src/main/kotlin/app/revanced/patcher/patch/options/PatchOption.kt @@ -59,6 +59,7 @@ abstract class PatchOption( /** * Reset the [PatchOption] to its default value. + * Override this method if you need to mutate the value instead of replacing it. */ open fun reset() { uncheckedValue = default From 09cd6aa568988dd5241bfa6a2e12b7926a7b0683 Mon Sep 17 00:00:00 2001 From: oSumAtrIX Date: Sun, 22 Oct 2023 01:54:33 +0200 Subject: [PATCH 13/36] refactor: Change `PatchOption` from abstract to open class BREAKING CHANGE: This gets rid of the existing basic implementations of the `PatchOptions` type and moves extension functions. --- api/revanced-patcher.api | 126 ++------- .../patcher/patch/options/PatchOption.kt | 239 +++++++++++++++++- .../patch/options/types/BooleanPatchOption.kt | 49 ---- .../patch/options/types/FloatPatchOption.kt | 51 ---- .../patch/options/types/IntPatchOption.kt | 51 ---- .../patch/options/types/LongPatchOption.kt | 49 ---- .../patch/options/types/StringPatchOption.kt | 51 ---- .../types/array/BooleanArrayPatchOption.kt | 51 ---- .../types/array/FloatArrayPatchOption.kt | 51 ---- .../types/array/IntArrayPatchOption.kt | 51 ---- .../types/array/LongArrayPatchOption.kt | 51 ---- .../types/array/StringArrayPatchOption.kt | 51 ---- .../patcher/patch/options/PatchOptionsTest.kt | 6 +- 13 files changed, 266 insertions(+), 611 deletions(-) delete mode 100644 src/main/kotlin/app/revanced/patcher/patch/options/types/BooleanPatchOption.kt delete mode 100644 src/main/kotlin/app/revanced/patcher/patch/options/types/FloatPatchOption.kt delete mode 100644 src/main/kotlin/app/revanced/patcher/patch/options/types/IntPatchOption.kt delete mode 100644 src/main/kotlin/app/revanced/patcher/patch/options/types/LongPatchOption.kt delete mode 100644 src/main/kotlin/app/revanced/patcher/patch/options/types/StringPatchOption.kt delete mode 100644 src/main/kotlin/app/revanced/patcher/patch/options/types/array/BooleanArrayPatchOption.kt delete mode 100644 src/main/kotlin/app/revanced/patcher/patch/options/types/array/FloatArrayPatchOption.kt delete mode 100644 src/main/kotlin/app/revanced/patcher/patch/options/types/array/IntArrayPatchOption.kt delete mode 100644 src/main/kotlin/app/revanced/patcher/patch/options/types/array/LongArrayPatchOption.kt delete mode 100644 src/main/kotlin/app/revanced/patcher/patch/options/types/array/StringArrayPatchOption.kt diff --git a/api/revanced-patcher.api b/api/revanced-patcher.api index dccb89d..6d4992e 100644 --- a/api/revanced-patcher.api +++ b/api/revanced-patcher.api @@ -360,7 +360,8 @@ public abstract interface annotation class app/revanced/patcher/patch/annotation public abstract fun use ()Z } -public abstract class app/revanced/patcher/patch/options/PatchOption { +public class app/revanced/patcher/patch/options/PatchOption { + public static final field PatchExtensions Lapp/revanced/patcher/patch/options/PatchOption$PatchExtensions; public fun (Ljava/lang/String;Ljava/lang/Object;Ljava/lang/String;Ljava/lang/String;ZLkotlin/jvm/functions/Function1;)V public final fun getDefault ()Ljava/lang/Object; public final fun getDescription ()Ljava/lang/String; @@ -375,6 +376,29 @@ public abstract class app/revanced/patcher/patch/options/PatchOption { public final fun setValue (Ljava/lang/Object;Lkotlin/reflect/KProperty;Ljava/lang/Object;)V } +public final class app/revanced/patcher/patch/options/PatchOption$PatchExtensions { + public final fun booleanArrayPatchOption (Lapp/revanced/patcher/patch/Patch;Ljava/lang/String;[Ljava/lang/Boolean;Ljava/lang/String;Ljava/lang/String;ZLkotlin/jvm/functions/Function1;)Lapp/revanced/patcher/patch/options/PatchOption; + public static synthetic fun booleanArrayPatchOption$default (Lapp/revanced/patcher/patch/options/PatchOption$PatchExtensions;Lapp/revanced/patcher/patch/Patch;Ljava/lang/String;[Ljava/lang/Boolean;Ljava/lang/String;Ljava/lang/String;ZLkotlin/jvm/functions/Function1;ILjava/lang/Object;)Lapp/revanced/patcher/patch/options/PatchOption; + public final fun booleanPatchOption (Lapp/revanced/patcher/patch/Patch;Ljava/lang/String;Ljava/lang/Boolean;Ljava/lang/String;Ljava/lang/String;ZLkotlin/jvm/functions/Function1;)Lapp/revanced/patcher/patch/options/PatchOption; + public static synthetic fun booleanPatchOption$default (Lapp/revanced/patcher/patch/options/PatchOption$PatchExtensions;Lapp/revanced/patcher/patch/Patch;Ljava/lang/String;Ljava/lang/Boolean;Ljava/lang/String;Ljava/lang/String;ZLkotlin/jvm/functions/Function1;ILjava/lang/Object;)Lapp/revanced/patcher/patch/options/PatchOption; + public final fun floatArrayPatchOption (Lapp/revanced/patcher/patch/Patch;Ljava/lang/String;[Ljava/lang/Float;Ljava/lang/String;Ljava/lang/String;ZLkotlin/jvm/functions/Function1;)Lapp/revanced/patcher/patch/options/PatchOption; + public static synthetic fun floatArrayPatchOption$default (Lapp/revanced/patcher/patch/options/PatchOption$PatchExtensions;Lapp/revanced/patcher/patch/Patch;Ljava/lang/String;[Ljava/lang/Float;Ljava/lang/String;Ljava/lang/String;ZLkotlin/jvm/functions/Function1;ILjava/lang/Object;)Lapp/revanced/patcher/patch/options/PatchOption; + public final fun floatPatchOption (Lapp/revanced/patcher/patch/Patch;Ljava/lang/String;Ljava/lang/Float;Ljava/lang/String;Ljava/lang/String;ZLkotlin/jvm/functions/Function1;)Lapp/revanced/patcher/patch/options/PatchOption; + public static synthetic fun floatPatchOption$default (Lapp/revanced/patcher/patch/options/PatchOption$PatchExtensions;Lapp/revanced/patcher/patch/Patch;Ljava/lang/String;Ljava/lang/Float;Ljava/lang/String;Ljava/lang/String;ZLkotlin/jvm/functions/Function1;ILjava/lang/Object;)Lapp/revanced/patcher/patch/options/PatchOption; + public final fun intArrayPatchOption (Lapp/revanced/patcher/patch/Patch;Ljava/lang/String;[Ljava/lang/Integer;Ljava/lang/String;Ljava/lang/String;ZLkotlin/jvm/functions/Function1;)Lapp/revanced/patcher/patch/options/PatchOption; + public static synthetic fun intArrayPatchOption$default (Lapp/revanced/patcher/patch/options/PatchOption$PatchExtensions;Lapp/revanced/patcher/patch/Patch;Ljava/lang/String;[Ljava/lang/Integer;Ljava/lang/String;Ljava/lang/String;ZLkotlin/jvm/functions/Function1;ILjava/lang/Object;)Lapp/revanced/patcher/patch/options/PatchOption; + public final fun intPatchOption (Lapp/revanced/patcher/patch/Patch;Ljava/lang/String;Ljava/lang/Integer;Ljava/lang/String;Ljava/lang/String;ZLkotlin/jvm/functions/Function1;)Lapp/revanced/patcher/patch/options/PatchOption; + public static synthetic fun intPatchOption$default (Lapp/revanced/patcher/patch/options/PatchOption$PatchExtensions;Lapp/revanced/patcher/patch/Patch;Ljava/lang/String;Ljava/lang/Integer;Ljava/lang/String;Ljava/lang/String;ZLkotlin/jvm/functions/Function1;ILjava/lang/Object;)Lapp/revanced/patcher/patch/options/PatchOption; + public final fun longArrayPatchOption (Lapp/revanced/patcher/patch/Patch;Ljava/lang/String;[Ljava/lang/Long;Ljava/lang/String;Ljava/lang/String;ZLkotlin/jvm/functions/Function1;)Lapp/revanced/patcher/patch/options/PatchOption; + public static synthetic fun longArrayPatchOption$default (Lapp/revanced/patcher/patch/options/PatchOption$PatchExtensions;Lapp/revanced/patcher/patch/Patch;Ljava/lang/String;[Ljava/lang/Long;Ljava/lang/String;Ljava/lang/String;ZLkotlin/jvm/functions/Function1;ILjava/lang/Object;)Lapp/revanced/patcher/patch/options/PatchOption; + public final fun longPatchOption (Lapp/revanced/patcher/patch/Patch;Ljava/lang/String;Ljava/lang/Long;Ljava/lang/String;Ljava/lang/String;ZLkotlin/jvm/functions/Function1;)Lapp/revanced/patcher/patch/options/PatchOption; + public static synthetic fun longPatchOption$default (Lapp/revanced/patcher/patch/options/PatchOption$PatchExtensions;Lapp/revanced/patcher/patch/Patch;Ljava/lang/String;Ljava/lang/Long;Ljava/lang/String;Ljava/lang/String;ZLkotlin/jvm/functions/Function1;ILjava/lang/Object;)Lapp/revanced/patcher/patch/options/PatchOption; + public final fun stringArrayPatchOption (Lapp/revanced/patcher/patch/Patch;Ljava/lang/String;[Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;ZLkotlin/jvm/functions/Function1;)Lapp/revanced/patcher/patch/options/PatchOption; + public static synthetic fun stringArrayPatchOption$default (Lapp/revanced/patcher/patch/options/PatchOption$PatchExtensions;Lapp/revanced/patcher/patch/Patch;Ljava/lang/String;[Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;ZLkotlin/jvm/functions/Function1;ILjava/lang/Object;)Lapp/revanced/patcher/patch/options/PatchOption; + public final fun stringPatchOption (Lapp/revanced/patcher/patch/Patch;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;ZLkotlin/jvm/functions/Function1;)Lapp/revanced/patcher/patch/options/PatchOption; + public static synthetic fun stringPatchOption$default (Lapp/revanced/patcher/patch/options/PatchOption$PatchExtensions;Lapp/revanced/patcher/patch/Patch;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;ZLkotlin/jvm/functions/Function1;ILjava/lang/Object;)Lapp/revanced/patcher/patch/options/PatchOption; +} + public abstract class app/revanced/patcher/patch/options/PatchOptionException : java/lang/Exception { public synthetic fun (Ljava/lang/String;Lkotlin/jvm/internal/DefaultConstructorMarker;)V } @@ -424,106 +448,6 @@ public final class app/revanced/patcher/patch/options/PatchOptions : java/util/M public final fun values ()Ljava/util/Collection; } -public final class app/revanced/patcher/patch/options/types/BooleanPatchOption : app/revanced/patcher/patch/options/PatchOption { - public static final field Companion Lapp/revanced/patcher/patch/options/types/BooleanPatchOption$Companion; - public synthetic fun (Ljava/lang/String;Ljava/lang/Boolean;Ljava/lang/String;Ljava/lang/String;ZLkotlin/jvm/functions/Function1;Lkotlin/jvm/internal/DefaultConstructorMarker;)V -} - -public final class app/revanced/patcher/patch/options/types/BooleanPatchOption$Companion { - public final fun booleanPatchOption (Lapp/revanced/patcher/patch/Patch;Ljava/lang/String;Ljava/lang/Boolean;Ljava/lang/String;Ljava/lang/String;ZLkotlin/jvm/functions/Function1;)Lapp/revanced/patcher/patch/options/types/BooleanPatchOption; - public static synthetic fun booleanPatchOption$default (Lapp/revanced/patcher/patch/options/types/BooleanPatchOption$Companion;Lapp/revanced/patcher/patch/Patch;Ljava/lang/String;Ljava/lang/Boolean;Ljava/lang/String;Ljava/lang/String;ZLkotlin/jvm/functions/Function1;ILjava/lang/Object;)Lapp/revanced/patcher/patch/options/types/BooleanPatchOption; -} - -public final class app/revanced/patcher/patch/options/types/FloatPatchOption : app/revanced/patcher/patch/options/PatchOption { - public static final field Companion Lapp/revanced/patcher/patch/options/types/FloatPatchOption$Companion; - public synthetic fun (Ljava/lang/String;Ljava/lang/Float;Ljava/lang/String;Ljava/lang/String;ZLkotlin/jvm/functions/Function1;Lkotlin/jvm/internal/DefaultConstructorMarker;)V -} - -public final class app/revanced/patcher/patch/options/types/FloatPatchOption$Companion { - public final fun floatPatchOption (Lapp/revanced/patcher/patch/Patch;Ljava/lang/String;Ljava/lang/Float;Ljava/lang/String;Ljava/lang/String;ZLkotlin/jvm/functions/Function1;)Lapp/revanced/patcher/patch/options/types/FloatPatchOption; - public static synthetic fun floatPatchOption$default (Lapp/revanced/patcher/patch/options/types/FloatPatchOption$Companion;Lapp/revanced/patcher/patch/Patch;Ljava/lang/String;Ljava/lang/Float;Ljava/lang/String;Ljava/lang/String;ZLkotlin/jvm/functions/Function1;ILjava/lang/Object;)Lapp/revanced/patcher/patch/options/types/FloatPatchOption; -} - -public final class app/revanced/patcher/patch/options/types/IntPatchOption : app/revanced/patcher/patch/options/PatchOption { - public static final field Companion Lapp/revanced/patcher/patch/options/types/IntPatchOption$Companion; - public synthetic fun (Ljava/lang/String;Ljava/lang/Integer;Ljava/lang/String;Ljava/lang/String;ZLkotlin/jvm/functions/Function1;Lkotlin/jvm/internal/DefaultConstructorMarker;)V -} - -public final class app/revanced/patcher/patch/options/types/IntPatchOption$Companion { - public final fun intPatchOption (Lapp/revanced/patcher/patch/Patch;Ljava/lang/String;Ljava/lang/Integer;Ljava/lang/String;Ljava/lang/String;ZLkotlin/jvm/functions/Function1;)Lapp/revanced/patcher/patch/options/types/IntPatchOption; - public static synthetic fun intPatchOption$default (Lapp/revanced/patcher/patch/options/types/IntPatchOption$Companion;Lapp/revanced/patcher/patch/Patch;Ljava/lang/String;Ljava/lang/Integer;Ljava/lang/String;Ljava/lang/String;ZLkotlin/jvm/functions/Function1;ILjava/lang/Object;)Lapp/revanced/patcher/patch/options/types/IntPatchOption; -} - -public final class app/revanced/patcher/patch/options/types/LongPatchOption : app/revanced/patcher/patch/options/PatchOption { - public static final field Companion Lapp/revanced/patcher/patch/options/types/LongPatchOption$Companion; - public synthetic fun (Ljava/lang/String;Ljava/lang/Long;Ljava/lang/String;Ljava/lang/String;ZLkotlin/jvm/functions/Function1;Lkotlin/jvm/internal/DefaultConstructorMarker;)V -} - -public final class app/revanced/patcher/patch/options/types/LongPatchOption$Companion { - public final fun longPatchOption (Lapp/revanced/patcher/patch/Patch;Ljava/lang/String;Ljava/lang/Long;Ljava/lang/String;Ljava/lang/String;ZLkotlin/jvm/functions/Function1;)Lapp/revanced/patcher/patch/options/types/LongPatchOption; - public static synthetic fun longPatchOption$default (Lapp/revanced/patcher/patch/options/types/LongPatchOption$Companion;Lapp/revanced/patcher/patch/Patch;Ljava/lang/String;Ljava/lang/Long;Ljava/lang/String;Ljava/lang/String;ZLkotlin/jvm/functions/Function1;ILjava/lang/Object;)Lapp/revanced/patcher/patch/options/types/LongPatchOption; -} - -public final class app/revanced/patcher/patch/options/types/StringPatchOption : app/revanced/patcher/patch/options/PatchOption { - public static final field Companion Lapp/revanced/patcher/patch/options/types/StringPatchOption$Companion; - public synthetic fun (Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;ZLkotlin/jvm/functions/Function1;Lkotlin/jvm/internal/DefaultConstructorMarker;)V -} - -public final class app/revanced/patcher/patch/options/types/StringPatchOption$Companion { - public final fun stringPatchOption (Lapp/revanced/patcher/patch/Patch;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;ZLkotlin/jvm/functions/Function1;)Lapp/revanced/patcher/patch/options/types/StringPatchOption; - public static synthetic fun stringPatchOption$default (Lapp/revanced/patcher/patch/options/types/StringPatchOption$Companion;Lapp/revanced/patcher/patch/Patch;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;ZLkotlin/jvm/functions/Function1;ILjava/lang/Object;)Lapp/revanced/patcher/patch/options/types/StringPatchOption; -} - -public final class app/revanced/patcher/patch/options/types/array/BooleanArrayPatchOption : app/revanced/patcher/patch/options/PatchOption { - public static final field Companion Lapp/revanced/patcher/patch/options/types/array/BooleanArrayPatchOption$Companion; - public synthetic fun (Ljava/lang/String;[Ljava/lang/Boolean;Ljava/lang/String;Ljava/lang/String;ZLkotlin/jvm/functions/Function1;Lkotlin/jvm/internal/DefaultConstructorMarker;)V -} - -public final class app/revanced/patcher/patch/options/types/array/BooleanArrayPatchOption$Companion { - public final fun booleanArrayPatchOption (Lapp/revanced/patcher/patch/Patch;Ljava/lang/String;[Ljava/lang/Boolean;Ljava/lang/String;Ljava/lang/String;ZLkotlin/jvm/functions/Function1;)Lapp/revanced/patcher/patch/options/types/array/BooleanArrayPatchOption; - public static synthetic fun booleanArrayPatchOption$default (Lapp/revanced/patcher/patch/options/types/array/BooleanArrayPatchOption$Companion;Lapp/revanced/patcher/patch/Patch;Ljava/lang/String;[Ljava/lang/Boolean;Ljava/lang/String;Ljava/lang/String;ZLkotlin/jvm/functions/Function1;ILjava/lang/Object;)Lapp/revanced/patcher/patch/options/types/array/BooleanArrayPatchOption; -} - -public final class app/revanced/patcher/patch/options/types/array/FloatArrayPatchOption : app/revanced/patcher/patch/options/PatchOption { - public static final field Companion Lapp/revanced/patcher/patch/options/types/array/FloatArrayPatchOption$Companion; - public synthetic fun (Ljava/lang/String;[Ljava/lang/Float;Ljava/lang/String;Ljava/lang/String;ZLkotlin/jvm/functions/Function1;Lkotlin/jvm/internal/DefaultConstructorMarker;)V -} - -public final class app/revanced/patcher/patch/options/types/array/FloatArrayPatchOption$Companion { - public final fun floatArrayPatchOption (Lapp/revanced/patcher/patch/Patch;Ljava/lang/String;[Ljava/lang/Float;Ljava/lang/String;Ljava/lang/String;ZLkotlin/jvm/functions/Function1;)Lapp/revanced/patcher/patch/options/types/array/FloatArrayPatchOption; - public static synthetic fun floatArrayPatchOption$default (Lapp/revanced/patcher/patch/options/types/array/FloatArrayPatchOption$Companion;Lapp/revanced/patcher/patch/Patch;Ljava/lang/String;[Ljava/lang/Float;Ljava/lang/String;Ljava/lang/String;ZLkotlin/jvm/functions/Function1;ILjava/lang/Object;)Lapp/revanced/patcher/patch/options/types/array/FloatArrayPatchOption; -} - -public final class app/revanced/patcher/patch/options/types/array/IntArrayPatchOption : app/revanced/patcher/patch/options/PatchOption { - public static final field Companion Lapp/revanced/patcher/patch/options/types/array/IntArrayPatchOption$Companion; - public synthetic fun (Ljava/lang/String;[Ljava/lang/Integer;Ljava/lang/String;Ljava/lang/String;ZLkotlin/jvm/functions/Function1;Lkotlin/jvm/internal/DefaultConstructorMarker;)V -} - -public final class app/revanced/patcher/patch/options/types/array/IntArrayPatchOption$Companion { - public final fun intArrayPatchOption (Lapp/revanced/patcher/patch/Patch;Ljava/lang/String;[Ljava/lang/Integer;Ljava/lang/String;Ljava/lang/String;ZLkotlin/jvm/functions/Function1;)Lapp/revanced/patcher/patch/options/types/array/IntArrayPatchOption; - public static synthetic fun intArrayPatchOption$default (Lapp/revanced/patcher/patch/options/types/array/IntArrayPatchOption$Companion;Lapp/revanced/patcher/patch/Patch;Ljava/lang/String;[Ljava/lang/Integer;Ljava/lang/String;Ljava/lang/String;ZLkotlin/jvm/functions/Function1;ILjava/lang/Object;)Lapp/revanced/patcher/patch/options/types/array/IntArrayPatchOption; -} - -public final class app/revanced/patcher/patch/options/types/array/LongArrayPatchOption : app/revanced/patcher/patch/options/PatchOption { - public static final field Companion Lapp/revanced/patcher/patch/options/types/array/LongArrayPatchOption$Companion; - public synthetic fun (Ljava/lang/String;[Ljava/lang/Long;Ljava/lang/String;Ljava/lang/String;ZLkotlin/jvm/functions/Function1;Lkotlin/jvm/internal/DefaultConstructorMarker;)V -} - -public final class app/revanced/patcher/patch/options/types/array/LongArrayPatchOption$Companion { - public final fun longArrayPatchOption (Lapp/revanced/patcher/patch/Patch;Ljava/lang/String;[Ljava/lang/Long;Ljava/lang/String;Ljava/lang/String;ZLkotlin/jvm/functions/Function1;)Lapp/revanced/patcher/patch/options/types/array/LongArrayPatchOption; - public static synthetic fun longArrayPatchOption$default (Lapp/revanced/patcher/patch/options/types/array/LongArrayPatchOption$Companion;Lapp/revanced/patcher/patch/Patch;Ljava/lang/String;[Ljava/lang/Long;Ljava/lang/String;Ljava/lang/String;ZLkotlin/jvm/functions/Function1;ILjava/lang/Object;)Lapp/revanced/patcher/patch/options/types/array/LongArrayPatchOption; -} - -public final class app/revanced/patcher/patch/options/types/array/StringArrayPatchOption : app/revanced/patcher/patch/options/PatchOption { - public static final field Companion Lapp/revanced/patcher/patch/options/types/array/StringArrayPatchOption$Companion; - public synthetic fun (Ljava/lang/String;[Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;ZLkotlin/jvm/functions/Function1;Lkotlin/jvm/internal/DefaultConstructorMarker;)V -} - -public final class app/revanced/patcher/patch/options/types/array/StringArrayPatchOption$Companion { - public final fun stringArrayPatchOption (Lapp/revanced/patcher/patch/Patch;Ljava/lang/String;[Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;ZLkotlin/jvm/functions/Function1;)Lapp/revanced/patcher/patch/options/types/array/StringArrayPatchOption; - public static synthetic fun stringArrayPatchOption$default (Lapp/revanced/patcher/patch/options/types/array/StringArrayPatchOption$Companion;Lapp/revanced/patcher/patch/Patch;Ljava/lang/String;[Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;ZLkotlin/jvm/functions/Function1;ILjava/lang/Object;)Lapp/revanced/patcher/patch/options/types/array/StringArrayPatchOption; -} - public final class app/revanced/patcher/util/DomFileEditor : java/io/Closeable { public fun (Ljava/io/File;)V public fun close ()V diff --git a/src/main/kotlin/app/revanced/patcher/patch/options/PatchOption.kt b/src/main/kotlin/app/revanced/patcher/patch/options/PatchOption.kt index db95ee4..7ddb658 100644 --- a/src/main/kotlin/app/revanced/patcher/patch/options/PatchOption.kt +++ b/src/main/kotlin/app/revanced/patcher/patch/options/PatchOption.kt @@ -5,6 +5,7 @@ import kotlin.reflect.KProperty /** * A [Patch] option. + * * @param key The identifier. * @param default The default value. * @param title The title. @@ -13,7 +14,8 @@ import kotlin.reflect.KProperty * @param validator The function to validate the option value. * @param T The value type of the option. */ -abstract class PatchOption( +@Suppress("MemberVisibilityCanBePrivate", "unused") +open class PatchOption( val key: String, val default: T?, val title: String?, @@ -78,4 +80,239 @@ abstract class PatchOption( operator fun setValue(thisRef: Any?, property: KProperty<*>, value: T?) { this.value = value } + + @Suppress("unused") + companion object PatchExtensions { + /** + * Create a new [PatchOption] with a string value and add it to the current [Patch]. + * + * @param key The identifier. + * @param default The default value. + * @param title The title. + * @param description A description. + * @param required Whether the option is required. + * @param validator The function to validate the option value. + * + * @return The created [PatchOption]. + * + * @see PatchOption + */ + fun

> P.stringPatchOption( + key: String, + default: String? = null, + title: String? = null, + description: String? = null, + required: Boolean = false, + validator: (String?) -> Boolean = { true } + ) = PatchOption(key, default, title, description, required, validator).also { registerOption(it) } + + /** + * Create a new [PatchOption] with an integer value and add it to the current [Patch]. + * + * @param key The identifier. + * @param default The default value. + * @param title The title. + * @param description A description. + * @param required Whether the option is required. + * @param validator The function to validate the option value. + * + * @return The created [PatchOption]. + * + * @see PatchOption + */ + fun

> P.intPatchOption( + key: String, + default: Int? = null, + title: String? = null, + description: String? = null, + required: Boolean = false, + validator: (Int?) -> Boolean = { true } + ) = PatchOption(key, default, title, description, required, validator).also { registerOption(it) } + + /** + * Create a new [PatchOption] with a boolean value and add it to the current [Patch]. + * + * @param key The identifier. + * @param default The default value. + * @param title The title. + * @param description A description. + * @param required Whether the option is required. + * @param validator The function to validate the option value. + * + * @return The created [PatchOption]. + * + * @see PatchOption + */ + fun

> P.booleanPatchOption( + key: String, + default: Boolean? = null, + title: String? = null, + description: String? = null, + required: Boolean = false, + validator: (Boolean?) -> Boolean = { true } + ) = PatchOption(key, default, title, description, required, validator).also { registerOption(it) } + + /** + * Create a new [PatchOption] with a float value and add it to the current [Patch]. + * + * @param key The identifier. + * @param default The default value. + * @param title The title. + * @param description A description. + * @param required Whether the option is required. + * @param validator The function to validate the option value. + * + * @return The created [PatchOption]. + * + * @see PatchOption + */ + fun

> P.floatPatchOption( + key: String, + default: Float? = null, + title: String? = null, + description: String? = null, + required: Boolean = false, + validator: (Float?) -> Boolean = { true } + ) = PatchOption(key, default, title, description, required, validator).also { registerOption(it) } + + /** + * Create a new [PatchOption] with a long value and add it to the current [Patch]. + * + * @param key The identifier. + * @param default The default value. + * @param title The title. + * @param description A description. + * @param required Whether the option is required. + * @param validator The function to validate the option value. + * + * @return The created [PatchOption]. + * + * @see PatchOption + */ + fun

> P.longPatchOption( + key: String, + default: Long? = null, + title: String? = null, + description: String? = null, + required: Boolean = false, + validator: (Long?) -> Boolean = { true } + ) = PatchOption(key, default, title, description, required, validator).also { registerOption(it) } + + /** + * Create a new [PatchOption] with a string array value and add it to the current [Patch]. + * + * @param key The identifier. + * @param default The default value. + * @param title The title. + * @param description A description. + * @param required Whether the option is required. + * @param validator The function to validate the option value. + * + * @return The created [PatchOption]. + * + * @see PatchOption + */ + fun

> P.stringArrayPatchOption( + key: String, + default: Array? = null, + title: String? = null, + description: String? = null, + required: Boolean = false, + validator: (Array?) -> Boolean = { true } + ) = PatchOption(key, default, title, description, required, validator).also { registerOption(it) } + + /** + * Create a new [PatchOption] with an integer array value and add it to the current [Patch]. + * + * @param key The identifier. + * @param default The default value. + * @param title The title. + * @param description A description. + * @param required Whether the option is required. + * @param validator The function to validate the option value. + * + * @return The created [PatchOption]. + * + * @see PatchOption + */ + fun

> P.intArrayPatchOption( + key: String, + default: Array? = null, + title: String? = null, + description: String? = null, + required: Boolean = false, + validator: (Array?) -> Boolean = { true } + ) = PatchOption(key, default, title, description, required, validator).also { registerOption(it) } + + /** + * Create a new [PatchOption] with a boolean array value and add it to the current [Patch]. + * + * @param key The identifier. + * @param default The default value. + * @param title The title. + * @param description A description. + * @param required Whether the option is required. + * @param validator The function to validate the option value. + * + * @return The created [PatchOption]. + * + * @see PatchOption + */ + fun

> P.booleanArrayPatchOption( + key: String, + default: Array? = null, + title: String? = null, + description: String? = null, + required: Boolean = false, + validator: (Array?) -> Boolean = { true } + ) = PatchOption(key, default, title, description, required, validator).also { registerOption(it) } + + /** + * Create a new [PatchOption] with a float array value and add it to the current [Patch]. + * + * @param key The identifier. + * @param default The default value. + * @param title The title. + * @param description A description. + * @param required Whether the option is required. + * @param validator The function to validate the option value. + * + * @return The created [PatchOption]. + * + * @see PatchOption + */ + fun

> P.floatArrayPatchOption( + key: String, + default: Array? = null, + title: String? = null, + description: String? = null, + required: Boolean = false, + validator: (Array?) -> Boolean = { true } + ) = PatchOption(key, default, title, description, required, validator).also { registerOption(it) } + + /** + * Create a new [PatchOption] with a long array value and add it to the current [Patch]. + * + * @param key The identifier. + * @param default The default value. + * @param title The title. + * @param description A description. + * @param required Whether the option is required. + * @param validator The function to validate the option value. + * + * @return The created [PatchOption]. + * + * @see PatchOption + */ + fun

> P.longArrayPatchOption( + key: String, + default: Array? = null, + title: String? = null, + description: String? = null, + required: Boolean = false, + validator: (Array?) -> Boolean = { true } + ) = PatchOption(key, default, title, description, required, validator).also { registerOption(it) } + + private fun

> P.registerOption(option: PatchOption<*>) = option.also { options.register(it) } + } } \ No newline at end of file diff --git a/src/main/kotlin/app/revanced/patcher/patch/options/types/BooleanPatchOption.kt b/src/main/kotlin/app/revanced/patcher/patch/options/types/BooleanPatchOption.kt deleted file mode 100644 index 7744002..0000000 --- a/src/main/kotlin/app/revanced/patcher/patch/options/types/BooleanPatchOption.kt +++ /dev/null @@ -1,49 +0,0 @@ -package app.revanced.patcher.patch.options.types - -import app.revanced.patcher.patch.Patch -import app.revanced.patcher.patch.options.PatchOption - -/** - * A [PatchOption] representing a [Boolean]. - * - * @param key The identifier. - * @param default The default value. - * @param title The title. - * @param description A description. - * @param required Whether the option is required. - * @param validator The function to validate the option value. - * - * @see PatchOption - */ -class BooleanPatchOption private constructor( - key: String, - default: Boolean?, - title: String?, - description: String?, - required: Boolean, - validator: (Boolean?) -> Boolean -) : PatchOption(key, default, title, description, required, validator) { - companion object { - /** - * Create a new [BooleanPatchOption] and add it to the current [Patch]. - * - * @param key The identifier. - * @param default The default value. - * @param title The title. - * @param description A description. - * @param required Whether the option is required. - * @return The created [BooleanPatchOption]. - * - * @see BooleanPatchOption - * @see PatchOption - */ - fun > T.booleanPatchOption( - key: String, - default: Boolean? = null, - title: String? = null, - description: String? = null, - required: Boolean = false, - validator: (Boolean?) -> Boolean = { true } - ) = BooleanPatchOption(key, default, title, description, required, validator).also { options.register(it) } - } -} diff --git a/src/main/kotlin/app/revanced/patcher/patch/options/types/FloatPatchOption.kt b/src/main/kotlin/app/revanced/patcher/patch/options/types/FloatPatchOption.kt deleted file mode 100644 index 8afd2dd..0000000 --- a/src/main/kotlin/app/revanced/patcher/patch/options/types/FloatPatchOption.kt +++ /dev/null @@ -1,51 +0,0 @@ -package app.revanced.patcher.patch.options.types - -import app.revanced.patcher.patch.Patch -import app.revanced.patcher.patch.options.PatchOption - -/** - * A [PatchOption] representing a [Float]. - * - * @param key The identifier. - * @param default The default value. - * @param title The title. - * @param description A description. - * @param required Whether the option is required. - * @param validator The function to validate the option value. - * - * @see PatchOption - */ -class FloatPatchOption private constructor( - key: String, - default: Float?, - title: String?, - description: String?, - required: Boolean, - validator: (Float?) -> Boolean -) : PatchOption(key, default, title, description, required, validator) { - companion object { - /** - * Create a new [FloatPatchOption] and add it to the current [Patch]. - * - * @param key The identifier. - * @param default The default value. - * @param title The title. - * @param description A description. - * @param required Whether the option is required. - * @param validator The function to validate the option value. - * - * @return The created [FloatPatchOption]. - * - * @see FloatPatchOption - * @see PatchOption - */ - fun > T.floatPatchOption( - key: String, - default: Float? = null, - title: String? = null, - description: String? = null, - required: Boolean = false, - validator: (Float?) -> Boolean = { true } - ) = FloatPatchOption(key, default, title, description, required, validator).also { options.register(it) } - } -} diff --git a/src/main/kotlin/app/revanced/patcher/patch/options/types/IntPatchOption.kt b/src/main/kotlin/app/revanced/patcher/patch/options/types/IntPatchOption.kt deleted file mode 100644 index f59ea86..0000000 --- a/src/main/kotlin/app/revanced/patcher/patch/options/types/IntPatchOption.kt +++ /dev/null @@ -1,51 +0,0 @@ -package app.revanced.patcher.patch.options.types - -import app.revanced.patcher.patch.Patch -import app.revanced.patcher.patch.options.PatchOption - -/** - * A [PatchOption] representing an [Integer]. - * - * @param key The identifier. - * @param default The default value. - * @param title The title. - * @param description A description. - * @param required Whether the option is required. - * @param validator The function to validate the option value. - * - * @see PatchOption - */ -class IntPatchOption private constructor( - key: String, - default: Int?, - title: String?, - description: String?, - required: Boolean, - validator: (Int?) -> Boolean -) : PatchOption(key, default, title, description, required, validator) { - companion object { - /** - * Create a new [IntPatchOption] and add it to the current [Patch]. - * - * @param key The identifier. - * @param default The default value. - * @param title The title. - * @param description A description. - * @param required Whether the option is required. - * @param validator The function to validate the option value. - * - * @return The created [IntPatchOption]. - * - * @see IntPatchOption - * @see PatchOption - */ - fun > T.intPatchOption( - key: String, - default: Int? = null, - title: String? = null, - description: String? = null, - required: Boolean = false, - validator: (Int?) -> Boolean = { true } - ) = IntPatchOption(key, default, title, description, required, validator).also { options.register(it) } - } -} diff --git a/src/main/kotlin/app/revanced/patcher/patch/options/types/LongPatchOption.kt b/src/main/kotlin/app/revanced/patcher/patch/options/types/LongPatchOption.kt deleted file mode 100644 index ca8d613..0000000 --- a/src/main/kotlin/app/revanced/patcher/patch/options/types/LongPatchOption.kt +++ /dev/null @@ -1,49 +0,0 @@ -package app.revanced.patcher.patch.options.types - -import app.revanced.patcher.patch.Patch -import app.revanced.patcher.patch.options.PatchOption - -/** - * A [PatchOption] representing a [Long]. - * - * @param key The identifier. - * @param default The default value. - * @param title The title. - * @param description A description. - * @param required Whether the option is required. - * @param validator The function to validate the option value. - * - * @see PatchOption - */ -class LongPatchOption private constructor( - key: String, - default: Long?, - title: String?, - description: String?, - required: Boolean, - validator: (Long?) -> Boolean -) : PatchOption(key, default, title, description, required, validator) { - companion object { - /** - * Create a new [LongPatchOption] and add it to the current [Patch]. - * - * @param key The identifier. - * @param default The default value. - * @param title The title. - * @param description A description. - * @param required Whether the option is required. - * @return The created [LongPatchOption]. - * - * @see LongPatchOption - * @see PatchOption - */ - fun > T.longPatchOption( - key: String, - default: Long? = null, - title: String? = null, - description: String? = null, - required: Boolean = false, - validator: (Long?) -> Boolean = { true } - ) = LongPatchOption(key, default, title, description, required, validator).also { options.register(it) } - } -} diff --git a/src/main/kotlin/app/revanced/patcher/patch/options/types/StringPatchOption.kt b/src/main/kotlin/app/revanced/patcher/patch/options/types/StringPatchOption.kt deleted file mode 100644 index dae966a..0000000 --- a/src/main/kotlin/app/revanced/patcher/patch/options/types/StringPatchOption.kt +++ /dev/null @@ -1,51 +0,0 @@ -package app.revanced.patcher.patch.options.types - -import app.revanced.patcher.patch.Patch -import app.revanced.patcher.patch.options.PatchOption - -/** - * A [PatchOption] representing a [String]. - * - * @param key The identifier. - * @param default The default value. - * @param title The title. - * @param description A description. - * @param required Whether the option is required. - * @param validator The function to validate the option value. - * - * @see PatchOption - */ -class StringPatchOption private constructor( - key: String, - default: String?, - title: String?, - description: String?, - required: Boolean, - validator: (String?) -> Boolean -) : PatchOption(key, default, title, description, required, validator) { - companion object { - /** - * Create a new [StringPatchOption] and add it to the current [Patch]. - * - * @param key The identifier. - * @param default The default value. - * @param title The title. - * @param description A description. - * @param required Whether the option is required. - * @param validator The function to validate the option value. - * - * @return The created [StringPatchOption]. - * - * @see StringPatchOption - * @see PatchOption - */ - fun > T.stringPatchOption( - key: String, - default: String? = null, - title: String? = null, - description: String? = null, - required: Boolean = false, - validator: (String?) -> Boolean = { true } - ) = StringPatchOption(key, default, title, description, required, validator).also { options.register(it) } - } -} diff --git a/src/main/kotlin/app/revanced/patcher/patch/options/types/array/BooleanArrayPatchOption.kt b/src/main/kotlin/app/revanced/patcher/patch/options/types/array/BooleanArrayPatchOption.kt deleted file mode 100644 index 713e6f2..0000000 --- a/src/main/kotlin/app/revanced/patcher/patch/options/types/array/BooleanArrayPatchOption.kt +++ /dev/null @@ -1,51 +0,0 @@ -package app.revanced.patcher.patch.options.types.array - -import app.revanced.patcher.patch.Patch -import app.revanced.patcher.patch.options.PatchOption - -/** - * A [PatchOption] representing a [Boolean] array. - * - * @param key The identifier. - * @param default The default value. - * @param title The title. - * @param description A description. - * @param required Whether the option is required. - * @param validator The function to validate the option value. - * - * @see PatchOption - */ -class BooleanArrayPatchOption private constructor( - key: String, - default: Array?, - title: String?, - description: String?, - required: Boolean, - validator: (Array?) -> Boolean -) : PatchOption>(key, default, title, description, required, validator) { - companion object { - /** - * Create a new [BooleanArrayPatchOption] and add it to the current [Patch]. - * - * @param key The identifier. - * @param default The default value. - * @param title The title. - * @param description A description. - * @param required Whether the option is required. - * @param validator The function to validate the option value. - * - * @return The created [BooleanArrayPatchOption]. - * - * @see BooleanArrayPatchOption - * @see PatchOption - */ - fun > T.booleanArrayPatchOption( - key: String, - default: Array? = null, - title: String? = null, - description: String? = null, - required: Boolean = false, - validator: (Array?) -> Boolean = { true } - ) = BooleanArrayPatchOption(key, default, title, description, required, validator).also { options.register(it) } - } -} diff --git a/src/main/kotlin/app/revanced/patcher/patch/options/types/array/FloatArrayPatchOption.kt b/src/main/kotlin/app/revanced/patcher/patch/options/types/array/FloatArrayPatchOption.kt deleted file mode 100644 index 8cb5a66..0000000 --- a/src/main/kotlin/app/revanced/patcher/patch/options/types/array/FloatArrayPatchOption.kt +++ /dev/null @@ -1,51 +0,0 @@ -package app.revanced.patcher.patch.options.types.array - -import app.revanced.patcher.patch.Patch -import app.revanced.patcher.patch.options.PatchOption - -/** - * A [PatchOption] representing a [Float] array. - * - * @param key The identifier. - * @param default The default value. - * @param title The title. - * @param description A description. - * @param required Whether the option is required. - * @param validator The function to validate the option value. - * - * @see PatchOption - */ -class FloatArrayPatchOption private constructor( - key: String, - default: Array?, - title: String?, - description: String?, - required: Boolean, - validator: (Array?) -> Boolean -) : PatchOption>(key, default, title, description, required, validator) { - companion object { - /** - * Create a new [FloatArrayPatchOption] and add it to the current [Patch]. - * - * @param key The identifier. - * @param default The default value. - * @param title The title. - * @param description A description. - * @param required Whether the option is required. - * @param validator The function to validate the option value. - * - * @return The created [FloatArrayPatchOption]. - * - * @see FloatArrayPatchOption - * @see PatchOption - */ - fun > T.floatArrayPatchOption( - key: String, - default: Array? = null, - title: String? = null, - description: String? = null, - required: Boolean = false, - validator: (Array?) -> Boolean = { true } - ) = FloatArrayPatchOption(key, default, title, description, required, validator).also { options.register(it) } - } -} diff --git a/src/main/kotlin/app/revanced/patcher/patch/options/types/array/IntArrayPatchOption.kt b/src/main/kotlin/app/revanced/patcher/patch/options/types/array/IntArrayPatchOption.kt deleted file mode 100644 index cc3e157..0000000 --- a/src/main/kotlin/app/revanced/patcher/patch/options/types/array/IntArrayPatchOption.kt +++ /dev/null @@ -1,51 +0,0 @@ -package app.revanced.patcher.patch.options.types.array - -import app.revanced.patcher.patch.Patch -import app.revanced.patcher.patch.options.PatchOption - -/** - * A [PatchOption] representing an [Integer] array. - * - * @param key The identifier. - * @param default The default value. - * @param title The title. - * @param description A description. - * @param required Whether the option is required. - * @param validator The function to validate the option value. - * - * @see PatchOption - */ -class IntArrayPatchOption private constructor( - key: String, - default: Array?, - title: String?, - description: String?, - required: Boolean, - validator: (Array?) -> Boolean -) : PatchOption>(key, default, title, description, required, validator) { - companion object { - /** - * Create a new [IntArrayPatchOption] and add it to the current [Patch]. - * - * @param key The identifier. - * @param default The default value. - * @param title The title. - * @param description A description. - * @param required Whether the option is required. - * @param validator The function to validate the option value. - * - * @return The created [IntArrayPatchOption]. - * - * @see IntArrayPatchOption - * @see PatchOption - */ - fun > T.intArrayPatchOption( - key: String, - default: Array? = null, - title: String? = null, - description: String? = null, - required: Boolean = false, - validator: (Array?) -> Boolean = { true } - ) = IntArrayPatchOption(key, default, title, description, required, validator).also { options.register(it) } - } -} diff --git a/src/main/kotlin/app/revanced/patcher/patch/options/types/array/LongArrayPatchOption.kt b/src/main/kotlin/app/revanced/patcher/patch/options/types/array/LongArrayPatchOption.kt deleted file mode 100644 index 5c25f0e..0000000 --- a/src/main/kotlin/app/revanced/patcher/patch/options/types/array/LongArrayPatchOption.kt +++ /dev/null @@ -1,51 +0,0 @@ -package app.revanced.patcher.patch.options.types.array - -import app.revanced.patcher.patch.Patch -import app.revanced.patcher.patch.options.PatchOption - -/** - * A [PatchOption] representing a [Long] array. - * - * @param key The identifier. - * @param default The default value. - * @param title The title. - * @param description A description. - * @param required Whether the option is required. - * @param validator The function to validate the option value. - * - * @see PatchOption - */ -class LongArrayPatchOption private constructor( - key: String, - default: Array?, - title: String?, - description: String?, - required: Boolean, - validator: (Array?) -> Boolean -) : PatchOption>(key, default, title, description, required, validator) { - companion object { - /** - * Create a new [LongArrayPatchOption] and add it to the current [Patch]. - * - * @param key The identifier. - * @param default The default value. - * @param title The title. - * @param description A description. - * @param required Whether the option is required. - * @param validator The function to validate the option value. - * - * @return The created [LongArrayPatchOption]. - * - * @see LongArrayPatchOption - * @see PatchOption - */ - fun > T.longArrayPatchOption( - key: String, - default: Array? = null, - title: String? = null, - description: String? = null, - required: Boolean = false, - validator: (Array?) -> Boolean = { true } - ) = LongArrayPatchOption(key, default, title, description, required, validator).also { options.register(it) } - } -} diff --git a/src/main/kotlin/app/revanced/patcher/patch/options/types/array/StringArrayPatchOption.kt b/src/main/kotlin/app/revanced/patcher/patch/options/types/array/StringArrayPatchOption.kt deleted file mode 100644 index a1ca299..0000000 --- a/src/main/kotlin/app/revanced/patcher/patch/options/types/array/StringArrayPatchOption.kt +++ /dev/null @@ -1,51 +0,0 @@ -package app.revanced.patcher.patch.options.types.array - -import app.revanced.patcher.patch.Patch -import app.revanced.patcher.patch.options.PatchOption - -/** - * A [PatchOption] representing a [String] array. - * - * @param key The identifier. - * @param default The default value. - * @param title The title. - * @param description A description. - * @param required Whether the option is required. - * @param validator The function to validate the option value. - * - * @see PatchOption - */ -class StringArrayPatchOption private constructor( - key: String, - default: Array?, - title: String?, - description: String?, - required: Boolean, - validator: (Array?) -> Boolean -) : PatchOption>(key, default, title, description, required, validator) { - companion object { - /** - * Create a new [StringArrayPatchOption] and add it to the current [Patch]. - * - * @param key The identifier. - * @param default The default value. - * @param title The title. - * @param description A description. - * @param required Whether the option is required. - * @param validator The function to validate the option value. - * - * @return The created [StringArrayPatchOption]. - * - * @see StringArrayPatchOption - * @see PatchOption - */ - fun > T.stringArrayPatchOption( - key: String, - default: Array? = null, - title: String? = null, - description: String? = null, - required: Boolean = false, - validator: (Array?) -> Boolean = { true } - ) = StringArrayPatchOption(key, default, title, description, required, validator).also { options.register(it) } - } -} diff --git a/src/test/kotlin/app/revanced/patcher/patch/options/PatchOptionsTest.kt b/src/test/kotlin/app/revanced/patcher/patch/options/PatchOptionsTest.kt index 95538d1..cf344b9 100644 --- a/src/test/kotlin/app/revanced/patcher/patch/options/PatchOptionsTest.kt +++ b/src/test/kotlin/app/revanced/patcher/patch/options/PatchOptionsTest.kt @@ -2,9 +2,9 @@ package app.revanced.patcher.patch.options import app.revanced.patcher.data.BytecodeContext import app.revanced.patcher.patch.BytecodePatch -import app.revanced.patcher.patch.options.types.BooleanPatchOption.Companion.booleanPatchOption -import app.revanced.patcher.patch.options.types.StringPatchOption.Companion.stringPatchOption -import app.revanced.patcher.patch.options.types.array.StringArrayPatchOption.Companion.stringArrayPatchOption +import app.revanced.patcher.patch.options.PatchOption.PatchExtensions.booleanPatchOption +import app.revanced.patcher.patch.options.PatchOption.PatchExtensions.stringArrayPatchOption +import app.revanced.patcher.patch.options.PatchOption.PatchExtensions.stringPatchOption import org.junit.jupiter.api.assertDoesNotThrow import org.junit.jupiter.api.assertThrows import kotlin.test.Test From c6095bc38a11f5cf2481a89d018e87acbaf8d7c6 Mon Sep 17 00:00:00 2001 From: oSumAtrIX Date: Sun, 22 Oct 2023 01:59:51 +0200 Subject: [PATCH 14/36] feat!: Add `PatchOption#toString` --- api/revanced-patcher.api | 1 + .../kotlin/app/revanced/patcher/patch/options/PatchOption.kt | 2 ++ 2 files changed, 3 insertions(+) diff --git a/api/revanced-patcher.api b/api/revanced-patcher.api index 6d4992e..b9d7c3f 100644 --- a/api/revanced-patcher.api +++ b/api/revanced-patcher.api @@ -374,6 +374,7 @@ public class app/revanced/patcher/patch/options/PatchOption { public fun reset ()V public final fun setValue (Ljava/lang/Object;)V public final fun setValue (Ljava/lang/Object;Lkotlin/reflect/KProperty;Ljava/lang/Object;)V + public fun toString ()Ljava/lang/String; } public final class app/revanced/patcher/patch/options/PatchOption$PatchExtensions { diff --git a/src/main/kotlin/app/revanced/patcher/patch/options/PatchOption.kt b/src/main/kotlin/app/revanced/patcher/patch/options/PatchOption.kt index 7ddb658..01430a3 100644 --- a/src/main/kotlin/app/revanced/patcher/patch/options/PatchOption.kt +++ b/src/main/kotlin/app/revanced/patcher/patch/options/PatchOption.kt @@ -75,6 +75,8 @@ open class PatchOption( if (!validator(value)) throw PatchOptionException.ValueValidationException(value, this) } + override fun toString() = value.toString() + operator fun getValue(thisRef: Any?, property: KProperty<*>) = value operator fun setValue(thisRef: Any?, property: KProperty<*>, value: T?) { From 55f6c2a9fc812f86aef86b1a9b0d5b485c1c848a Mon Sep 17 00:00:00 2001 From: oSumAtrIX Date: Sun, 22 Oct 2023 02:12:42 +0200 Subject: [PATCH 15/36] feat!: Add property `PatchOption#values` --- api/revanced-patcher.api | 45 ++++++------- .../patcher/patch/options/PatchOption.kt | 64 +++++++++++++------ .../patcher/patch/options/PatchOptionsTest.kt | 34 ++++++++++ 3 files changed, 100 insertions(+), 43 deletions(-) diff --git a/api/revanced-patcher.api b/api/revanced-patcher.api index b9d7c3f..fff57eb 100644 --- a/api/revanced-patcher.api +++ b/api/revanced-patcher.api @@ -362,15 +362,16 @@ public abstract interface annotation class app/revanced/patcher/patch/annotation public class app/revanced/patcher/patch/options/PatchOption { public static final field PatchExtensions Lapp/revanced/patcher/patch/options/PatchOption$PatchExtensions; - public fun (Ljava/lang/String;Ljava/lang/Object;Ljava/lang/String;Ljava/lang/String;ZLkotlin/jvm/functions/Function1;)V + public fun (Ljava/lang/String;Ljava/lang/Object;Ljava/util/Set;Ljava/lang/String;Ljava/lang/String;ZLkotlin/jvm/functions/Function2;)V public final fun getDefault ()Ljava/lang/Object; public final fun getDescription ()Ljava/lang/String; public final fun getKey ()Ljava/lang/String; public final fun getRequired ()Z public final fun getTitle ()Ljava/lang/String; - public final fun getValidator ()Lkotlin/jvm/functions/Function1; + public final fun getValidator ()Lkotlin/jvm/functions/Function2; public final fun getValue ()Ljava/lang/Object; public final fun getValue (Ljava/lang/Object;Lkotlin/reflect/KProperty;)Ljava/lang/Object; + public final fun getValues ()Ljava/util/Set; public fun reset ()V public final fun setValue (Ljava/lang/Object;)V public final fun setValue (Ljava/lang/Object;Lkotlin/reflect/KProperty;Ljava/lang/Object;)V @@ -378,26 +379,26 @@ public class app/revanced/patcher/patch/options/PatchOption { } public final class app/revanced/patcher/patch/options/PatchOption$PatchExtensions { - public final fun booleanArrayPatchOption (Lapp/revanced/patcher/patch/Patch;Ljava/lang/String;[Ljava/lang/Boolean;Ljava/lang/String;Ljava/lang/String;ZLkotlin/jvm/functions/Function1;)Lapp/revanced/patcher/patch/options/PatchOption; - public static synthetic fun booleanArrayPatchOption$default (Lapp/revanced/patcher/patch/options/PatchOption$PatchExtensions;Lapp/revanced/patcher/patch/Patch;Ljava/lang/String;[Ljava/lang/Boolean;Ljava/lang/String;Ljava/lang/String;ZLkotlin/jvm/functions/Function1;ILjava/lang/Object;)Lapp/revanced/patcher/patch/options/PatchOption; - public final fun booleanPatchOption (Lapp/revanced/patcher/patch/Patch;Ljava/lang/String;Ljava/lang/Boolean;Ljava/lang/String;Ljava/lang/String;ZLkotlin/jvm/functions/Function1;)Lapp/revanced/patcher/patch/options/PatchOption; - public static synthetic fun booleanPatchOption$default (Lapp/revanced/patcher/patch/options/PatchOption$PatchExtensions;Lapp/revanced/patcher/patch/Patch;Ljava/lang/String;Ljava/lang/Boolean;Ljava/lang/String;Ljava/lang/String;ZLkotlin/jvm/functions/Function1;ILjava/lang/Object;)Lapp/revanced/patcher/patch/options/PatchOption; - public final fun floatArrayPatchOption (Lapp/revanced/patcher/patch/Patch;Ljava/lang/String;[Ljava/lang/Float;Ljava/lang/String;Ljava/lang/String;ZLkotlin/jvm/functions/Function1;)Lapp/revanced/patcher/patch/options/PatchOption; - public static synthetic fun floatArrayPatchOption$default (Lapp/revanced/patcher/patch/options/PatchOption$PatchExtensions;Lapp/revanced/patcher/patch/Patch;Ljava/lang/String;[Ljava/lang/Float;Ljava/lang/String;Ljava/lang/String;ZLkotlin/jvm/functions/Function1;ILjava/lang/Object;)Lapp/revanced/patcher/patch/options/PatchOption; - public final fun floatPatchOption (Lapp/revanced/patcher/patch/Patch;Ljava/lang/String;Ljava/lang/Float;Ljava/lang/String;Ljava/lang/String;ZLkotlin/jvm/functions/Function1;)Lapp/revanced/patcher/patch/options/PatchOption; - public static synthetic fun floatPatchOption$default (Lapp/revanced/patcher/patch/options/PatchOption$PatchExtensions;Lapp/revanced/patcher/patch/Patch;Ljava/lang/String;Ljava/lang/Float;Ljava/lang/String;Ljava/lang/String;ZLkotlin/jvm/functions/Function1;ILjava/lang/Object;)Lapp/revanced/patcher/patch/options/PatchOption; - public final fun intArrayPatchOption (Lapp/revanced/patcher/patch/Patch;Ljava/lang/String;[Ljava/lang/Integer;Ljava/lang/String;Ljava/lang/String;ZLkotlin/jvm/functions/Function1;)Lapp/revanced/patcher/patch/options/PatchOption; - public static synthetic fun intArrayPatchOption$default (Lapp/revanced/patcher/patch/options/PatchOption$PatchExtensions;Lapp/revanced/patcher/patch/Patch;Ljava/lang/String;[Ljava/lang/Integer;Ljava/lang/String;Ljava/lang/String;ZLkotlin/jvm/functions/Function1;ILjava/lang/Object;)Lapp/revanced/patcher/patch/options/PatchOption; - public final fun intPatchOption (Lapp/revanced/patcher/patch/Patch;Ljava/lang/String;Ljava/lang/Integer;Ljava/lang/String;Ljava/lang/String;ZLkotlin/jvm/functions/Function1;)Lapp/revanced/patcher/patch/options/PatchOption; - public static synthetic fun intPatchOption$default (Lapp/revanced/patcher/patch/options/PatchOption$PatchExtensions;Lapp/revanced/patcher/patch/Patch;Ljava/lang/String;Ljava/lang/Integer;Ljava/lang/String;Ljava/lang/String;ZLkotlin/jvm/functions/Function1;ILjava/lang/Object;)Lapp/revanced/patcher/patch/options/PatchOption; - public final fun longArrayPatchOption (Lapp/revanced/patcher/patch/Patch;Ljava/lang/String;[Ljava/lang/Long;Ljava/lang/String;Ljava/lang/String;ZLkotlin/jvm/functions/Function1;)Lapp/revanced/patcher/patch/options/PatchOption; - public static synthetic fun longArrayPatchOption$default (Lapp/revanced/patcher/patch/options/PatchOption$PatchExtensions;Lapp/revanced/patcher/patch/Patch;Ljava/lang/String;[Ljava/lang/Long;Ljava/lang/String;Ljava/lang/String;ZLkotlin/jvm/functions/Function1;ILjava/lang/Object;)Lapp/revanced/patcher/patch/options/PatchOption; - public final fun longPatchOption (Lapp/revanced/patcher/patch/Patch;Ljava/lang/String;Ljava/lang/Long;Ljava/lang/String;Ljava/lang/String;ZLkotlin/jvm/functions/Function1;)Lapp/revanced/patcher/patch/options/PatchOption; - public static synthetic fun longPatchOption$default (Lapp/revanced/patcher/patch/options/PatchOption$PatchExtensions;Lapp/revanced/patcher/patch/Patch;Ljava/lang/String;Ljava/lang/Long;Ljava/lang/String;Ljava/lang/String;ZLkotlin/jvm/functions/Function1;ILjava/lang/Object;)Lapp/revanced/patcher/patch/options/PatchOption; - public final fun stringArrayPatchOption (Lapp/revanced/patcher/patch/Patch;Ljava/lang/String;[Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;ZLkotlin/jvm/functions/Function1;)Lapp/revanced/patcher/patch/options/PatchOption; - public static synthetic fun stringArrayPatchOption$default (Lapp/revanced/patcher/patch/options/PatchOption$PatchExtensions;Lapp/revanced/patcher/patch/Patch;Ljava/lang/String;[Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;ZLkotlin/jvm/functions/Function1;ILjava/lang/Object;)Lapp/revanced/patcher/patch/options/PatchOption; - public final fun stringPatchOption (Lapp/revanced/patcher/patch/Patch;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;ZLkotlin/jvm/functions/Function1;)Lapp/revanced/patcher/patch/options/PatchOption; - public static synthetic fun stringPatchOption$default (Lapp/revanced/patcher/patch/options/PatchOption$PatchExtensions;Lapp/revanced/patcher/patch/Patch;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;ZLkotlin/jvm/functions/Function1;ILjava/lang/Object;)Lapp/revanced/patcher/patch/options/PatchOption; + public final fun booleanArrayPatchOption (Lapp/revanced/patcher/patch/Patch;Ljava/lang/String;[Ljava/lang/Boolean;Ljava/util/Set;Ljava/lang/String;Ljava/lang/String;ZLkotlin/jvm/functions/Function2;)Lapp/revanced/patcher/patch/options/PatchOption; + public static synthetic fun booleanArrayPatchOption$default (Lapp/revanced/patcher/patch/options/PatchOption$PatchExtensions;Lapp/revanced/patcher/patch/Patch;Ljava/lang/String;[Ljava/lang/Boolean;Ljava/util/Set;Ljava/lang/String;Ljava/lang/String;ZLkotlin/jvm/functions/Function2;ILjava/lang/Object;)Lapp/revanced/patcher/patch/options/PatchOption; + public final fun booleanPatchOption (Lapp/revanced/patcher/patch/Patch;Ljava/lang/String;Ljava/lang/Boolean;Ljava/util/Set;Ljava/lang/String;Ljava/lang/String;ZLkotlin/jvm/functions/Function2;)Lapp/revanced/patcher/patch/options/PatchOption; + public static synthetic fun booleanPatchOption$default (Lapp/revanced/patcher/patch/options/PatchOption$PatchExtensions;Lapp/revanced/patcher/patch/Patch;Ljava/lang/String;Ljava/lang/Boolean;Ljava/util/Set;Ljava/lang/String;Ljava/lang/String;ZLkotlin/jvm/functions/Function2;ILjava/lang/Object;)Lapp/revanced/patcher/patch/options/PatchOption; + public final fun floatArrayPatchOption (Lapp/revanced/patcher/patch/Patch;Ljava/lang/String;[Ljava/lang/Float;Ljava/util/Set;Ljava/lang/String;Ljava/lang/String;ZLkotlin/jvm/functions/Function2;)Lapp/revanced/patcher/patch/options/PatchOption; + public static synthetic fun floatArrayPatchOption$default (Lapp/revanced/patcher/patch/options/PatchOption$PatchExtensions;Lapp/revanced/patcher/patch/Patch;Ljava/lang/String;[Ljava/lang/Float;Ljava/util/Set;Ljava/lang/String;Ljava/lang/String;ZLkotlin/jvm/functions/Function2;ILjava/lang/Object;)Lapp/revanced/patcher/patch/options/PatchOption; + public final fun floatPatchOption (Lapp/revanced/patcher/patch/Patch;Ljava/lang/String;Ljava/lang/Float;Ljava/util/Set;Ljava/lang/String;Ljava/lang/String;ZLkotlin/jvm/functions/Function2;)Lapp/revanced/patcher/patch/options/PatchOption; + public static synthetic fun floatPatchOption$default (Lapp/revanced/patcher/patch/options/PatchOption$PatchExtensions;Lapp/revanced/patcher/patch/Patch;Ljava/lang/String;Ljava/lang/Float;Ljava/util/Set;Ljava/lang/String;Ljava/lang/String;ZLkotlin/jvm/functions/Function2;ILjava/lang/Object;)Lapp/revanced/patcher/patch/options/PatchOption; + public final fun intArrayPatchOption (Lapp/revanced/patcher/patch/Patch;Ljava/lang/String;[Ljava/lang/Integer;Ljava/util/Set;Ljava/lang/String;Ljava/lang/String;ZLkotlin/jvm/functions/Function2;)Lapp/revanced/patcher/patch/options/PatchOption; + public static synthetic fun intArrayPatchOption$default (Lapp/revanced/patcher/patch/options/PatchOption$PatchExtensions;Lapp/revanced/patcher/patch/Patch;Ljava/lang/String;[Ljava/lang/Integer;Ljava/util/Set;Ljava/lang/String;Ljava/lang/String;ZLkotlin/jvm/functions/Function2;ILjava/lang/Object;)Lapp/revanced/patcher/patch/options/PatchOption; + public final fun intPatchOption (Lapp/revanced/patcher/patch/Patch;Ljava/lang/String;Ljava/lang/Integer;Ljava/util/Set;Ljava/lang/String;Ljava/lang/String;ZLkotlin/jvm/functions/Function2;)Lapp/revanced/patcher/patch/options/PatchOption; + public static synthetic fun intPatchOption$default (Lapp/revanced/patcher/patch/options/PatchOption$PatchExtensions;Lapp/revanced/patcher/patch/Patch;Ljava/lang/String;Ljava/lang/Integer;Ljava/util/Set;Ljava/lang/String;Ljava/lang/String;ZLkotlin/jvm/functions/Function2;ILjava/lang/Object;)Lapp/revanced/patcher/patch/options/PatchOption; + public final fun longArrayPatchOption (Lapp/revanced/patcher/patch/Patch;Ljava/lang/String;[Ljava/lang/Long;Ljava/util/Set;Ljava/lang/String;Ljava/lang/String;ZLkotlin/jvm/functions/Function2;)Lapp/revanced/patcher/patch/options/PatchOption; + public static synthetic fun longArrayPatchOption$default (Lapp/revanced/patcher/patch/options/PatchOption$PatchExtensions;Lapp/revanced/patcher/patch/Patch;Ljava/lang/String;[Ljava/lang/Long;Ljava/util/Set;Ljava/lang/String;Ljava/lang/String;ZLkotlin/jvm/functions/Function2;ILjava/lang/Object;)Lapp/revanced/patcher/patch/options/PatchOption; + public final fun longPatchOption (Lapp/revanced/patcher/patch/Patch;Ljava/lang/String;Ljava/lang/Long;Ljava/util/Set;Ljava/lang/String;Ljava/lang/String;ZLkotlin/jvm/functions/Function2;)Lapp/revanced/patcher/patch/options/PatchOption; + public static synthetic fun longPatchOption$default (Lapp/revanced/patcher/patch/options/PatchOption$PatchExtensions;Lapp/revanced/patcher/patch/Patch;Ljava/lang/String;Ljava/lang/Long;Ljava/util/Set;Ljava/lang/String;Ljava/lang/String;ZLkotlin/jvm/functions/Function2;ILjava/lang/Object;)Lapp/revanced/patcher/patch/options/PatchOption; + public final fun stringArrayPatchOption (Lapp/revanced/patcher/patch/Patch;Ljava/lang/String;[Ljava/lang/String;Ljava/util/Set;Ljava/lang/String;Ljava/lang/String;ZLkotlin/jvm/functions/Function2;)Lapp/revanced/patcher/patch/options/PatchOption; + public static synthetic fun stringArrayPatchOption$default (Lapp/revanced/patcher/patch/options/PatchOption$PatchExtensions;Lapp/revanced/patcher/patch/Patch;Ljava/lang/String;[Ljava/lang/String;Ljava/util/Set;Ljava/lang/String;Ljava/lang/String;ZLkotlin/jvm/functions/Function2;ILjava/lang/Object;)Lapp/revanced/patcher/patch/options/PatchOption; + public final fun stringPatchOption (Lapp/revanced/patcher/patch/Patch;Ljava/lang/String;Ljava/lang/String;Ljava/util/Set;Ljava/lang/String;Ljava/lang/String;ZLkotlin/jvm/functions/Function2;)Lapp/revanced/patcher/patch/options/PatchOption; + public static synthetic fun stringPatchOption$default (Lapp/revanced/patcher/patch/options/PatchOption$PatchExtensions;Lapp/revanced/patcher/patch/Patch;Ljava/lang/String;Ljava/lang/String;Ljava/util/Set;Ljava/lang/String;Ljava/lang/String;ZLkotlin/jvm/functions/Function2;ILjava/lang/Object;)Lapp/revanced/patcher/patch/options/PatchOption; } public abstract class app/revanced/patcher/patch/options/PatchOptionException : java/lang/Exception { diff --git a/src/main/kotlin/app/revanced/patcher/patch/options/PatchOption.kt b/src/main/kotlin/app/revanced/patcher/patch/options/PatchOption.kt index 01430a3..20bd846 100644 --- a/src/main/kotlin/app/revanced/patcher/patch/options/PatchOption.kt +++ b/src/main/kotlin/app/revanced/patcher/patch/options/PatchOption.kt @@ -8,6 +8,7 @@ import kotlin.reflect.KProperty * * @param key The identifier. * @param default The default value. + * @param values The set of guaranteed valid values. * @param title The title. * @param description A description. * @param required Whether the option is required. @@ -18,10 +19,11 @@ import kotlin.reflect.KProperty open class PatchOption( val key: String, val default: T?, + val values: Set, val title: String?, val description: String?, val required: Boolean, - val validator: (T?) -> Boolean + val validator: PatchOption.(T?) -> Boolean ) { /** * The value of the [PatchOption]. @@ -90,6 +92,7 @@ open class PatchOption( * * @param key The identifier. * @param default The default value. + * @param values The set of guaranteed valid values. * @param title The title. * @param description A description. * @param required Whether the option is required. @@ -102,17 +105,19 @@ open class PatchOption( fun

> P.stringPatchOption( key: String, default: String? = null, + values: Set = emptySet(), title: String? = null, description: String? = null, required: Boolean = false, - validator: (String?) -> Boolean = { true } - ) = PatchOption(key, default, title, description, required, validator).also { registerOption(it) } + validator: PatchOption.(String?) -> Boolean = { true } + ) = PatchOption(key, default, values, title, description, required, validator).also { registerOption(it) } /** * Create a new [PatchOption] with an integer value and add it to the current [Patch]. * * @param key The identifier. * @param default The default value. + * @param values The set of guaranteed valid values. * @param title The title. * @param description A description. * @param required Whether the option is required. @@ -125,17 +130,19 @@ open class PatchOption( fun

> P.intPatchOption( key: String, default: Int? = null, + values: Set = emptySet(), title: String? = null, description: String? = null, required: Boolean = false, - validator: (Int?) -> Boolean = { true } - ) = PatchOption(key, default, title, description, required, validator).also { registerOption(it) } + validator: PatchOption.(Int?) -> Boolean = { true } + ) = PatchOption(key, default, values, title, description, required, validator).also { registerOption(it) } /** * Create a new [PatchOption] with a boolean value and add it to the current [Patch]. * * @param key The identifier. * @param default The default value. + * @param values The set of guaranteed valid values. * @param title The title. * @param description A description. * @param required Whether the option is required. @@ -148,17 +155,19 @@ open class PatchOption( fun

> P.booleanPatchOption( key: String, default: Boolean? = null, + values: Set = emptySet(), title: String? = null, description: String? = null, required: Boolean = false, - validator: (Boolean?) -> Boolean = { true } - ) = PatchOption(key, default, title, description, required, validator).also { registerOption(it) } + validator: PatchOption.(Boolean?) -> Boolean = { true } + ) = PatchOption(key, default, values, title, description, required, validator).also { registerOption(it) } /** * Create a new [PatchOption] with a float value and add it to the current [Patch]. * * @param key The identifier. * @param default The default value. + * @param values The set of guaranteed valid values. * @param title The title. * @param description A description. * @param required Whether the option is required. @@ -171,17 +180,19 @@ open class PatchOption( fun

> P.floatPatchOption( key: String, default: Float? = null, + values: Set = emptySet(), title: String? = null, description: String? = null, required: Boolean = false, - validator: (Float?) -> Boolean = { true } - ) = PatchOption(key, default, title, description, required, validator).also { registerOption(it) } + validator: PatchOption.(Float?) -> Boolean = { true } + ) = PatchOption(key, default, values, title, description, required, validator).also { registerOption(it) } /** * Create a new [PatchOption] with a long value and add it to the current [Patch]. * * @param key The identifier. * @param default The default value. + * @param values The set of guaranteed valid values. * @param title The title. * @param description A description. * @param required Whether the option is required. @@ -194,17 +205,19 @@ open class PatchOption( fun

> P.longPatchOption( key: String, default: Long? = null, + values: Set = emptySet(), title: String? = null, description: String? = null, required: Boolean = false, - validator: (Long?) -> Boolean = { true } - ) = PatchOption(key, default, title, description, required, validator).also { registerOption(it) } + validator: PatchOption.(Long?) -> Boolean = { true } + ) = PatchOption(key, default, values, title, description, required, validator).also { registerOption(it) } /** * Create a new [PatchOption] with a string array value and add it to the current [Patch]. * * @param key The identifier. * @param default The default value. + * @param values The set of guaranteed valid values. * @param title The title. * @param description A description. * @param required Whether the option is required. @@ -217,17 +230,19 @@ open class PatchOption( fun

> P.stringArrayPatchOption( key: String, default: Array? = null, + values: Set> = emptySet(), title: String? = null, description: String? = null, required: Boolean = false, - validator: (Array?) -> Boolean = { true } - ) = PatchOption(key, default, title, description, required, validator).also { registerOption(it) } + validator: PatchOption?>.(Array?) -> Boolean = { true } + ) = PatchOption(key, default, values, title, description, required, validator).also { registerOption(it) } /** * Create a new [PatchOption] with an integer array value and add it to the current [Patch]. * * @param key The identifier. * @param default The default value. + * @param values The set of guaranteed valid values. * @param title The title. * @param description A description. * @param required Whether the option is required. @@ -240,17 +255,19 @@ open class PatchOption( fun

> P.intArrayPatchOption( key: String, default: Array? = null, + values: Set> = emptySet(), title: String? = null, description: String? = null, required: Boolean = false, - validator: (Array?) -> Boolean = { true } - ) = PatchOption(key, default, title, description, required, validator).also { registerOption(it) } + validator: PatchOption?>.(Array?) -> Boolean = { true } + ) = PatchOption(key, default, values, title, description, required, validator).also { registerOption(it) } /** * Create a new [PatchOption] with a boolean array value and add it to the current [Patch]. * * @param key The identifier. * @param default The default value. + * @param values The set of guaranteed valid values. * @param title The title. * @param description A description. * @param required Whether the option is required. @@ -263,17 +280,19 @@ open class PatchOption( fun

> P.booleanArrayPatchOption( key: String, default: Array? = null, + values: Set> = emptySet(), title: String? = null, description: String? = null, required: Boolean = false, - validator: (Array?) -> Boolean = { true } - ) = PatchOption(key, default, title, description, required, validator).also { registerOption(it) } + validator: PatchOption?>.(Array?) -> Boolean = { true } + ) = PatchOption(key, default, values, title, description, required, validator).also { registerOption(it) } /** * Create a new [PatchOption] with a float array value and add it to the current [Patch]. * * @param key The identifier. * @param default The default value. + * @param values The set of guaranteed valid values. * @param title The title. * @param description A description. * @param required Whether the option is required. @@ -286,17 +305,19 @@ open class PatchOption( fun

> P.floatArrayPatchOption( key: String, default: Array? = null, + values: Set> = emptySet(), title: String? = null, description: String? = null, required: Boolean = false, - validator: (Array?) -> Boolean = { true } - ) = PatchOption(key, default, title, description, required, validator).also { registerOption(it) } + validator: PatchOption?>.(Array?) -> Boolean = { true } + ) = PatchOption(key, default, values, title, description, required, validator).also { registerOption(it) } /** * Create a new [PatchOption] with a long array value and add it to the current [Patch]. * * @param key The identifier. * @param default The default value. + * @param values The set of guaranteed valid values. * @param title The title. * @param description A description. * @param required Whether the option is required. @@ -309,11 +330,12 @@ open class PatchOption( fun

> P.longArrayPatchOption( key: String, default: Array? = null, + values: Set> = emptySet(), title: String? = null, description: String? = null, required: Boolean = false, - validator: (Array?) -> Boolean = { true } - ) = PatchOption(key, default, title, description, required, validator).also { registerOption(it) } + validator: PatchOption?>.(Array?) -> Boolean = { true } + ) = PatchOption(key, default, values, title, description, required, validator).also { registerOption(it) } private fun

> P.registerOption(option: PatchOption<*>) = option.also { options.register(it) } } diff --git a/src/test/kotlin/app/revanced/patcher/patch/options/PatchOptionsTest.kt b/src/test/kotlin/app/revanced/patcher/patch/options/PatchOptionsTest.kt index cf344b9..cee2172 100644 --- a/src/test/kotlin/app/revanced/patcher/patch/options/PatchOptionsTest.kt +++ b/src/test/kotlin/app/revanced/patcher/patch/options/PatchOptionsTest.kt @@ -8,6 +8,7 @@ import app.revanced.patcher.patch.options.PatchOption.PatchExtensions.stringPatc import org.junit.jupiter.api.assertDoesNotThrow import org.junit.jupiter.api.assertThrows import kotlin.test.Test +import kotlin.test.assertTrue internal class PatchOptionsTest { @Test @@ -46,6 +47,36 @@ internal class PatchOptionsTest { } } + @Suppress("UNCHECKED_CAST") + @Test + fun `should allow setting value from values`() = + with(OptionsTestPatch.options["choices"] as PatchOption) { + value = values.last() + assertTrue(value == "valid") + } + + @Test + fun `should allow setting custom value`() { + assertDoesNotThrow { + OptionsTestPatch.options["choices"] = "unknown" + } + } + + @Test + fun `should not allow setting custom value with validation`() = + @Suppress("UNCHECKED_CAST") + with(OptionsTestPatch.options["validated"] as PatchOption) { + // Getter validation + assertThrows { value } + + // setter validation on incorrect value + assertThrows { value = "invalid" } + + // Setter validation on correct value + assertDoesNotThrow { value = "valid" } + } + + @Suppress("unused") private object OptionsTestPatch : BytecodePatch() { private var stringOption by stringPatchOption("string", "default") private var booleanOption by booleanPatchOption("bool", true) @@ -53,6 +84,9 @@ internal class PatchOptionsTest { private var nullDefaultRequiredOption by stringPatchOption("null", null, required = true) val stringArrayOption = stringArrayPatchOption("array", arrayOf("1", "2")) + val stringOptionWithChoices = stringPatchOption("choices", "value", values = setOf("valid")) + + val validatedOption = stringPatchOption("validated", "default") { it == "valid" } override fun execute(context: BytecodeContext) {} } From 0caf6caeb9cd5d297b704ddc69cce85608182c30 Mon Sep 17 00:00:00 2001 From: oSumAtrIX Date: Sun, 22 Oct 2023 02:46:51 +0200 Subject: [PATCH 16/36] refactor: Simplify patch option tests --- .../patcher/patch/options/PatchOptionsTest.kt | 55 ++++++++----------- 1 file changed, 23 insertions(+), 32 deletions(-) diff --git a/src/test/kotlin/app/revanced/patcher/patch/options/PatchOptionsTest.kt b/src/test/kotlin/app/revanced/patcher/patch/options/PatchOptionsTest.kt index cee2172..5cd6ccc 100644 --- a/src/test/kotlin/app/revanced/patcher/patch/options/PatchOptionsTest.kt +++ b/src/test/kotlin/app/revanced/patcher/patch/options/PatchOptionsTest.kt @@ -13,21 +13,31 @@ import kotlin.test.assertTrue internal class PatchOptionsTest { @Test fun `should not fail because default value is unvalidated`() { - assertDoesNotThrow { - OptionsTestPatch.options["required"].value - } + assertDoesNotThrow { OptionsTestPatch.requiredStringOption } + } + + @Test + fun `should not allow setting custom value with validation`() { + // Getter validation on incorrect value. + assertThrows { OptionsTestPatch.validatedOption } + + // Setter validation on incorrect value. + assertThrows { OptionsTestPatch.validatedOption = "invalid" } + + // Setter validation on correct value. + assertDoesNotThrow { OptionsTestPatch.validatedOption = "valid" } } @Test fun `should throw due to incorrect type`() { assertThrows { - OptionsTestPatch.options["bool"] = 0 + OptionsTestPatch.options["bool"] = "not a boolean" } } @Test fun `should be nullable`() { - OptionsTestPatch.options["bool"] = null + OptionsTestPatch.booleanOption = null } @Test @@ -56,37 +66,18 @@ internal class PatchOptionsTest { } @Test - fun `should allow setting custom value`() { - assertDoesNotThrow { - OptionsTestPatch.options["choices"] = "unknown" - } - } + fun `should allow setting custom value`() = + assertDoesNotThrow { OptionsTestPatch.stringOptionWithChoices = "unknown" } @Test - fun `should not allow setting custom value with validation`() = - @Suppress("UNCHECKED_CAST") - with(OptionsTestPatch.options["validated"] as PatchOption) { - // Getter validation - assertThrows { value } + fun `should allow resetting value`() = assertDoesNotThrow { OptionsTestPatch.stringOptionWithChoices = null } - // setter validation on incorrect value - assertThrows { value = "invalid" } - - // Setter validation on correct value - assertDoesNotThrow { value = "valid" } - } - - @Suppress("unused") private object OptionsTestPatch : BytecodePatch() { - private var stringOption by stringPatchOption("string", "default") - private var booleanOption by booleanPatchOption("bool", true) - private var requiredStringOption by stringPatchOption("required", "default", required = true) - private var nullDefaultRequiredOption by stringPatchOption("null", null, required = true) - - val stringArrayOption = stringArrayPatchOption("array", arrayOf("1", "2")) - val stringOptionWithChoices = stringPatchOption("choices", "value", values = setOf("valid")) - - val validatedOption = stringPatchOption("validated", "default") { it == "valid" } + var booleanOption by booleanPatchOption("bool", true) + var requiredStringOption by stringPatchOption("required", "default", required = true) + var stringArrayOption = stringArrayPatchOption("array", arrayOf("1", "2")) + var stringOptionWithChoices by stringPatchOption("choices", "value", values = setOf("valid")) + var validatedOption by stringPatchOption("validated", "default") { it == "valid" } override fun execute(context: BytecodeContext) {} } From 64343e5a7c934983be7f6628d339a7900f3514ed Mon Sep 17 00:00:00 2001 From: oSumAtrIX Date: Sun, 22 Oct 2023 02:49:44 +0200 Subject: [PATCH 17/36] chore: Test resetting options --- .../patcher/patch/options/PatchOptionsTest.kt | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/src/test/kotlin/app/revanced/patcher/patch/options/PatchOptionsTest.kt b/src/test/kotlin/app/revanced/patcher/patch/options/PatchOptionsTest.kt index 5cd6ccc..1340eff 100644 --- a/src/test/kotlin/app/revanced/patcher/patch/options/PatchOptionsTest.kt +++ b/src/test/kotlin/app/revanced/patcher/patch/options/PatchOptionsTest.kt @@ -72,12 +72,25 @@ internal class PatchOptionsTest { @Test fun `should allow resetting value`() = assertDoesNotThrow { OptionsTestPatch.stringOptionWithChoices = null } + @Test + fun `reset should not fail`() { + assertDoesNotThrow { + OptionsTestPatch.resettableOption.value = "test" + OptionsTestPatch.resettableOption.reset() + } + + assertThrows { + OptionsTestPatch.resettableOption.value + } + } + private object OptionsTestPatch : BytecodePatch() { var booleanOption by booleanPatchOption("bool", true) var requiredStringOption by stringPatchOption("required", "default", required = true) var stringArrayOption = stringArrayPatchOption("array", arrayOf("1", "2")) var stringOptionWithChoices by stringPatchOption("choices", "value", values = setOf("valid")) var validatedOption by stringPatchOption("validated", "default") { it == "valid" } + var resettableOption = stringPatchOption("resettable", null, required = true) override fun execute(context: BytecodeContext) {} } From 098c2c1efafba116cd4601c4fd3954488b7c78b9 Mon Sep 17 00:00:00 2001 From: oSumAtrIX Date: Sun, 22 Oct 2023 02:50:26 +0200 Subject: [PATCH 18/36] chore: Test default option value --- .../app/revanced/patcher/patch/options/PatchOptionsTest.kt | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/test/kotlin/app/revanced/patcher/patch/options/PatchOptionsTest.kt b/src/test/kotlin/app/revanced/patcher/patch/options/PatchOptionsTest.kt index 1340eff..b008bcb 100644 --- a/src/test/kotlin/app/revanced/patcher/patch/options/PatchOptionsTest.kt +++ b/src/test/kotlin/app/revanced/patcher/patch/options/PatchOptionsTest.kt @@ -8,6 +8,7 @@ import app.revanced.patcher.patch.options.PatchOption.PatchExtensions.stringPatc import org.junit.jupiter.api.assertDoesNotThrow import org.junit.jupiter.api.assertThrows import kotlin.test.Test +import kotlin.test.assertNull import kotlin.test.assertTrue internal class PatchOptionsTest { @@ -84,6 +85,10 @@ internal class PatchOptionsTest { } } + @Test + fun `getting default value should work`() = + assertDoesNotThrow { assertNull(OptionsTestPatch.resettableOption.default) } + private object OptionsTestPatch : BytecodePatch() { var booleanOption by booleanPatchOption("bool", true) var requiredStringOption by stringPatchOption("required", "default", required = true) From 1b52e4b0f9189bb09d6aed1020d0853cd32951f1 Mon Sep 17 00:00:00 2001 From: semantic-release-bot Date: Sun, 22 Oct 2023 00:56:40 +0000 Subject: [PATCH 19/36] chore(release): 18.0.0-dev.2 [skip ci] # [18.0.0-dev.2](https://github.com/ReVanced/revanced-patcher/compare/v18.0.0-dev.1...v18.0.0-dev.2) (2023-10-22) ### Code Refactoring * Change `PatchOption` from abstract to open class ([09cd6aa](https://github.com/ReVanced/revanced-patcher/commit/09cd6aa568988dd5241bfa6a2e12b7926a7b0683)) ### Features * Add function to reset options to their default value ([ebbaafb](https://github.com/ReVanced/revanced-patcher/commit/ebbaafb78e88f34faeafe9ff8532afe29231bd79)) * Add function to reset options to their default value ([e6de90d](https://github.com/ReVanced/revanced-patcher/commit/e6de90d300bc9c82ca1696cb898db04c65a1cd5b)) * Add getter for default option value ([c7922e9](https://github.com/ReVanced/revanced-patcher/commit/c7922e90d0c6ae83f513611c706ebea33c1a2b63)) * Name patch option value validator property correctly ([caa634f](https://github.com/ReVanced/revanced-patcher/commit/caa634fac6d7a717f54e3b015827c8858fd637b9)) ### BREAKING CHANGES * This gets rid of the existing basic implementations of the `PatchOptions` type and moves extension functions. * This changes the getter name of the property. --- CHANGELOG.md | 21 +++++++++++++++++++++ gradle.properties | 2 +- 2 files changed, 22 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 43b9c56..f4431e9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,24 @@ +# [18.0.0-dev.2](https://github.com/ReVanced/revanced-patcher/compare/v18.0.0-dev.1...v18.0.0-dev.2) (2023-10-22) + + +### Code Refactoring + +* Change `PatchOption` from abstract to open class ([09cd6aa](https://github.com/ReVanced/revanced-patcher/commit/09cd6aa568988dd5241bfa6a2e12b7926a7b0683)) + + +### Features + +* Add function to reset options to their default value ([ebbaafb](https://github.com/ReVanced/revanced-patcher/commit/ebbaafb78e88f34faeafe9ff8532afe29231bd79)) +* Add function to reset options to their default value ([e6de90d](https://github.com/ReVanced/revanced-patcher/commit/e6de90d300bc9c82ca1696cb898db04c65a1cd5b)) +* Add getter for default option value ([c7922e9](https://github.com/ReVanced/revanced-patcher/commit/c7922e90d0c6ae83f513611c706ebea33c1a2b63)) +* Name patch option value validator property correctly ([caa634f](https://github.com/ReVanced/revanced-patcher/commit/caa634fac6d7a717f54e3b015827c8858fd637b9)) + + +### BREAKING CHANGES + +* This gets rid of the existing basic implementations of the `PatchOptions` type and moves extension functions. +* This changes the getter name of the property. + # [18.0.0-dev.1](https://github.com/ReVanced/revanced-patcher/compare/v17.0.1-dev.1...v18.0.0-dev.1) (2023-10-14) diff --git a/gradle.properties b/gradle.properties index 62752a0..1e704c1 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,4 +1,4 @@ org.gradle.parallel = true org.gradle.caching = true kotlin.code.style = official -version = 18.0.0-dev.1 +version = 18.0.0-dev.2 From 56ce9ec2f98ff351c3d42df71b49e5c88f07e665 Mon Sep 17 00:00:00 2001 From: oSumAtrIX Date: Sun, 22 Oct 2023 16:07:01 +0200 Subject: [PATCH 20/36] feat: Make `PatchOption#values` nullable There is no difference semantically, but this change allows passing null as a parameter which is simpler than having to use `emptySet()`. --- .../patcher/patch/options/PatchOption.kt | 22 +++++++++---------- .../patcher/patch/options/PatchOptionsTest.kt | 2 +- 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/src/main/kotlin/app/revanced/patcher/patch/options/PatchOption.kt b/src/main/kotlin/app/revanced/patcher/patch/options/PatchOption.kt index 20bd846..9d0c2fd 100644 --- a/src/main/kotlin/app/revanced/patcher/patch/options/PatchOption.kt +++ b/src/main/kotlin/app/revanced/patcher/patch/options/PatchOption.kt @@ -19,7 +19,7 @@ import kotlin.reflect.KProperty open class PatchOption( val key: String, val default: T?, - val values: Set, + val values: Set?, val title: String?, val description: String?, val required: Boolean, @@ -105,7 +105,7 @@ open class PatchOption( fun

> P.stringPatchOption( key: String, default: String? = null, - values: Set = emptySet(), + values: Set? = null, title: String? = null, description: String? = null, required: Boolean = false, @@ -130,7 +130,7 @@ open class PatchOption( fun

> P.intPatchOption( key: String, default: Int? = null, - values: Set = emptySet(), + values: Set? = null, title: String? = null, description: String? = null, required: Boolean = false, @@ -155,7 +155,7 @@ open class PatchOption( fun

> P.booleanPatchOption( key: String, default: Boolean? = null, - values: Set = emptySet(), + values: Set? = null, title: String? = null, description: String? = null, required: Boolean = false, @@ -180,7 +180,7 @@ open class PatchOption( fun

> P.floatPatchOption( key: String, default: Float? = null, - values: Set = emptySet(), + values: Set? = null, title: String? = null, description: String? = null, required: Boolean = false, @@ -205,7 +205,7 @@ open class PatchOption( fun

> P.longPatchOption( key: String, default: Long? = null, - values: Set = emptySet(), + values: Set? = null, title: String? = null, description: String? = null, required: Boolean = false, @@ -230,7 +230,7 @@ open class PatchOption( fun

> P.stringArrayPatchOption( key: String, default: Array? = null, - values: Set> = emptySet(), + values: Set>? = null, title: String? = null, description: String? = null, required: Boolean = false, @@ -255,7 +255,7 @@ open class PatchOption( fun

> P.intArrayPatchOption( key: String, default: Array? = null, - values: Set> = emptySet(), + values: Set>? = null, title: String? = null, description: String? = null, required: Boolean = false, @@ -280,7 +280,7 @@ open class PatchOption( fun

> P.booleanArrayPatchOption( key: String, default: Array? = null, - values: Set> = emptySet(), + values: Set>? = null, title: String? = null, description: String? = null, required: Boolean = false, @@ -305,7 +305,7 @@ open class PatchOption( fun

> P.floatArrayPatchOption( key: String, default: Array? = null, - values: Set> = emptySet(), + values: Set>? = null, title: String? = null, description: String? = null, required: Boolean = false, @@ -330,7 +330,7 @@ open class PatchOption( fun

> P.longArrayPatchOption( key: String, default: Array? = null, - values: Set> = emptySet(), + values: Set>? = null, title: String? = null, description: String? = null, required: Boolean = false, diff --git a/src/test/kotlin/app/revanced/patcher/patch/options/PatchOptionsTest.kt b/src/test/kotlin/app/revanced/patcher/patch/options/PatchOptionsTest.kt index b008bcb..2cf04ee 100644 --- a/src/test/kotlin/app/revanced/patcher/patch/options/PatchOptionsTest.kt +++ b/src/test/kotlin/app/revanced/patcher/patch/options/PatchOptionsTest.kt @@ -62,7 +62,7 @@ internal class PatchOptionsTest { @Test fun `should allow setting value from values`() = with(OptionsTestPatch.options["choices"] as PatchOption) { - value = values.last() + value = values!!.last() assertTrue(value == "valid") } From 079de45238e7e8128e3c2e070dc563b53d129cd4 Mon Sep 17 00:00:00 2001 From: semantic-release-bot Date: Sun, 22 Oct 2023 14:09:28 +0000 Subject: [PATCH 21/36] chore(release): 18.0.0-dev.3 [skip ci] # [18.0.0-dev.3](https://github.com/ReVanced/revanced-patcher/compare/v18.0.0-dev.2...v18.0.0-dev.3) (2023-10-22) ### Features * Make `PatchOption#values` nullable ([56ce9ec](https://github.com/ReVanced/revanced-patcher/commit/56ce9ec2f98ff351c3d42df71b49e5c88f07e665)) --- CHANGELOG.md | 7 +++++++ gradle.properties | 2 +- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index f4431e9..59d691f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,10 @@ +# [18.0.0-dev.3](https://github.com/ReVanced/revanced-patcher/compare/v18.0.0-dev.2...v18.0.0-dev.3) (2023-10-22) + + +### Features + +* Make `PatchOption#values` nullable ([56ce9ec](https://github.com/ReVanced/revanced-patcher/commit/56ce9ec2f98ff351c3d42df71b49e5c88f07e665)) + # [18.0.0-dev.2](https://github.com/ReVanced/revanced-patcher/compare/v18.0.0-dev.1...v18.0.0-dev.2) (2023-10-22) diff --git a/gradle.properties b/gradle.properties index 1e704c1..700feef 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,4 +1,4 @@ org.gradle.parallel = true org.gradle.caching = true kotlin.code.style = official -version = 18.0.0-dev.2 +version = 18.0.0-dev.3 From 0b04c73ac5b98575fc4fa85a762a3c723bf9d6ba Mon Sep 17 00:00:00 2001 From: oSumAtrIX Date: Sun, 22 Oct 2023 16:14:46 +0200 Subject: [PATCH 22/36] build: Bump Kotlin Gradle plugin version --- build.gradle.kts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.gradle.kts b/build.gradle.kts index 8068c81..aa564fe 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -1,5 +1,5 @@ plugins { - kotlin("jvm") version "1.9.0" + kotlin("jvm") version "1.9.10" alias(libs.plugins.binary.compatibility.validator) `maven-publish` signing From 54ac1394a914d3eed7865ec697e8016834134911 Mon Sep 17 00:00:00 2001 From: oSumAtrIX Date: Sun, 22 Oct 2023 17:07:22 +0200 Subject: [PATCH 23/36] feat: Use a map for `PatchOption#values` This allows to display a string representation associated to the option value. --- api/revanced-patcher.api | 44 +++++++++---------- .../patcher/patch/options/PatchOption.kt | 24 +++++----- .../patcher/patch/options/PatchOptionsTest.kt | 35 ++++++++++++--- 3 files changed, 62 insertions(+), 41 deletions(-) diff --git a/api/revanced-patcher.api b/api/revanced-patcher.api index fff57eb..ad2494c 100644 --- a/api/revanced-patcher.api +++ b/api/revanced-patcher.api @@ -362,7 +362,7 @@ public abstract interface annotation class app/revanced/patcher/patch/annotation public class app/revanced/patcher/patch/options/PatchOption { public static final field PatchExtensions Lapp/revanced/patcher/patch/options/PatchOption$PatchExtensions; - public fun (Ljava/lang/String;Ljava/lang/Object;Ljava/util/Set;Ljava/lang/String;Ljava/lang/String;ZLkotlin/jvm/functions/Function2;)V + public fun (Ljava/lang/String;Ljava/lang/Object;Ljava/util/Map;Ljava/lang/String;Ljava/lang/String;ZLkotlin/jvm/functions/Function2;)V public final fun getDefault ()Ljava/lang/Object; public final fun getDescription ()Ljava/lang/String; public final fun getKey ()Ljava/lang/String; @@ -371,7 +371,7 @@ public class app/revanced/patcher/patch/options/PatchOption { public final fun getValidator ()Lkotlin/jvm/functions/Function2; public final fun getValue ()Ljava/lang/Object; public final fun getValue (Ljava/lang/Object;Lkotlin/reflect/KProperty;)Ljava/lang/Object; - public final fun getValues ()Ljava/util/Set; + public final fun getValues ()Ljava/util/Map; public fun reset ()V public final fun setValue (Ljava/lang/Object;)V public final fun setValue (Ljava/lang/Object;Lkotlin/reflect/KProperty;Ljava/lang/Object;)V @@ -379,26 +379,26 @@ public class app/revanced/patcher/patch/options/PatchOption { } public final class app/revanced/patcher/patch/options/PatchOption$PatchExtensions { - public final fun booleanArrayPatchOption (Lapp/revanced/patcher/patch/Patch;Ljava/lang/String;[Ljava/lang/Boolean;Ljava/util/Set;Ljava/lang/String;Ljava/lang/String;ZLkotlin/jvm/functions/Function2;)Lapp/revanced/patcher/patch/options/PatchOption; - public static synthetic fun booleanArrayPatchOption$default (Lapp/revanced/patcher/patch/options/PatchOption$PatchExtensions;Lapp/revanced/patcher/patch/Patch;Ljava/lang/String;[Ljava/lang/Boolean;Ljava/util/Set;Ljava/lang/String;Ljava/lang/String;ZLkotlin/jvm/functions/Function2;ILjava/lang/Object;)Lapp/revanced/patcher/patch/options/PatchOption; - public final fun booleanPatchOption (Lapp/revanced/patcher/patch/Patch;Ljava/lang/String;Ljava/lang/Boolean;Ljava/util/Set;Ljava/lang/String;Ljava/lang/String;ZLkotlin/jvm/functions/Function2;)Lapp/revanced/patcher/patch/options/PatchOption; - public static synthetic fun booleanPatchOption$default (Lapp/revanced/patcher/patch/options/PatchOption$PatchExtensions;Lapp/revanced/patcher/patch/Patch;Ljava/lang/String;Ljava/lang/Boolean;Ljava/util/Set;Ljava/lang/String;Ljava/lang/String;ZLkotlin/jvm/functions/Function2;ILjava/lang/Object;)Lapp/revanced/patcher/patch/options/PatchOption; - public final fun floatArrayPatchOption (Lapp/revanced/patcher/patch/Patch;Ljava/lang/String;[Ljava/lang/Float;Ljava/util/Set;Ljava/lang/String;Ljava/lang/String;ZLkotlin/jvm/functions/Function2;)Lapp/revanced/patcher/patch/options/PatchOption; - public static synthetic fun floatArrayPatchOption$default (Lapp/revanced/patcher/patch/options/PatchOption$PatchExtensions;Lapp/revanced/patcher/patch/Patch;Ljava/lang/String;[Ljava/lang/Float;Ljava/util/Set;Ljava/lang/String;Ljava/lang/String;ZLkotlin/jvm/functions/Function2;ILjava/lang/Object;)Lapp/revanced/patcher/patch/options/PatchOption; - public final fun floatPatchOption (Lapp/revanced/patcher/patch/Patch;Ljava/lang/String;Ljava/lang/Float;Ljava/util/Set;Ljava/lang/String;Ljava/lang/String;ZLkotlin/jvm/functions/Function2;)Lapp/revanced/patcher/patch/options/PatchOption; - public static synthetic fun floatPatchOption$default (Lapp/revanced/patcher/patch/options/PatchOption$PatchExtensions;Lapp/revanced/patcher/patch/Patch;Ljava/lang/String;Ljava/lang/Float;Ljava/util/Set;Ljava/lang/String;Ljava/lang/String;ZLkotlin/jvm/functions/Function2;ILjava/lang/Object;)Lapp/revanced/patcher/patch/options/PatchOption; - public final fun intArrayPatchOption (Lapp/revanced/patcher/patch/Patch;Ljava/lang/String;[Ljava/lang/Integer;Ljava/util/Set;Ljava/lang/String;Ljava/lang/String;ZLkotlin/jvm/functions/Function2;)Lapp/revanced/patcher/patch/options/PatchOption; - public static synthetic fun intArrayPatchOption$default (Lapp/revanced/patcher/patch/options/PatchOption$PatchExtensions;Lapp/revanced/patcher/patch/Patch;Ljava/lang/String;[Ljava/lang/Integer;Ljava/util/Set;Ljava/lang/String;Ljava/lang/String;ZLkotlin/jvm/functions/Function2;ILjava/lang/Object;)Lapp/revanced/patcher/patch/options/PatchOption; - public final fun intPatchOption (Lapp/revanced/patcher/patch/Patch;Ljava/lang/String;Ljava/lang/Integer;Ljava/util/Set;Ljava/lang/String;Ljava/lang/String;ZLkotlin/jvm/functions/Function2;)Lapp/revanced/patcher/patch/options/PatchOption; - public static synthetic fun intPatchOption$default (Lapp/revanced/patcher/patch/options/PatchOption$PatchExtensions;Lapp/revanced/patcher/patch/Patch;Ljava/lang/String;Ljava/lang/Integer;Ljava/util/Set;Ljava/lang/String;Ljava/lang/String;ZLkotlin/jvm/functions/Function2;ILjava/lang/Object;)Lapp/revanced/patcher/patch/options/PatchOption; - public final fun longArrayPatchOption (Lapp/revanced/patcher/patch/Patch;Ljava/lang/String;[Ljava/lang/Long;Ljava/util/Set;Ljava/lang/String;Ljava/lang/String;ZLkotlin/jvm/functions/Function2;)Lapp/revanced/patcher/patch/options/PatchOption; - public static synthetic fun longArrayPatchOption$default (Lapp/revanced/patcher/patch/options/PatchOption$PatchExtensions;Lapp/revanced/patcher/patch/Patch;Ljava/lang/String;[Ljava/lang/Long;Ljava/util/Set;Ljava/lang/String;Ljava/lang/String;ZLkotlin/jvm/functions/Function2;ILjava/lang/Object;)Lapp/revanced/patcher/patch/options/PatchOption; - public final fun longPatchOption (Lapp/revanced/patcher/patch/Patch;Ljava/lang/String;Ljava/lang/Long;Ljava/util/Set;Ljava/lang/String;Ljava/lang/String;ZLkotlin/jvm/functions/Function2;)Lapp/revanced/patcher/patch/options/PatchOption; - public static synthetic fun longPatchOption$default (Lapp/revanced/patcher/patch/options/PatchOption$PatchExtensions;Lapp/revanced/patcher/patch/Patch;Ljava/lang/String;Ljava/lang/Long;Ljava/util/Set;Ljava/lang/String;Ljava/lang/String;ZLkotlin/jvm/functions/Function2;ILjava/lang/Object;)Lapp/revanced/patcher/patch/options/PatchOption; - public final fun stringArrayPatchOption (Lapp/revanced/patcher/patch/Patch;Ljava/lang/String;[Ljava/lang/String;Ljava/util/Set;Ljava/lang/String;Ljava/lang/String;ZLkotlin/jvm/functions/Function2;)Lapp/revanced/patcher/patch/options/PatchOption; - public static synthetic fun stringArrayPatchOption$default (Lapp/revanced/patcher/patch/options/PatchOption$PatchExtensions;Lapp/revanced/patcher/patch/Patch;Ljava/lang/String;[Ljava/lang/String;Ljava/util/Set;Ljava/lang/String;Ljava/lang/String;ZLkotlin/jvm/functions/Function2;ILjava/lang/Object;)Lapp/revanced/patcher/patch/options/PatchOption; - public final fun stringPatchOption (Lapp/revanced/patcher/patch/Patch;Ljava/lang/String;Ljava/lang/String;Ljava/util/Set;Ljava/lang/String;Ljava/lang/String;ZLkotlin/jvm/functions/Function2;)Lapp/revanced/patcher/patch/options/PatchOption; - public static synthetic fun stringPatchOption$default (Lapp/revanced/patcher/patch/options/PatchOption$PatchExtensions;Lapp/revanced/patcher/patch/Patch;Ljava/lang/String;Ljava/lang/String;Ljava/util/Set;Ljava/lang/String;Ljava/lang/String;ZLkotlin/jvm/functions/Function2;ILjava/lang/Object;)Lapp/revanced/patcher/patch/options/PatchOption; + public final fun booleanArrayPatchOption (Lapp/revanced/patcher/patch/Patch;Ljava/lang/String;[Ljava/lang/Boolean;Ljava/util/Map;Ljava/lang/String;Ljava/lang/String;ZLkotlin/jvm/functions/Function2;)Lapp/revanced/patcher/patch/options/PatchOption; + public static synthetic fun booleanArrayPatchOption$default (Lapp/revanced/patcher/patch/options/PatchOption$PatchExtensions;Lapp/revanced/patcher/patch/Patch;Ljava/lang/String;[Ljava/lang/Boolean;Ljava/util/Map;Ljava/lang/String;Ljava/lang/String;ZLkotlin/jvm/functions/Function2;ILjava/lang/Object;)Lapp/revanced/patcher/patch/options/PatchOption; + public final fun booleanPatchOption (Lapp/revanced/patcher/patch/Patch;Ljava/lang/String;Ljava/lang/Boolean;Ljava/util/Map;Ljava/lang/String;Ljava/lang/String;ZLkotlin/jvm/functions/Function2;)Lapp/revanced/patcher/patch/options/PatchOption; + public static synthetic fun booleanPatchOption$default (Lapp/revanced/patcher/patch/options/PatchOption$PatchExtensions;Lapp/revanced/patcher/patch/Patch;Ljava/lang/String;Ljava/lang/Boolean;Ljava/util/Map;Ljava/lang/String;Ljava/lang/String;ZLkotlin/jvm/functions/Function2;ILjava/lang/Object;)Lapp/revanced/patcher/patch/options/PatchOption; + public final fun floatArrayPatchOption (Lapp/revanced/patcher/patch/Patch;Ljava/lang/String;[Ljava/lang/Float;Ljava/util/Map;Ljava/lang/String;Ljava/lang/String;ZLkotlin/jvm/functions/Function2;)Lapp/revanced/patcher/patch/options/PatchOption; + public static synthetic fun floatArrayPatchOption$default (Lapp/revanced/patcher/patch/options/PatchOption$PatchExtensions;Lapp/revanced/patcher/patch/Patch;Ljava/lang/String;[Ljava/lang/Float;Ljava/util/Map;Ljava/lang/String;Ljava/lang/String;ZLkotlin/jvm/functions/Function2;ILjava/lang/Object;)Lapp/revanced/patcher/patch/options/PatchOption; + public final fun floatPatchOption (Lapp/revanced/patcher/patch/Patch;Ljava/lang/String;Ljava/lang/Float;Ljava/util/Map;Ljava/lang/String;Ljava/lang/String;ZLkotlin/jvm/functions/Function2;)Lapp/revanced/patcher/patch/options/PatchOption; + public static synthetic fun floatPatchOption$default (Lapp/revanced/patcher/patch/options/PatchOption$PatchExtensions;Lapp/revanced/patcher/patch/Patch;Ljava/lang/String;Ljava/lang/Float;Ljava/util/Map;Ljava/lang/String;Ljava/lang/String;ZLkotlin/jvm/functions/Function2;ILjava/lang/Object;)Lapp/revanced/patcher/patch/options/PatchOption; + public final fun intArrayPatchOption (Lapp/revanced/patcher/patch/Patch;Ljava/lang/String;[Ljava/lang/Integer;Ljava/util/Map;Ljava/lang/String;Ljava/lang/String;ZLkotlin/jvm/functions/Function2;)Lapp/revanced/patcher/patch/options/PatchOption; + public static synthetic fun intArrayPatchOption$default (Lapp/revanced/patcher/patch/options/PatchOption$PatchExtensions;Lapp/revanced/patcher/patch/Patch;Ljava/lang/String;[Ljava/lang/Integer;Ljava/util/Map;Ljava/lang/String;Ljava/lang/String;ZLkotlin/jvm/functions/Function2;ILjava/lang/Object;)Lapp/revanced/patcher/patch/options/PatchOption; + public final fun intPatchOption (Lapp/revanced/patcher/patch/Patch;Ljava/lang/String;Ljava/lang/Integer;Ljava/util/Map;Ljava/lang/String;Ljava/lang/String;ZLkotlin/jvm/functions/Function2;)Lapp/revanced/patcher/patch/options/PatchOption; + public static synthetic fun intPatchOption$default (Lapp/revanced/patcher/patch/options/PatchOption$PatchExtensions;Lapp/revanced/patcher/patch/Patch;Ljava/lang/String;Ljava/lang/Integer;Ljava/util/Map;Ljava/lang/String;Ljava/lang/String;ZLkotlin/jvm/functions/Function2;ILjava/lang/Object;)Lapp/revanced/patcher/patch/options/PatchOption; + public final fun longArrayPatchOption (Lapp/revanced/patcher/patch/Patch;Ljava/lang/String;[Ljava/lang/Long;Ljava/util/Map;Ljava/lang/String;Ljava/lang/String;ZLkotlin/jvm/functions/Function2;)Lapp/revanced/patcher/patch/options/PatchOption; + public static synthetic fun longArrayPatchOption$default (Lapp/revanced/patcher/patch/options/PatchOption$PatchExtensions;Lapp/revanced/patcher/patch/Patch;Ljava/lang/String;[Ljava/lang/Long;Ljava/util/Map;Ljava/lang/String;Ljava/lang/String;ZLkotlin/jvm/functions/Function2;ILjava/lang/Object;)Lapp/revanced/patcher/patch/options/PatchOption; + public final fun longPatchOption (Lapp/revanced/patcher/patch/Patch;Ljava/lang/String;Ljava/lang/Long;Ljava/util/Map;Ljava/lang/String;Ljava/lang/String;ZLkotlin/jvm/functions/Function2;)Lapp/revanced/patcher/patch/options/PatchOption; + public static synthetic fun longPatchOption$default (Lapp/revanced/patcher/patch/options/PatchOption$PatchExtensions;Lapp/revanced/patcher/patch/Patch;Ljava/lang/String;Ljava/lang/Long;Ljava/util/Map;Ljava/lang/String;Ljava/lang/String;ZLkotlin/jvm/functions/Function2;ILjava/lang/Object;)Lapp/revanced/patcher/patch/options/PatchOption; + public final fun stringArrayPatchOption (Lapp/revanced/patcher/patch/Patch;Ljava/lang/String;[Ljava/lang/String;Ljava/util/Map;Ljava/lang/String;Ljava/lang/String;ZLkotlin/jvm/functions/Function2;)Lapp/revanced/patcher/patch/options/PatchOption; + public static synthetic fun stringArrayPatchOption$default (Lapp/revanced/patcher/patch/options/PatchOption$PatchExtensions;Lapp/revanced/patcher/patch/Patch;Ljava/lang/String;[Ljava/lang/String;Ljava/util/Map;Ljava/lang/String;Ljava/lang/String;ZLkotlin/jvm/functions/Function2;ILjava/lang/Object;)Lapp/revanced/patcher/patch/options/PatchOption; + public final fun stringPatchOption (Lapp/revanced/patcher/patch/Patch;Ljava/lang/String;Ljava/lang/String;Ljava/util/Map;Ljava/lang/String;Ljava/lang/String;ZLkotlin/jvm/functions/Function2;)Lapp/revanced/patcher/patch/options/PatchOption; + public static synthetic fun stringPatchOption$default (Lapp/revanced/patcher/patch/options/PatchOption$PatchExtensions;Lapp/revanced/patcher/patch/Patch;Ljava/lang/String;Ljava/lang/String;Ljava/util/Map;Ljava/lang/String;Ljava/lang/String;ZLkotlin/jvm/functions/Function2;ILjava/lang/Object;)Lapp/revanced/patcher/patch/options/PatchOption; } public abstract class app/revanced/patcher/patch/options/PatchOptionException : java/lang/Exception { diff --git a/src/main/kotlin/app/revanced/patcher/patch/options/PatchOption.kt b/src/main/kotlin/app/revanced/patcher/patch/options/PatchOption.kt index 9d0c2fd..923f0af 100644 --- a/src/main/kotlin/app/revanced/patcher/patch/options/PatchOption.kt +++ b/src/main/kotlin/app/revanced/patcher/patch/options/PatchOption.kt @@ -8,7 +8,7 @@ import kotlin.reflect.KProperty * * @param key The identifier. * @param default The default value. - * @param values The set of guaranteed valid values. + * @param values The set of guaranteed valid values identified by their string representation. * @param title The title. * @param description A description. * @param required Whether the option is required. @@ -19,7 +19,7 @@ import kotlin.reflect.KProperty open class PatchOption( val key: String, val default: T?, - val values: Set?, + val values: Map?, val title: String?, val description: String?, val required: Boolean, @@ -105,7 +105,7 @@ open class PatchOption( fun

> P.stringPatchOption( key: String, default: String? = null, - values: Set? = null, + values: Map? = null, title: String? = null, description: String? = null, required: Boolean = false, @@ -130,7 +130,7 @@ open class PatchOption( fun

> P.intPatchOption( key: String, default: Int? = null, - values: Set? = null, + values: Map? = null, title: String? = null, description: String? = null, required: Boolean = false, @@ -155,7 +155,7 @@ open class PatchOption( fun

> P.booleanPatchOption( key: String, default: Boolean? = null, - values: Set? = null, + values: Map? = null, title: String? = null, description: String? = null, required: Boolean = false, @@ -180,7 +180,7 @@ open class PatchOption( fun

> P.floatPatchOption( key: String, default: Float? = null, - values: Set? = null, + values: Map? = null, title: String? = null, description: String? = null, required: Boolean = false, @@ -205,7 +205,7 @@ open class PatchOption( fun

> P.longPatchOption( key: String, default: Long? = null, - values: Set? = null, + values: Map? = null, title: String? = null, description: String? = null, required: Boolean = false, @@ -230,7 +230,7 @@ open class PatchOption( fun

> P.stringArrayPatchOption( key: String, default: Array? = null, - values: Set>? = null, + values: Map?>? = null, title: String? = null, description: String? = null, required: Boolean = false, @@ -255,7 +255,7 @@ open class PatchOption( fun

> P.intArrayPatchOption( key: String, default: Array? = null, - values: Set>? = null, + values: Map?>? = null, title: String? = null, description: String? = null, required: Boolean = false, @@ -280,7 +280,7 @@ open class PatchOption( fun

> P.booleanArrayPatchOption( key: String, default: Array? = null, - values: Set>? = null, + values: Map?>? = null, title: String? = null, description: String? = null, required: Boolean = false, @@ -305,7 +305,7 @@ open class PatchOption( fun

> P.floatArrayPatchOption( key: String, default: Array? = null, - values: Set>? = null, + values: Map?>? = null, title: String? = null, description: String? = null, required: Boolean = false, @@ -330,7 +330,7 @@ open class PatchOption( fun

> P.longArrayPatchOption( key: String, default: Array? = null, - values: Set>? = null, + values: Map?>? = null, title: String? = null, description: String? = null, required: Boolean = false, diff --git a/src/test/kotlin/app/revanced/patcher/patch/options/PatchOptionsTest.kt b/src/test/kotlin/app/revanced/patcher/patch/options/PatchOptionsTest.kt index 2cf04ee..f982af9 100644 --- a/src/test/kotlin/app/revanced/patcher/patch/options/PatchOptionsTest.kt +++ b/src/test/kotlin/app/revanced/patcher/patch/options/PatchOptionsTest.kt @@ -62,7 +62,7 @@ internal class PatchOptionsTest { @Test fun `should allow setting value from values`() = with(OptionsTestPatch.options["choices"] as PatchOption) { - value = values!!.last() + value = values!!.values.last() assertTrue(value == "valid") } @@ -90,12 +90,33 @@ internal class PatchOptionsTest { assertDoesNotThrow { assertNull(OptionsTestPatch.resettableOption.default) } private object OptionsTestPatch : BytecodePatch() { - var booleanOption by booleanPatchOption("bool", true) - var requiredStringOption by stringPatchOption("required", "default", required = true) - var stringArrayOption = stringArrayPatchOption("array", arrayOf("1", "2")) - var stringOptionWithChoices by stringPatchOption("choices", "value", values = setOf("valid")) - var validatedOption by stringPatchOption("validated", "default") { it == "valid" } - var resettableOption = stringPatchOption("resettable", null, required = true) + var booleanOption by booleanPatchOption( + "bool", + true + ) + var requiredStringOption by stringPatchOption( + "required", + "default", + required = true + ) + var stringArrayOption = stringArrayPatchOption( + "array", + arrayOf("1", "2") + ) + var stringOptionWithChoices by stringPatchOption( + "choices", + "value", + values = mapOf("Valid option value" to "valid") + ) + var validatedOption by stringPatchOption( + + "validated", + "default" + ) { it == "valid" } + var resettableOption = stringPatchOption( + "resettable", null, + required = true + ) override fun execute(context: BytecodeContext) {} } From 0447fa9c2846b816c029951eaccb0569544c338b Mon Sep 17 00:00:00 2001 From: semantic-release-bot Date: Sun, 22 Oct 2023 15:39:57 +0000 Subject: [PATCH 24/36] chore(release): 18.0.0-dev.4 [skip ci] # [18.0.0-dev.4](https://github.com/ReVanced/revanced-patcher/compare/v18.0.0-dev.3...v18.0.0-dev.4) (2023-10-22) ### Features * Use a map for `PatchOption#values` ([54ac139](https://github.com/ReVanced/revanced-patcher/commit/54ac1394a914d3eed7865ec697e8016834134911)) --- CHANGELOG.md | 7 +++++++ gradle.properties | 2 +- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 59d691f..be501af 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,10 @@ +# [18.0.0-dev.4](https://github.com/ReVanced/revanced-patcher/compare/v18.0.0-dev.3...v18.0.0-dev.4) (2023-10-22) + + +### Features + +* Use a map for `PatchOption#values` ([54ac139](https://github.com/ReVanced/revanced-patcher/commit/54ac1394a914d3eed7865ec697e8016834134911)) + # [18.0.0-dev.3](https://github.com/ReVanced/revanced-patcher/compare/v18.0.0-dev.2...v18.0.0-dev.3) (2023-10-22) diff --git a/gradle.properties b/gradle.properties index 700feef..2e0672f 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,4 +1,4 @@ org.gradle.parallel = true org.gradle.caching = true kotlin.code.style = official -version = 18.0.0-dev.3 +version = 18.0.0-dev.4 From a76ac04214a2ab91e3b2f9dddb13ed52816fe723 Mon Sep 17 00:00:00 2001 From: oSumAtrIX Date: Sun, 22 Oct 2023 18:08:00 +0200 Subject: [PATCH 25/36] fix: Do not set patch fields if they are empty --- src/main/kotlin/app/revanced/patcher/patch/Patch.kt | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/main/kotlin/app/revanced/patcher/patch/Patch.kt b/src/main/kotlin/app/revanced/patcher/patch/Patch.kt index c48939c..f962505 100644 --- a/src/main/kotlin/app/revanced/patcher/patch/Patch.kt +++ b/src/main/kotlin/app/revanced/patcher/patch/Patch.kt @@ -65,7 +65,8 @@ sealed class Patch> { name = annotation.name.ifEmpty { null } description = annotation.description.ifEmpty { null } compatiblePackages = annotation.compatiblePackages - .map { CompatiblePackage(it.name, it.versions.toSet()) }.toSet() + .map { CompatiblePackage(it.name, it.versions.toSet().ifEmpty { null }) } + .toSet().ifEmpty { null } dependencies = annotation.dependencies.toSet().ifEmpty { null } use = annotation.use requiresIntegrations = annotation.requiresIntegrations From f77624b3b94535e56f680bfbb21c8fe78bbc5a69 Mon Sep 17 00:00:00 2001 From: semantic-release-bot Date: Sun, 22 Oct 2023 16:10:54 +0000 Subject: [PATCH 26/36] chore(release): 18.0.0-dev.5 [skip ci] # [18.0.0-dev.5](https://github.com/ReVanced/revanced-patcher/compare/v18.0.0-dev.4...v18.0.0-dev.5) (2023-10-22) ### Bug Fixes * Do not set patch fields if they are empty ([a76ac04](https://github.com/ReVanced/revanced-patcher/commit/a76ac04214a2ab91e3b2f9dddb13ed52816fe723)) --- CHANGELOG.md | 7 +++++++ gradle.properties | 2 +- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index be501af..df5448c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,10 @@ +# [18.0.0-dev.5](https://github.com/ReVanced/revanced-patcher/compare/v18.0.0-dev.4...v18.0.0-dev.5) (2023-10-22) + + +### Bug Fixes + +* Do not set patch fields if they are empty ([a76ac04](https://github.com/ReVanced/revanced-patcher/commit/a76ac04214a2ab91e3b2f9dddb13ed52816fe723)) + # [18.0.0-dev.4](https://github.com/ReVanced/revanced-patcher/compare/v18.0.0-dev.3...v18.0.0-dev.4) (2023-10-22) diff --git a/gradle.properties b/gradle.properties index 2e0672f..ad697f2 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,4 +1,4 @@ org.gradle.parallel = true org.gradle.caching = true kotlin.code.style = official -version = 18.0.0-dev.4 +version = 18.0.0-dev.5 From 124a2e9d3efb88f0f038ae306d941e918ad3ad3c Mon Sep 17 00:00:00 2001 From: oSumAtrIX Date: Mon, 23 Oct 2023 00:08:32 +0200 Subject: [PATCH 27/36] refactor: Move files to simplify package structure BREAKING CHANGE: Classes and members have changed packages. --- api/revanced-patcher.api | 81 +++++++++---------- .../kotlin/app/revanced/patcher/Patcher.kt | 4 +- .../extensions/MethodFingerprintExtensions.kt | 4 +- .../patcher/fingerprint/Fingerprint.kt | 2 - .../{method/impl => }/MethodFingerprint.kt | 5 +- .../MethodFingerprintAnnotations.kt} | 4 +- .../revanced/patcher/patch/BytecodePatch.kt | 2 +- .../patcher/patch/usage/ExampleFingerprint.kt | 4 +- 8 files changed, 47 insertions(+), 59 deletions(-) rename src/main/kotlin/app/revanced/patcher/fingerprint/{method/impl => }/MethodFingerprint.kt (99%) rename src/main/kotlin/app/revanced/patcher/fingerprint/{method/annotation/MethodFingerprintMetadata.kt => annotation/MethodFingerprintAnnotations.kt} (67%) diff --git a/api/revanced-patcher.api b/api/revanced-patcher.api index ad2494c..1748398 100644 --- a/api/revanced-patcher.api +++ b/api/revanced-patcher.api @@ -169,69 +169,65 @@ public final class app/revanced/patcher/extensions/InstructionExtensions { public final class app/revanced/patcher/extensions/MethodFingerprintExtensions { public static final field INSTANCE Lapp/revanced/patcher/extensions/MethodFingerprintExtensions; - public final fun getFuzzyPatternScanMethod (Lapp/revanced/patcher/fingerprint/method/impl/MethodFingerprint;)Lapp/revanced/patcher/fingerprint/method/annotation/FuzzyPatternScanMethod; + public final fun getFuzzyPatternScanMethod (Lapp/revanced/patcher/fingerprint/MethodFingerprint;)Lapp/revanced/patcher/fingerprint/annotation/FuzzyPatternScanMethod; } public abstract interface class app/revanced/patcher/fingerprint/Fingerprint { } -public abstract interface annotation class app/revanced/patcher/fingerprint/method/annotation/FuzzyPatternScanMethod : java/lang/annotation/Annotation { - public abstract fun threshold ()I -} - -public abstract class app/revanced/patcher/fingerprint/method/impl/MethodFingerprint : app/revanced/patcher/fingerprint/Fingerprint { - public static final field Companion Lapp/revanced/patcher/fingerprint/method/impl/MethodFingerprint$Companion; +public abstract class app/revanced/patcher/fingerprint/MethodFingerprint : app/revanced/patcher/fingerprint/Fingerprint { + public static final field Companion Lapp/revanced/patcher/fingerprint/MethodFingerprint$Companion; public fun ()V public fun (Ljava/lang/String;Ljava/lang/Integer;Ljava/lang/Iterable;Ljava/lang/Iterable;Ljava/lang/Iterable;Lkotlin/jvm/functions/Function2;)V public synthetic fun (Ljava/lang/String;Ljava/lang/Integer;Ljava/lang/Iterable;Ljava/lang/Iterable;Ljava/lang/Iterable;Lkotlin/jvm/functions/Function2;ILkotlin/jvm/internal/DefaultConstructorMarker;)V - public final fun getResult ()Lapp/revanced/patcher/fingerprint/method/impl/MethodFingerprintResult; - public final fun setResult (Lapp/revanced/patcher/fingerprint/method/impl/MethodFingerprintResult;)V + public final fun getResult ()Lapp/revanced/patcher/fingerprint/MethodFingerprintResult; + public final fun setResult (Lapp/revanced/patcher/fingerprint/MethodFingerprintResult;)V } -public final class app/revanced/patcher/fingerprint/method/impl/MethodFingerprint$Companion { - public final fun resolve (Lapp/revanced/patcher/fingerprint/method/impl/MethodFingerprint;Lapp/revanced/patcher/data/BytecodeContext;Lcom/android/tools/smali/dexlib2/iface/ClassDef;)Z - public final fun resolve (Lapp/revanced/patcher/fingerprint/method/impl/MethodFingerprint;Lapp/revanced/patcher/data/BytecodeContext;Lcom/android/tools/smali/dexlib2/iface/Method;Lcom/android/tools/smali/dexlib2/iface/ClassDef;)Z +public final class app/revanced/patcher/fingerprint/MethodFingerprint$Companion { + public final fun resolve (Lapp/revanced/patcher/fingerprint/MethodFingerprint;Lapp/revanced/patcher/data/BytecodeContext;Lcom/android/tools/smali/dexlib2/iface/ClassDef;)Z + public final fun resolve (Lapp/revanced/patcher/fingerprint/MethodFingerprint;Lapp/revanced/patcher/data/BytecodeContext;Lcom/android/tools/smali/dexlib2/iface/Method;Lcom/android/tools/smali/dexlib2/iface/ClassDef;)Z public final fun resolve (Ljava/lang/Iterable;Lapp/revanced/patcher/data/BytecodeContext;Ljava/lang/Iterable;)V } -public final class app/revanced/patcher/fingerprint/method/impl/MethodFingerprintResult { - public fun (Lcom/android/tools/smali/dexlib2/iface/Method;Lcom/android/tools/smali/dexlib2/iface/ClassDef;Lapp/revanced/patcher/fingerprint/method/impl/MethodFingerprintResult$MethodFingerprintScanResult;Lapp/revanced/patcher/data/BytecodeContext;)V +public final class app/revanced/patcher/fingerprint/MethodFingerprintResult { + public fun (Lcom/android/tools/smali/dexlib2/iface/Method;Lcom/android/tools/smali/dexlib2/iface/ClassDef;Lapp/revanced/patcher/fingerprint/MethodFingerprintResult$MethodFingerprintScanResult;Lapp/revanced/patcher/data/BytecodeContext;)V public final fun component1 ()Lcom/android/tools/smali/dexlib2/iface/Method; public final fun component2 ()Lcom/android/tools/smali/dexlib2/iface/ClassDef; - public final fun component3 ()Lapp/revanced/patcher/fingerprint/method/impl/MethodFingerprintResult$MethodFingerprintScanResult; - public final fun copy (Lcom/android/tools/smali/dexlib2/iface/Method;Lcom/android/tools/smali/dexlib2/iface/ClassDef;Lapp/revanced/patcher/fingerprint/method/impl/MethodFingerprintResult$MethodFingerprintScanResult;Lapp/revanced/patcher/data/BytecodeContext;)Lapp/revanced/patcher/fingerprint/method/impl/MethodFingerprintResult; - public static synthetic fun copy$default (Lapp/revanced/patcher/fingerprint/method/impl/MethodFingerprintResult;Lcom/android/tools/smali/dexlib2/iface/Method;Lcom/android/tools/smali/dexlib2/iface/ClassDef;Lapp/revanced/patcher/fingerprint/method/impl/MethodFingerprintResult$MethodFingerprintScanResult;Lapp/revanced/patcher/data/BytecodeContext;ILjava/lang/Object;)Lapp/revanced/patcher/fingerprint/method/impl/MethodFingerprintResult; + public final fun component3 ()Lapp/revanced/patcher/fingerprint/MethodFingerprintResult$MethodFingerprintScanResult; + public final fun copy (Lcom/android/tools/smali/dexlib2/iface/Method;Lcom/android/tools/smali/dexlib2/iface/ClassDef;Lapp/revanced/patcher/fingerprint/MethodFingerprintResult$MethodFingerprintScanResult;Lapp/revanced/patcher/data/BytecodeContext;)Lapp/revanced/patcher/fingerprint/MethodFingerprintResult; + public static synthetic fun copy$default (Lapp/revanced/patcher/fingerprint/MethodFingerprintResult;Lcom/android/tools/smali/dexlib2/iface/Method;Lcom/android/tools/smali/dexlib2/iface/ClassDef;Lapp/revanced/patcher/fingerprint/MethodFingerprintResult$MethodFingerprintScanResult;Lapp/revanced/patcher/data/BytecodeContext;ILjava/lang/Object;)Lapp/revanced/patcher/fingerprint/MethodFingerprintResult; public fun equals (Ljava/lang/Object;)Z public final fun getClassDef ()Lcom/android/tools/smali/dexlib2/iface/ClassDef; public final fun getMethod ()Lcom/android/tools/smali/dexlib2/iface/Method; public final fun getMutableClass ()Lapp/revanced/patcher/util/proxy/mutableTypes/MutableClass; public final fun getMutableMethod ()Lapp/revanced/patcher/util/proxy/mutableTypes/MutableMethod; - public final fun getScanResult ()Lapp/revanced/patcher/fingerprint/method/impl/MethodFingerprintResult$MethodFingerprintScanResult; + public final fun getScanResult ()Lapp/revanced/patcher/fingerprint/MethodFingerprintResult$MethodFingerprintScanResult; public fun hashCode ()I public fun toString ()Ljava/lang/String; } -public final class app/revanced/patcher/fingerprint/method/impl/MethodFingerprintResult$MethodFingerprintScanResult { - public fun (Lapp/revanced/patcher/fingerprint/method/impl/MethodFingerprintResult$MethodFingerprintScanResult$PatternScanResult;Lapp/revanced/patcher/fingerprint/method/impl/MethodFingerprintResult$MethodFingerprintScanResult$StringsScanResult;)V - public final fun component1 ()Lapp/revanced/patcher/fingerprint/method/impl/MethodFingerprintResult$MethodFingerprintScanResult$PatternScanResult; - public final fun component2 ()Lapp/revanced/patcher/fingerprint/method/impl/MethodFingerprintResult$MethodFingerprintScanResult$StringsScanResult; - public final fun copy (Lapp/revanced/patcher/fingerprint/method/impl/MethodFingerprintResult$MethodFingerprintScanResult$PatternScanResult;Lapp/revanced/patcher/fingerprint/method/impl/MethodFingerprintResult$MethodFingerprintScanResult$StringsScanResult;)Lapp/revanced/patcher/fingerprint/method/impl/MethodFingerprintResult$MethodFingerprintScanResult; - public static synthetic fun copy$default (Lapp/revanced/patcher/fingerprint/method/impl/MethodFingerprintResult$MethodFingerprintScanResult;Lapp/revanced/patcher/fingerprint/method/impl/MethodFingerprintResult$MethodFingerprintScanResult$PatternScanResult;Lapp/revanced/patcher/fingerprint/method/impl/MethodFingerprintResult$MethodFingerprintScanResult$StringsScanResult;ILjava/lang/Object;)Lapp/revanced/patcher/fingerprint/method/impl/MethodFingerprintResult$MethodFingerprintScanResult; +public final class app/revanced/patcher/fingerprint/MethodFingerprintResult$MethodFingerprintScanResult { + public fun (Lapp/revanced/patcher/fingerprint/MethodFingerprintResult$MethodFingerprintScanResult$PatternScanResult;Lapp/revanced/patcher/fingerprint/MethodFingerprintResult$MethodFingerprintScanResult$StringsScanResult;)V + public final fun component1 ()Lapp/revanced/patcher/fingerprint/MethodFingerprintResult$MethodFingerprintScanResult$PatternScanResult; + public final fun component2 ()Lapp/revanced/patcher/fingerprint/MethodFingerprintResult$MethodFingerprintScanResult$StringsScanResult; + public final fun copy (Lapp/revanced/patcher/fingerprint/MethodFingerprintResult$MethodFingerprintScanResult$PatternScanResult;Lapp/revanced/patcher/fingerprint/MethodFingerprintResult$MethodFingerprintScanResult$StringsScanResult;)Lapp/revanced/patcher/fingerprint/MethodFingerprintResult$MethodFingerprintScanResult; + public static synthetic fun copy$default (Lapp/revanced/patcher/fingerprint/MethodFingerprintResult$MethodFingerprintScanResult;Lapp/revanced/patcher/fingerprint/MethodFingerprintResult$MethodFingerprintScanResult$PatternScanResult;Lapp/revanced/patcher/fingerprint/MethodFingerprintResult$MethodFingerprintScanResult$StringsScanResult;ILjava/lang/Object;)Lapp/revanced/patcher/fingerprint/MethodFingerprintResult$MethodFingerprintScanResult; public fun equals (Ljava/lang/Object;)Z - public final fun getPatternScanResult ()Lapp/revanced/patcher/fingerprint/method/impl/MethodFingerprintResult$MethodFingerprintScanResult$PatternScanResult; - public final fun getStringsScanResult ()Lapp/revanced/patcher/fingerprint/method/impl/MethodFingerprintResult$MethodFingerprintScanResult$StringsScanResult; + public final fun getPatternScanResult ()Lapp/revanced/patcher/fingerprint/MethodFingerprintResult$MethodFingerprintScanResult$PatternScanResult; + public final fun getStringsScanResult ()Lapp/revanced/patcher/fingerprint/MethodFingerprintResult$MethodFingerprintScanResult$StringsScanResult; public fun hashCode ()I public fun toString ()Ljava/lang/String; } -public final class app/revanced/patcher/fingerprint/method/impl/MethodFingerprintResult$MethodFingerprintScanResult$PatternScanResult { +public final class app/revanced/patcher/fingerprint/MethodFingerprintResult$MethodFingerprintScanResult$PatternScanResult { public fun (IILjava/util/List;)V public synthetic fun (IILjava/util/List;ILkotlin/jvm/internal/DefaultConstructorMarker;)V public final fun component1 ()I public final fun component2 ()I public final fun component3 ()Ljava/util/List; - public final fun copy (IILjava/util/List;)Lapp/revanced/patcher/fingerprint/method/impl/MethodFingerprintResult$MethodFingerprintScanResult$PatternScanResult; - public static synthetic fun copy$default (Lapp/revanced/patcher/fingerprint/method/impl/MethodFingerprintResult$MethodFingerprintScanResult$PatternScanResult;IILjava/util/List;ILjava/lang/Object;)Lapp/revanced/patcher/fingerprint/method/impl/MethodFingerprintResult$MethodFingerprintScanResult$PatternScanResult; + public final fun copy (IILjava/util/List;)Lapp/revanced/patcher/fingerprint/MethodFingerprintResult$MethodFingerprintScanResult$PatternScanResult; + public static synthetic fun copy$default (Lapp/revanced/patcher/fingerprint/MethodFingerprintResult$MethodFingerprintScanResult$PatternScanResult;IILjava/util/List;ILjava/lang/Object;)Lapp/revanced/patcher/fingerprint/MethodFingerprintResult$MethodFingerprintScanResult$PatternScanResult; public fun equals (Ljava/lang/Object;)Z public final fun getEndIndex ()I public final fun getStartIndex ()I @@ -241,40 +237,31 @@ public final class app/revanced/patcher/fingerprint/method/impl/MethodFingerprin public fun toString ()Ljava/lang/String; } -public final class app/revanced/patcher/fingerprint/method/impl/MethodFingerprintResult$MethodFingerprintScanResult$PatternScanResult$Warning { +public final class app/revanced/patcher/fingerprint/MethodFingerprintResult$MethodFingerprintScanResult$PatternScanResult$Warning { public fun (Lcom/android/tools/smali/dexlib2/Opcode;Lcom/android/tools/smali/dexlib2/Opcode;II)V - public final fun component1 ()Lcom/android/tools/smali/dexlib2/Opcode; - public final fun component2 ()Lcom/android/tools/smali/dexlib2/Opcode; - public final fun component3 ()I - public final fun component4 ()I - public final fun copy (Lcom/android/tools/smali/dexlib2/Opcode;Lcom/android/tools/smali/dexlib2/Opcode;II)Lapp/revanced/patcher/fingerprint/method/impl/MethodFingerprintResult$MethodFingerprintScanResult$PatternScanResult$Warning; - public static synthetic fun copy$default (Lapp/revanced/patcher/fingerprint/method/impl/MethodFingerprintResult$MethodFingerprintScanResult$PatternScanResult$Warning;Lcom/android/tools/smali/dexlib2/Opcode;Lcom/android/tools/smali/dexlib2/Opcode;IIILjava/lang/Object;)Lapp/revanced/patcher/fingerprint/method/impl/MethodFingerprintResult$MethodFingerprintScanResult$PatternScanResult$Warning; - public fun equals (Ljava/lang/Object;)Z public final fun getCorrectOpcode ()Lcom/android/tools/smali/dexlib2/Opcode; public final fun getInstructionIndex ()I public final fun getPatternIndex ()I public final fun getWrongOpcode ()Lcom/android/tools/smali/dexlib2/Opcode; - public fun hashCode ()I - public fun toString ()Ljava/lang/String; } -public final class app/revanced/patcher/fingerprint/method/impl/MethodFingerprintResult$MethodFingerprintScanResult$StringsScanResult { +public final class app/revanced/patcher/fingerprint/MethodFingerprintResult$MethodFingerprintScanResult$StringsScanResult { public fun (Ljava/util/List;)V public final fun component1 ()Ljava/util/List; - public final fun copy (Ljava/util/List;)Lapp/revanced/patcher/fingerprint/method/impl/MethodFingerprintResult$MethodFingerprintScanResult$StringsScanResult; - public static synthetic fun copy$default (Lapp/revanced/patcher/fingerprint/method/impl/MethodFingerprintResult$MethodFingerprintScanResult$StringsScanResult;Ljava/util/List;ILjava/lang/Object;)Lapp/revanced/patcher/fingerprint/method/impl/MethodFingerprintResult$MethodFingerprintScanResult$StringsScanResult; + public final fun copy (Ljava/util/List;)Lapp/revanced/patcher/fingerprint/MethodFingerprintResult$MethodFingerprintScanResult$StringsScanResult; + public static synthetic fun copy$default (Lapp/revanced/patcher/fingerprint/MethodFingerprintResult$MethodFingerprintScanResult$StringsScanResult;Ljava/util/List;ILjava/lang/Object;)Lapp/revanced/patcher/fingerprint/MethodFingerprintResult$MethodFingerprintScanResult$StringsScanResult; public fun equals (Ljava/lang/Object;)Z public final fun getMatches ()Ljava/util/List; public fun hashCode ()I public fun toString ()Ljava/lang/String; } -public final class app/revanced/patcher/fingerprint/method/impl/MethodFingerprintResult$MethodFingerprintScanResult$StringsScanResult$StringMatch { +public final class app/revanced/patcher/fingerprint/MethodFingerprintResult$MethodFingerprintScanResult$StringsScanResult$StringMatch { public fun (Ljava/lang/String;I)V public final fun component1 ()Ljava/lang/String; public final fun component2 ()I - public final fun copy (Ljava/lang/String;I)Lapp/revanced/patcher/fingerprint/method/impl/MethodFingerprintResult$MethodFingerprintScanResult$StringsScanResult$StringMatch; - public static synthetic fun copy$default (Lapp/revanced/patcher/fingerprint/method/impl/MethodFingerprintResult$MethodFingerprintScanResult$StringsScanResult$StringMatch;Ljava/lang/String;IILjava/lang/Object;)Lapp/revanced/patcher/fingerprint/method/impl/MethodFingerprintResult$MethodFingerprintScanResult$StringsScanResult$StringMatch; + public final fun copy (Ljava/lang/String;I)Lapp/revanced/patcher/fingerprint/MethodFingerprintResult$MethodFingerprintScanResult$StringsScanResult$StringMatch; + public static synthetic fun copy$default (Lapp/revanced/patcher/fingerprint/MethodFingerprintResult$MethodFingerprintScanResult$StringsScanResult$StringMatch;Ljava/lang/String;IILjava/lang/Object;)Lapp/revanced/patcher/fingerprint/MethodFingerprintResult$MethodFingerprintScanResult$StringsScanResult$StringMatch; public fun equals (Ljava/lang/Object;)Z public final fun getIndex ()I public final fun getString ()Ljava/lang/String; @@ -282,6 +269,10 @@ public final class app/revanced/patcher/fingerprint/method/impl/MethodFingerprin public fun toString ()Ljava/lang/String; } +public abstract interface annotation class app/revanced/patcher/fingerprint/annotation/FuzzyPatternScanMethod : java/lang/annotation/Annotation { + public abstract fun threshold ()I +} + public abstract interface class app/revanced/patcher/logging/Logger { public abstract fun error (Ljava/lang/String;)V public abstract fun info (Ljava/lang/String;)V diff --git a/src/main/kotlin/app/revanced/patcher/Patcher.kt b/src/main/kotlin/app/revanced/patcher/Patcher.kt index dd63735..86018e9 100644 --- a/src/main/kotlin/app/revanced/patcher/Patcher.kt +++ b/src/main/kotlin/app/revanced/patcher/Patcher.kt @@ -2,8 +2,8 @@ package app.revanced.patcher import app.revanced.patcher.PatchBundleLoader.Utils.getInstance import app.revanced.patcher.data.ResourceContext -import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint -import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint.Companion.resolveUsingLookupMap +import app.revanced.patcher.fingerprint.MethodFingerprint +import app.revanced.patcher.fingerprint.MethodFingerprint.Companion.resolveUsingLookupMap import app.revanced.patcher.patch.* import kotlinx.coroutines.flow.flow import java.io.Closeable diff --git a/src/main/kotlin/app/revanced/patcher/extensions/MethodFingerprintExtensions.kt b/src/main/kotlin/app/revanced/patcher/extensions/MethodFingerprintExtensions.kt index e722f7d..f0906f8 100644 --- a/src/main/kotlin/app/revanced/patcher/extensions/MethodFingerprintExtensions.kt +++ b/src/main/kotlin/app/revanced/patcher/extensions/MethodFingerprintExtensions.kt @@ -1,8 +1,8 @@ package app.revanced.patcher.extensions import app.revanced.patcher.extensions.AnnotationExtensions.findAnnotationRecursively -import app.revanced.patcher.fingerprint.method.annotation.FuzzyPatternScanMethod -import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint +import app.revanced.patcher.fingerprint.annotation.FuzzyPatternScanMethod +import app.revanced.patcher.fingerprint.MethodFingerprint object MethodFingerprintExtensions { // TODO: Make this a property. diff --git a/src/main/kotlin/app/revanced/patcher/fingerprint/Fingerprint.kt b/src/main/kotlin/app/revanced/patcher/fingerprint/Fingerprint.kt index d688114..05e949b 100644 --- a/src/main/kotlin/app/revanced/patcher/fingerprint/Fingerprint.kt +++ b/src/main/kotlin/app/revanced/patcher/fingerprint/Fingerprint.kt @@ -1,7 +1,5 @@ package app.revanced.patcher.fingerprint -import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint - /** * A ReVanced fingerprint. * Can be a [MethodFingerprint]. diff --git a/src/main/kotlin/app/revanced/patcher/fingerprint/method/impl/MethodFingerprint.kt b/src/main/kotlin/app/revanced/patcher/fingerprint/MethodFingerprint.kt similarity index 99% rename from src/main/kotlin/app/revanced/patcher/fingerprint/method/impl/MethodFingerprint.kt rename to src/main/kotlin/app/revanced/patcher/fingerprint/MethodFingerprint.kt index 4eef2f6..951b933 100644 --- a/src/main/kotlin/app/revanced/patcher/fingerprint/method/impl/MethodFingerprint.kt +++ b/src/main/kotlin/app/revanced/patcher/fingerprint/MethodFingerprint.kt @@ -1,9 +1,8 @@ -package app.revanced.patcher.fingerprint.method.impl +package app.revanced.patcher.fingerprint import app.revanced.patcher.data.BytecodeContext import app.revanced.patcher.extensions.MethodFingerprintExtensions.fuzzyPatternScanMethod -import app.revanced.patcher.fingerprint.Fingerprint -import app.revanced.patcher.fingerprint.method.annotation.FuzzyPatternScanMethod +import app.revanced.patcher.fingerprint.annotation.FuzzyPatternScanMethod import app.revanced.patcher.patch.PatchException import app.revanced.patcher.util.proxy.ClassProxy import com.android.tools.smali.dexlib2.AccessFlags diff --git a/src/main/kotlin/app/revanced/patcher/fingerprint/method/annotation/MethodFingerprintMetadata.kt b/src/main/kotlin/app/revanced/patcher/fingerprint/annotation/MethodFingerprintAnnotations.kt similarity index 67% rename from src/main/kotlin/app/revanced/patcher/fingerprint/method/annotation/MethodFingerprintMetadata.kt rename to src/main/kotlin/app/revanced/patcher/fingerprint/annotation/MethodFingerprintAnnotations.kt index c4dfbf4..e0d5121 100644 --- a/src/main/kotlin/app/revanced/patcher/fingerprint/method/annotation/MethodFingerprintMetadata.kt +++ b/src/main/kotlin/app/revanced/patcher/fingerprint/annotation/MethodFingerprintAnnotations.kt @@ -1,6 +1,6 @@ -package app.revanced.patcher.fingerprint.method.annotation +package app.revanced.patcher.fingerprint.annotation -import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint +import app.revanced.patcher.fingerprint.MethodFingerprint /** * Annotations to scan a pattern [MethodFingerprint] with fuzzy algorithm. diff --git a/src/main/kotlin/app/revanced/patcher/patch/BytecodePatch.kt b/src/main/kotlin/app/revanced/patcher/patch/BytecodePatch.kt index fe918e6..c2d1930 100644 --- a/src/main/kotlin/app/revanced/patcher/patch/BytecodePatch.kt +++ b/src/main/kotlin/app/revanced/patcher/patch/BytecodePatch.kt @@ -1,7 +1,7 @@ package app.revanced.patcher.patch import app.revanced.patcher.data.BytecodeContext -import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint +import app.revanced.patcher.fingerprint.MethodFingerprint /** * A ReVanced [Patch] that works on [BytecodeContext]. diff --git a/src/test/kotlin/app/revanced/patcher/patch/usage/ExampleFingerprint.kt b/src/test/kotlin/app/revanced/patcher/patch/usage/ExampleFingerprint.kt index 0958aef..3a1d7d4 100644 --- a/src/test/kotlin/app/revanced/patcher/patch/usage/ExampleFingerprint.kt +++ b/src/test/kotlin/app/revanced/patcher/patch/usage/ExampleFingerprint.kt @@ -1,7 +1,7 @@ package app.revanced.patcher.patch.usage import app.revanced.patcher.extensions.or -import app.revanced.patcher.fingerprint.method.annotation.FuzzyPatternScanMethod -import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint +import app.revanced.patcher.fingerprint.annotation.FuzzyPatternScanMethod +import app.revanced.patcher.fingerprint.MethodFingerprint import com.android.tools.smali.dexlib2.AccessFlags import com.android.tools.smali.dexlib2.Opcode From a4212f6bf952971541c4550e20f6bf57a382e19a Mon Sep 17 00:00:00 2001 From: oSumAtrIX Date: Mon, 23 Oct 2023 00:10:18 +0200 Subject: [PATCH 28/36] refactor: Remove deprecated classes and members BREAKING CHANGE: Some deprecated classes and members are not present anymore. --- api/revanced-patcher.api | 24 ------------------- .../app/revanced/patcher/PatcherOptions.kt | 21 ---------------- .../app/revanced/patcher/logging/Logger.kt | 9 ------- .../patcher/logging/impl/NopLogger.kt | 6 ----- 4 files changed, 60 deletions(-) delete mode 100644 src/main/kotlin/app/revanced/patcher/logging/Logger.kt delete mode 100644 src/main/kotlin/app/revanced/patcher/logging/impl/NopLogger.kt diff --git a/api/revanced-patcher.api b/api/revanced-patcher.api index 1748398..03b09a4 100644 --- a/api/revanced-patcher.api +++ b/api/revanced-patcher.api @@ -65,8 +65,6 @@ public final class app/revanced/patcher/PatcherException$CircularDependencyExcep } public final class app/revanced/patcher/PatcherOptions { - public fun (Ljava/io/File;Ljava/io/File;Ljava/lang/String;Ljava/lang/String;)V - public synthetic fun (Ljava/io/File;Ljava/io/File;Ljava/lang/String;Ljava/lang/String;ILkotlin/jvm/internal/DefaultConstructorMarker;)V public fun (Ljava/io/File;Ljava/io/File;Ljava/lang/String;Ljava/lang/String;Z)V public synthetic fun (Ljava/io/File;Ljava/io/File;Ljava/lang/String;Ljava/lang/String;ZILkotlin/jvm/internal/DefaultConstructorMarker;)V public final fun copy (Ljava/io/File;Ljava/io/File;Ljava/lang/String;Ljava/lang/String;Z)Lapp/revanced/patcher/PatcherOptions; @@ -273,28 +271,6 @@ public abstract interface annotation class app/revanced/patcher/fingerprint/anno public abstract fun threshold ()I } -public abstract interface class app/revanced/patcher/logging/Logger { - public abstract fun error (Ljava/lang/String;)V - public abstract fun info (Ljava/lang/String;)V - public abstract fun trace (Ljava/lang/String;)V - public abstract fun warn (Ljava/lang/String;)V -} - -public final class app/revanced/patcher/logging/Logger$DefaultImpls { - public static fun error (Lapp/revanced/patcher/logging/Logger;Ljava/lang/String;)V - public static fun info (Lapp/revanced/patcher/logging/Logger;Ljava/lang/String;)V - public static fun trace (Lapp/revanced/patcher/logging/Logger;Ljava/lang/String;)V - public static fun warn (Lapp/revanced/patcher/logging/Logger;Ljava/lang/String;)V -} - -public final class app/revanced/patcher/logging/impl/NopLogger : app/revanced/patcher/logging/Logger { - public static final field INSTANCE Lapp/revanced/patcher/logging/impl/NopLogger; - public fun error (Ljava/lang/String;)V - public fun info (Ljava/lang/String;)V - public fun trace (Ljava/lang/String;)V - public fun warn (Ljava/lang/String;)V -} - public abstract class app/revanced/patcher/patch/BytecodePatch : app/revanced/patcher/patch/Patch { public fun ()V public fun (Ljava/util/Set;)V diff --git a/src/main/kotlin/app/revanced/patcher/PatcherOptions.kt b/src/main/kotlin/app/revanced/patcher/PatcherOptions.kt index 1bed358..e5eb7b6 100644 --- a/src/main/kotlin/app/revanced/patcher/PatcherOptions.kt +++ b/src/main/kotlin/app/revanced/patcher/PatcherOptions.kt @@ -38,27 +38,6 @@ data class PatcherOptions( frameworkDirectory = frameworkFileDirectory } - /** - * Options for ReVanced [Patcher]. - * @param inputFile The input file to patch. - * @param resourceCachePath The path to the directory to use for caching resources. - * @param aaptBinaryPath The path to a custom aapt binary. - * @param frameworkFileDirectory The path to the directory to cache the framework file in. - */ - @Deprecated("Use the constructor with the multithreadingDexFileWriter parameter instead") - constructor( - inputFile: File, - resourceCachePath: File = File("revanced-resource-cache"), - aaptBinaryPath: String? = null, - frameworkFileDirectory: String? = null, - ) : this( - inputFile, - resourceCachePath, - aaptBinaryPath, - frameworkFileDirectory, - false, - ) - fun recreateResourceCacheDirectory() = resourceCachePath.also { if (it.exists()) { logger.info("Deleting existing resource cache directory") diff --git a/src/main/kotlin/app/revanced/patcher/logging/Logger.kt b/src/main/kotlin/app/revanced/patcher/logging/Logger.kt deleted file mode 100644 index 6b29454..0000000 --- a/src/main/kotlin/app/revanced/patcher/logging/Logger.kt +++ /dev/null @@ -1,9 +0,0 @@ -package app.revanced.patcher.logging - -@Deprecated("This will be removed in a future release") -interface Logger { - fun error(msg: String) {} - fun warn(msg: String) {} - fun info(msg: String) {} - fun trace(msg: String) {} -} \ No newline at end of file diff --git a/src/main/kotlin/app/revanced/patcher/logging/impl/NopLogger.kt b/src/main/kotlin/app/revanced/patcher/logging/impl/NopLogger.kt deleted file mode 100644 index 1185975..0000000 --- a/src/main/kotlin/app/revanced/patcher/logging/impl/NopLogger.kt +++ /dev/null @@ -1,6 +0,0 @@ -package app.revanced.patcher.logging.impl - -import app.revanced.patcher.logging.Logger - -@Deprecated("This will be removed in a future release") -object NopLogger : Logger \ No newline at end of file From 6192089b71bdca15765369f3e607ddd1f8266205 Mon Sep 17 00:00:00 2001 From: oSumAtrIX Date: Mon, 23 Oct 2023 00:11:50 +0200 Subject: [PATCH 29/36] refactor: Change data classes to actual classes The data class members did not serve any actual purpose. BREAKING CHANGE: This gets rid of data class members. --- api/revanced-patcher.api | 36 ------------------- .../patcher/fingerprint/MethodFingerprint.kt | 12 +++---- 2 files changed, 6 insertions(+), 42 deletions(-) diff --git a/api/revanced-patcher.api b/api/revanced-patcher.api index 03b09a4..d9c616b 100644 --- a/api/revanced-patcher.api +++ b/api/revanced-patcher.api @@ -190,49 +190,26 @@ public final class app/revanced/patcher/fingerprint/MethodFingerprint$Companion public final class app/revanced/patcher/fingerprint/MethodFingerprintResult { public fun (Lcom/android/tools/smali/dexlib2/iface/Method;Lcom/android/tools/smali/dexlib2/iface/ClassDef;Lapp/revanced/patcher/fingerprint/MethodFingerprintResult$MethodFingerprintScanResult;Lapp/revanced/patcher/data/BytecodeContext;)V - public final fun component1 ()Lcom/android/tools/smali/dexlib2/iface/Method; - public final fun component2 ()Lcom/android/tools/smali/dexlib2/iface/ClassDef; - public final fun component3 ()Lapp/revanced/patcher/fingerprint/MethodFingerprintResult$MethodFingerprintScanResult; - public final fun copy (Lcom/android/tools/smali/dexlib2/iface/Method;Lcom/android/tools/smali/dexlib2/iface/ClassDef;Lapp/revanced/patcher/fingerprint/MethodFingerprintResult$MethodFingerprintScanResult;Lapp/revanced/patcher/data/BytecodeContext;)Lapp/revanced/patcher/fingerprint/MethodFingerprintResult; - public static synthetic fun copy$default (Lapp/revanced/patcher/fingerprint/MethodFingerprintResult;Lcom/android/tools/smali/dexlib2/iface/Method;Lcom/android/tools/smali/dexlib2/iface/ClassDef;Lapp/revanced/patcher/fingerprint/MethodFingerprintResult$MethodFingerprintScanResult;Lapp/revanced/patcher/data/BytecodeContext;ILjava/lang/Object;)Lapp/revanced/patcher/fingerprint/MethodFingerprintResult; - public fun equals (Ljava/lang/Object;)Z public final fun getClassDef ()Lcom/android/tools/smali/dexlib2/iface/ClassDef; public final fun getMethod ()Lcom/android/tools/smali/dexlib2/iface/Method; public final fun getMutableClass ()Lapp/revanced/patcher/util/proxy/mutableTypes/MutableClass; public final fun getMutableMethod ()Lapp/revanced/patcher/util/proxy/mutableTypes/MutableMethod; public final fun getScanResult ()Lapp/revanced/patcher/fingerprint/MethodFingerprintResult$MethodFingerprintScanResult; - public fun hashCode ()I - public fun toString ()Ljava/lang/String; } public final class app/revanced/patcher/fingerprint/MethodFingerprintResult$MethodFingerprintScanResult { public fun (Lapp/revanced/patcher/fingerprint/MethodFingerprintResult$MethodFingerprintScanResult$PatternScanResult;Lapp/revanced/patcher/fingerprint/MethodFingerprintResult$MethodFingerprintScanResult$StringsScanResult;)V - public final fun component1 ()Lapp/revanced/patcher/fingerprint/MethodFingerprintResult$MethodFingerprintScanResult$PatternScanResult; - public final fun component2 ()Lapp/revanced/patcher/fingerprint/MethodFingerprintResult$MethodFingerprintScanResult$StringsScanResult; - public final fun copy (Lapp/revanced/patcher/fingerprint/MethodFingerprintResult$MethodFingerprintScanResult$PatternScanResult;Lapp/revanced/patcher/fingerprint/MethodFingerprintResult$MethodFingerprintScanResult$StringsScanResult;)Lapp/revanced/patcher/fingerprint/MethodFingerprintResult$MethodFingerprintScanResult; - public static synthetic fun copy$default (Lapp/revanced/patcher/fingerprint/MethodFingerprintResult$MethodFingerprintScanResult;Lapp/revanced/patcher/fingerprint/MethodFingerprintResult$MethodFingerprintScanResult$PatternScanResult;Lapp/revanced/patcher/fingerprint/MethodFingerprintResult$MethodFingerprintScanResult$StringsScanResult;ILjava/lang/Object;)Lapp/revanced/patcher/fingerprint/MethodFingerprintResult$MethodFingerprintScanResult; - public fun equals (Ljava/lang/Object;)Z public final fun getPatternScanResult ()Lapp/revanced/patcher/fingerprint/MethodFingerprintResult$MethodFingerprintScanResult$PatternScanResult; public final fun getStringsScanResult ()Lapp/revanced/patcher/fingerprint/MethodFingerprintResult$MethodFingerprintScanResult$StringsScanResult; - public fun hashCode ()I - public fun toString ()Ljava/lang/String; } public final class app/revanced/patcher/fingerprint/MethodFingerprintResult$MethodFingerprintScanResult$PatternScanResult { public fun (IILjava/util/List;)V public synthetic fun (IILjava/util/List;ILkotlin/jvm/internal/DefaultConstructorMarker;)V - public final fun component1 ()I - public final fun component2 ()I - public final fun component3 ()Ljava/util/List; - public final fun copy (IILjava/util/List;)Lapp/revanced/patcher/fingerprint/MethodFingerprintResult$MethodFingerprintScanResult$PatternScanResult; - public static synthetic fun copy$default (Lapp/revanced/patcher/fingerprint/MethodFingerprintResult$MethodFingerprintScanResult$PatternScanResult;IILjava/util/List;ILjava/lang/Object;)Lapp/revanced/patcher/fingerprint/MethodFingerprintResult$MethodFingerprintScanResult$PatternScanResult; - public fun equals (Ljava/lang/Object;)Z public final fun getEndIndex ()I public final fun getStartIndex ()I public final fun getWarnings ()Ljava/util/List; - public fun hashCode ()I public final fun setWarnings (Ljava/util/List;)V - public fun toString ()Ljava/lang/String; } public final class app/revanced/patcher/fingerprint/MethodFingerprintResult$MethodFingerprintScanResult$PatternScanResult$Warning { @@ -245,26 +222,13 @@ public final class app/revanced/patcher/fingerprint/MethodFingerprintResult$Meth public final class app/revanced/patcher/fingerprint/MethodFingerprintResult$MethodFingerprintScanResult$StringsScanResult { public fun (Ljava/util/List;)V - public final fun component1 ()Ljava/util/List; - public final fun copy (Ljava/util/List;)Lapp/revanced/patcher/fingerprint/MethodFingerprintResult$MethodFingerprintScanResult$StringsScanResult; - public static synthetic fun copy$default (Lapp/revanced/patcher/fingerprint/MethodFingerprintResult$MethodFingerprintScanResult$StringsScanResult;Ljava/util/List;ILjava/lang/Object;)Lapp/revanced/patcher/fingerprint/MethodFingerprintResult$MethodFingerprintScanResult$StringsScanResult; - public fun equals (Ljava/lang/Object;)Z public final fun getMatches ()Ljava/util/List; - public fun hashCode ()I - public fun toString ()Ljava/lang/String; } public final class app/revanced/patcher/fingerprint/MethodFingerprintResult$MethodFingerprintScanResult$StringsScanResult$StringMatch { public fun (Ljava/lang/String;I)V - public final fun component1 ()Ljava/lang/String; - public final fun component2 ()I - public final fun copy (Ljava/lang/String;I)Lapp/revanced/patcher/fingerprint/MethodFingerprintResult$MethodFingerprintScanResult$StringsScanResult$StringMatch; - public static synthetic fun copy$default (Lapp/revanced/patcher/fingerprint/MethodFingerprintResult$MethodFingerprintScanResult$StringsScanResult$StringMatch;Ljava/lang/String;IILjava/lang/Object;)Lapp/revanced/patcher/fingerprint/MethodFingerprintResult$MethodFingerprintScanResult$StringsScanResult$StringMatch; - public fun equals (Ljava/lang/Object;)Z public final fun getIndex ()I public final fun getString ()Ljava/lang/String; - public fun hashCode ()I - public fun toString ()Ljava/lang/String; } public abstract interface annotation class app/revanced/patcher/fingerprint/annotation/FuzzyPatternScanMethod : java/lang/annotation/Annotation { diff --git a/src/main/kotlin/app/revanced/patcher/fingerprint/MethodFingerprint.kt b/src/main/kotlin/app/revanced/patcher/fingerprint/MethodFingerprint.kt index 951b933..4c2c4d7 100644 --- a/src/main/kotlin/app/revanced/patcher/fingerprint/MethodFingerprint.kt +++ b/src/main/kotlin/app/revanced/patcher/fingerprint/MethodFingerprint.kt @@ -434,7 +434,7 @@ abstract class MethodFingerprint( * @param scanResult The result of scanning for the [MethodFingerprint]. * @param context The [BytecodeContext] this [MethodFingerprintResult] is attached to, to create proxies. */ -data class MethodFingerprintResult( +class MethodFingerprintResult( val method: Method, val classDef: ClassDef, val scanResult: MethodFingerprintScanResult, @@ -466,7 +466,7 @@ data class MethodFingerprintResult( * @param patternScanResult The result of the pattern scan. * @param stringsScanResult The result of the string scan. */ - data class MethodFingerprintScanResult( + class MethodFingerprintScanResult( val patternScanResult: PatternScanResult?, val stringsScanResult: StringsScanResult? ) { @@ -474,13 +474,13 @@ data class MethodFingerprintResult( * The result of scanning strings on the [MethodFingerprint]. * @param matches The list of strings that were matched. */ - data class StringsScanResult(val matches: List) { + class StringsScanResult(val matches: List) { /** * Represents a match for a string at an index. * @param string The string that was matched. * @param index The index of the string. */ - data class StringMatch(val string: String, val index: Int) + class StringMatch(val string: String, val index: Int) } /** @@ -489,7 +489,7 @@ data class MethodFingerprintResult( * @param endIndex The end index of the instructions where to which this pattern matches. * @param warnings A list of warnings considering this [PatternScanResult]. */ - data class PatternScanResult( + class PatternScanResult( val startIndex: Int, val endIndex: Int, var warnings: List? = null @@ -501,7 +501,7 @@ data class MethodFingerprintResult( * @param instructionIndex The index of the opcode relative to the instruction list. * @param patternIndex The index of the opcode relative to the pattern list from the signature. */ - data class Warning( + class Warning( val correctOpcode: Opcode, val wrongOpcode: Opcode, val instructionIndex: Int, From e2ca50729da7085799c0ff6fc4f7afaf82579738 Mon Sep 17 00:00:00 2001 From: oSumAtrIX Date: Mon, 23 Oct 2023 00:17:06 +0200 Subject: [PATCH 30/36] refactor: Convert extension functions to member functions BREAKING CHANGE: Some extension functions are now member functions. --- api/revanced-patcher.api | 4 +- .../patcher/fingerprint/MethodFingerprint.kt | 448 +++++++++--------- 2 files changed, 226 insertions(+), 226 deletions(-) diff --git a/api/revanced-patcher.api b/api/revanced-patcher.api index d9c616b..d65c020 100644 --- a/api/revanced-patcher.api +++ b/api/revanced-patcher.api @@ -179,12 +179,12 @@ public abstract class app/revanced/patcher/fingerprint/MethodFingerprint : app/r public fun (Ljava/lang/String;Ljava/lang/Integer;Ljava/lang/Iterable;Ljava/lang/Iterable;Ljava/lang/Iterable;Lkotlin/jvm/functions/Function2;)V public synthetic fun (Ljava/lang/String;Ljava/lang/Integer;Ljava/lang/Iterable;Ljava/lang/Iterable;Ljava/lang/Iterable;Lkotlin/jvm/functions/Function2;ILkotlin/jvm/internal/DefaultConstructorMarker;)V public final fun getResult ()Lapp/revanced/patcher/fingerprint/MethodFingerprintResult; + public final fun resolve (Lapp/revanced/patcher/data/BytecodeContext;Lcom/android/tools/smali/dexlib2/iface/ClassDef;)Z + public final fun resolve (Lapp/revanced/patcher/data/BytecodeContext;Lcom/android/tools/smali/dexlib2/iface/Method;Lcom/android/tools/smali/dexlib2/iface/ClassDef;)Z public final fun setResult (Lapp/revanced/patcher/fingerprint/MethodFingerprintResult;)V } public final class app/revanced/patcher/fingerprint/MethodFingerprint$Companion { - public final fun resolve (Lapp/revanced/patcher/fingerprint/MethodFingerprint;Lapp/revanced/patcher/data/BytecodeContext;Lcom/android/tools/smali/dexlib2/iface/ClassDef;)Z - public final fun resolve (Lapp/revanced/patcher/fingerprint/MethodFingerprint;Lapp/revanced/patcher/data/BytecodeContext;Lcom/android/tools/smali/dexlib2/iface/Method;Lcom/android/tools/smali/dexlib2/iface/ClassDef;)Z public final fun resolve (Ljava/lang/Iterable;Lapp/revanced/patcher/data/BytecodeContext;Ljava/lang/Iterable;)V } diff --git a/src/main/kotlin/app/revanced/patcher/fingerprint/MethodFingerprint.kt b/src/main/kotlin/app/revanced/patcher/fingerprint/MethodFingerprint.kt index 4c2c4d7..e707e6f 100644 --- a/src/main/kotlin/app/revanced/patcher/fingerprint/MethodFingerprint.kt +++ b/src/main/kotlin/app/revanced/patcher/fingerprint/MethodFingerprint.kt @@ -42,6 +42,230 @@ abstract class MethodFingerprint( */ var result: MethodFingerprintResult? = null + /** + * Resolve a [MethodFingerprint] using the lookup map built by [initializeFingerprintResolutionLookupMaps]. + * + * [MethodFingerprint] resolution is fast, but if many are present they can consume a noticeable + * amount of time because they are resolved in sequence. + * + * For apps with many fingerprints, resolving performance can be improved by: + * - Slowest: Specify [opcodes] and nothing else. + * - Fast: Specify [accessFlags], [returnType]. + * - Faster: Specify [accessFlags], [returnType] and [parameters]. + * - Fastest: Specify [strings], with at least one string being an exact (non-partial) match. + */ + internal fun resolveUsingLookupMap(context: BytecodeContext): Boolean { + /** + * Lookup [MethodClassPair]s that match the methods strings present in a [MethodFingerprint]. + * + * @return A list of [MethodClassPair]s that match the methods strings present in a [MethodFingerprint]. + */ + fun MethodFingerprint.methodStringsLookup(): List? { + strings?.forEach { + val methods = methodStringsLookupMap[it] + if (methods != null) return methods + } + return null + } + + /** + * Lookup [MethodClassPair]s that match the method signature present in a [MethodFingerprint]. + * + * @return A list of [MethodClassPair]s that match the method signature present in a [MethodFingerprint]. + */ + fun MethodFingerprint.methodSignatureLookup(): List { + if (accessFlags == null) return methods + + var returnTypeValue = returnType + if (returnTypeValue == null) { + if (AccessFlags.CONSTRUCTOR.isSet(accessFlags)) { + // Constructors always have void return type + returnTypeValue = "V" + } else { + return methods + } + } + + val key = buildString { + append(accessFlags) + append(returnTypeValue.first()) + if (parameters != null) appendParameters(parameters) + } + return methodSignatureLookupMap[key] ?: return emptyList() + } + + /** + * Resolve a [MethodFingerprint] using a list of [MethodClassPair]. + * + * @return True if the resolution was successful, false otherwise. + */ + fun MethodFingerprint.resolveUsingMethodClassPair(classMethods: Iterable): Boolean { + classMethods.forEach { classAndMethod -> + if (resolve(context, classAndMethod.first, classAndMethod.second)) return true + } + return false + } + + val methodsWithSameStrings = methodStringsLookup() + if (methodsWithSameStrings != null) if (resolveUsingMethodClassPair(methodsWithSameStrings)) return true + + // No strings declared or none matched (partial matches are allowed). + // Use signature matching. + return resolveUsingMethodClassPair(methodSignatureLookup()) + } + + /** + * Resolve a [MethodFingerprint] against a [ClassDef]. + * + * @param forClass The class on which to resolve the [MethodFingerprint] in. + * @param context The [BytecodeContext] to host proxies. + * @return True if the resolution was successful, false otherwise. + */ + fun resolve(context: BytecodeContext, forClass: ClassDef): Boolean { + for (method in forClass.methods) + if (this.resolve(context, method, forClass)) + return true + return false + } + + /** + * Resolve a [MethodFingerprint] against a [Method]. + * + * @param method The class on which to resolve the [MethodFingerprint] in. + * @param forClass The class on which to resolve the [MethodFingerprint]. + * @param context The [BytecodeContext] to host proxies. + * @return True if the resolution was successful or if the fingerprint is already resolved, false otherwise. + */ + fun resolve(context: BytecodeContext, method: Method, forClass: ClassDef): Boolean { + val methodFingerprint = this + + if (methodFingerprint.result != null) return true + + if (methodFingerprint.returnType != null && !method.returnType.startsWith(methodFingerprint.returnType)) + return false + + if (methodFingerprint.accessFlags != null && methodFingerprint.accessFlags != method.accessFlags) + return false + + + fun parametersEqual( + parameters1: Iterable, parameters2: Iterable + ): Boolean { + if (parameters1.count() != parameters2.count()) return false + val iterator1 = parameters1.iterator() + parameters2.forEach { + if (!it.startsWith(iterator1.next())) return false + } + return true + } + + if (methodFingerprint.parameters != null && !parametersEqual( + methodFingerprint.parameters, // TODO: parseParameters() + method.parameterTypes + ) + ) return false + + @Suppress("UNNECESSARY_NOT_NULL_ASSERTION") + if (methodFingerprint.customFingerprint != null && !methodFingerprint.customFingerprint!!(method, forClass)) + return false + + val stringsScanResult: StringsScanResult? = + if (methodFingerprint.strings != null) { + StringsScanResult( + buildList { + val implementation = method.implementation ?: return false + + val stringsList = methodFingerprint.strings.toMutableList() + + implementation.instructions.forEachIndexed { instructionIndex, instruction -> + if ( + instruction.opcode != Opcode.CONST_STRING && + instruction.opcode != Opcode.CONST_STRING_JUMBO + ) return@forEachIndexed + + val string = ((instruction as ReferenceInstruction).reference as StringReference).string + val index = stringsList.indexOfFirst(string::contains) + if (index == -1) return@forEachIndexed + + add( + StringMatch( + string, + instructionIndex + ) + ) + stringsList.removeAt(index) + } + + if (stringsList.isNotEmpty()) return false + } + ) + } else null + + val patternScanResult = if (methodFingerprint.opcodes != null) { + method.implementation?.instructions ?: return false + + fun Method.patternScan( + fingerprint: MethodFingerprint + ): MethodFingerprintResult.MethodFingerprintScanResult.PatternScanResult? { + val instructions = this.implementation!!.instructions + val fingerprintFuzzyPatternScanThreshold = fingerprint.fuzzyPatternScanMethod?.threshold ?: 0 + + val pattern = fingerprint.opcodes!! + val instructionLength = instructions.count() + val patternLength = pattern.count() + + for (index in 0 until instructionLength) { + var patternIndex = 0 + var threshold = fingerprintFuzzyPatternScanThreshold + + while (index + patternIndex < instructionLength) { + val originalOpcode = instructions.elementAt(index + patternIndex).opcode + val patternOpcode = pattern.elementAt(patternIndex) + + if (patternOpcode != null && patternOpcode.ordinal != originalOpcode.ordinal) { + // reaching maximum threshold (0) means, + // the pattern does not match to the current instructions + if (threshold-- == 0) break + } + + if (patternIndex < patternLength - 1) { + // if the entire pattern has not been scanned yet + // continue the scan + patternIndex++ + continue + } + // the pattern is valid, generate warnings if fuzzyPatternScanMethod is FuzzyPatternScanMethod + val result = + MethodFingerprintResult.MethodFingerprintScanResult.PatternScanResult( + index, + index + patternIndex + ) + if (fingerprint.fuzzyPatternScanMethod !is FuzzyPatternScanMethod) return result + result.warnings = result.createWarnings(pattern, instructions) + + return result + } + } + + return null + } + + method.patternScan(methodFingerprint) ?: return false + } else null + + methodFingerprint.result = MethodFingerprintResult( + method, + forClass, + MethodFingerprintResult.MethodFingerprintScanResult( + patternScanResult, + stringsScanResult + ), + context + ) + + return true + } + companion object { /** * A list of methods and the class they were found in. @@ -166,78 +390,6 @@ abstract class MethodFingerprint( } } - /** - * Resolve a [MethodFingerprint] using the lookup map built by [initializeFingerprintResolutionLookupMaps]. - * - * [MethodFingerprint] resolution is fast, but if many are present they can consume a noticeable - * amount of time because they are resolved in sequence. - * - * For apps with many fingerprints, resolving performance can be improved by: - * - Slowest: Specify [opcodes] and nothing else. - * - Fast: Specify [accessFlags], [returnType]. - * - Faster: Specify [accessFlags], [returnType] and [parameters]. - * - Fastest: Specify [strings], with at least one string being an exact (non-partial) match. - */ - internal fun MethodFingerprint.resolveUsingLookupMap(context: BytecodeContext): Boolean { - /** - * Lookup [MethodClassPair]s that match the methods strings present in a [MethodFingerprint]. - * - * @return A list of [MethodClassPair]s that match the methods strings present in a [MethodFingerprint]. - */ - fun MethodFingerprint.methodStringsLookup(): List? { - strings?.forEach { - val methods = methodStringsLookupMap[it] - if (methods != null) return methods - } - return null - } - - /** - * Lookup [MethodClassPair]s that match the method signature present in a [MethodFingerprint]. - * - * @return A list of [MethodClassPair]s that match the method signature present in a [MethodFingerprint]. - */ - fun MethodFingerprint.methodSignatureLookup(): List { - if (accessFlags == null) return methods - - var returnTypeValue = returnType - if (returnTypeValue == null) { - if (AccessFlags.CONSTRUCTOR.isSet(accessFlags)) { - // Constructors always have void return type - returnTypeValue = "V" - } else { - return methods - } - } - - val key = buildString { - append(accessFlags) - append(returnTypeValue.first()) - if (parameters != null) appendParameters(parameters) - } - return methodSignatureLookupMap[key] ?: return emptyList() - } - - /** - * Resolve a [MethodFingerprint] using a list of [MethodClassPair]. - * - * @return True if the resolution was successful, false otherwise. - */ - fun MethodFingerprint.resolveUsingMethodClassPair(classMethods: Iterable): Boolean { - classMethods.forEach { classAndMethod -> - if (resolve(context, classAndMethod.first, classAndMethod.second)) return true - } - return false - } - - val methodsWithSameStrings = methodStringsLookup() - if (methodsWithSameStrings != null) if (resolveUsingMethodClassPair(methodsWithSameStrings)) return true - - // No strings declared or none matched (partial matches are allowed). - // Use signature matching. - return resolveUsingMethodClassPair(methodSignatureLookup()) - } - /** * Resolve a list of [MethodFingerprint] against a list of [ClassDef]. * @@ -252,158 +404,6 @@ abstract class MethodFingerprint( break@classes // ...if the resolution succeeded, continue with the next MethodFingerprint. } - /** - * Resolve a [MethodFingerprint] against a [ClassDef]. - * - * @param forClass The class on which to resolve the [MethodFingerprint] in. - * @param context The [BytecodeContext] to host proxies. - * @return True if the resolution was successful, false otherwise. - */ - fun MethodFingerprint.resolve(context: BytecodeContext, forClass: ClassDef): Boolean { - for (method in forClass.methods) - if (this.resolve(context, method, forClass)) - return true - return false - } - - /** - * Resolve a [MethodFingerprint] against a [Method]. - * - * @param method The class on which to resolve the [MethodFingerprint] in. - * @param forClass The class on which to resolve the [MethodFingerprint]. - * @param context The [BytecodeContext] to host proxies. - * @return True if the resolution was successful or if the fingerprint is already resolved, false otherwise. - */ - fun MethodFingerprint.resolve(context: BytecodeContext, method: Method, forClass: ClassDef): Boolean { - val methodFingerprint = this - - if (methodFingerprint.result != null) return true - - if (methodFingerprint.returnType != null && !method.returnType.startsWith(methodFingerprint.returnType)) - return false - - if (methodFingerprint.accessFlags != null && methodFingerprint.accessFlags != method.accessFlags) - return false - - - fun parametersEqual( - parameters1: Iterable, parameters2: Iterable - ): Boolean { - if (parameters1.count() != parameters2.count()) return false - val iterator1 = parameters1.iterator() - parameters2.forEach { - if (!it.startsWith(iterator1.next())) return false - } - return true - } - - if (methodFingerprint.parameters != null && !parametersEqual( - methodFingerprint.parameters, // TODO: parseParameters() - method.parameterTypes - ) - ) return false - - @Suppress("UNNECESSARY_NOT_NULL_ASSERTION") - if (methodFingerprint.customFingerprint != null && !methodFingerprint.customFingerprint!!(method, forClass)) - return false - - val stringsScanResult: StringsScanResult? = - if (methodFingerprint.strings != null) { - StringsScanResult( - buildList { - val implementation = method.implementation ?: return false - - val stringsList = methodFingerprint.strings.toMutableList() - - implementation.instructions.forEachIndexed { instructionIndex, instruction -> - if ( - instruction.opcode != Opcode.CONST_STRING && - instruction.opcode != Opcode.CONST_STRING_JUMBO - ) return@forEachIndexed - - val string = ((instruction as ReferenceInstruction).reference as StringReference).string - val index = stringsList.indexOfFirst(string::contains) - if (index == -1) return@forEachIndexed - - add( - StringMatch( - string, - instructionIndex - ) - ) - stringsList.removeAt(index) - } - - if (stringsList.isNotEmpty()) return false - } - ) - } else null - - val patternScanResult = if (methodFingerprint.opcodes != null) { - method.implementation?.instructions ?: return false - - fun Method.patternScan( - fingerprint: MethodFingerprint - ): MethodFingerprintResult.MethodFingerprintScanResult.PatternScanResult? { - val instructions = this.implementation!!.instructions - val fingerprintFuzzyPatternScanThreshold = fingerprint.fuzzyPatternScanMethod?.threshold ?: 0 - - val pattern = fingerprint.opcodes!! - val instructionLength = instructions.count() - val patternLength = pattern.count() - - for (index in 0 until instructionLength) { - var patternIndex = 0 - var threshold = fingerprintFuzzyPatternScanThreshold - - while (index + patternIndex < instructionLength) { - val originalOpcode = instructions.elementAt(index + patternIndex).opcode - val patternOpcode = pattern.elementAt(patternIndex) - - if (patternOpcode != null && patternOpcode.ordinal != originalOpcode.ordinal) { - // reaching maximum threshold (0) means, - // the pattern does not match to the current instructions - if (threshold-- == 0) break - } - - if (patternIndex < patternLength - 1) { - // if the entire pattern has not been scanned yet - // continue the scan - patternIndex++ - continue - } - // the pattern is valid, generate warnings if fuzzyPatternScanMethod is FuzzyPatternScanMethod - val result = - MethodFingerprintResult.MethodFingerprintScanResult.PatternScanResult( - index, - index + patternIndex - ) - if (fingerprint.fuzzyPatternScanMethod !is FuzzyPatternScanMethod) return result - result.warnings = result.createWarnings(pattern, instructions) - - return result - } - } - - return null - } - - method.patternScan(methodFingerprint) ?: return false - } else null - - methodFingerprint.result = MethodFingerprintResult( - method, - forClass, - MethodFingerprintResult.MethodFingerprintScanResult( - patternScanResult, - stringsScanResult - ), - context - ) - - return true - } - private fun MethodFingerprintResult.MethodFingerprintScanResult.PatternScanResult.createWarnings( pattern: Iterable, instructions: Iterable ) = buildList { From 15b38fc8418b9ce93aa17266f935c451b66e720a Mon Sep 17 00:00:00 2001 From: oSumAtrIX Date: Mon, 23 Oct 2023 00:22:19 +0200 Subject: [PATCH 31/36] refactor: Simplify method implementation --- .../patcher/fingerprint/MethodFingerprint.kt | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/main/kotlin/app/revanced/patcher/fingerprint/MethodFingerprint.kt b/src/main/kotlin/app/revanced/patcher/fingerprint/MethodFingerprint.kt index e707e6f..785f714 100644 --- a/src/main/kotlin/app/revanced/patcher/fingerprint/MethodFingerprint.kt +++ b/src/main/kotlin/app/revanced/patcher/fingerprint/MethodFingerprint.kt @@ -123,7 +123,7 @@ abstract class MethodFingerprint( */ fun resolve(context: BytecodeContext, forClass: ClassDef): Boolean { for (method in forClass.methods) - if (this.resolve(context, method, forClass)) + if (resolve(context, method, forClass)) return true return false } @@ -397,12 +397,12 @@ abstract class MethodFingerprint( * @param context The [BytecodeContext] to host proxies. * @return True if the resolution was successful, false otherwise. */ - fun Iterable.resolve(context: BytecodeContext, classes: Iterable) { - for (fingerprint in this) // For each fingerprint... - classes@ for (classDef in classes) // ...search through all classes for the MethodFingerprint - if (fingerprint.resolve(context, classDef)) - break@classes // ...if the resolution succeeded, continue with the next MethodFingerprint. - } + fun Iterable.resolve(context: BytecodeContext, classes: Iterable) = + forEach { fingerprint -> + for (classDef in classes) { + if (fingerprint.resolve(context, classDef)) break + } + } private fun MethodFingerprintResult.MethodFingerprintScanResult.PatternScanResult.createWarnings( pattern: Iterable, instructions: Iterable From 58e7f815a58ce030055be460680c40601f087104 Mon Sep 17 00:00:00 2001 From: oSumAtrIX Date: Mon, 23 Oct 2023 00:48:01 +0200 Subject: [PATCH 32/36] refactor: Move `MethodFingerprintResult` to own file --- .../patcher/fingerprint/MethodFingerprint.kt | 84 ----------------- .../fingerprint/MethodFingerprintResult.kt | 92 +++++++++++++++++++ 2 files changed, 92 insertions(+), 84 deletions(-) create mode 100644 src/main/kotlin/app/revanced/patcher/fingerprint/MethodFingerprintResult.kt diff --git a/src/main/kotlin/app/revanced/patcher/fingerprint/MethodFingerprint.kt b/src/main/kotlin/app/revanced/patcher/fingerprint/MethodFingerprint.kt index 785f714..d1ee5b3 100644 --- a/src/main/kotlin/app/revanced/patcher/fingerprint/MethodFingerprint.kt +++ b/src/main/kotlin/app/revanced/patcher/fingerprint/MethodFingerprint.kt @@ -426,87 +426,3 @@ abstract class MethodFingerprint( } } -/** - * Represents the result of a [MethodFingerprintResult]. - * - * @param method The matching method. - * @param classDef The [ClassDef] that contains the matching [method]. - * @param scanResult The result of scanning for the [MethodFingerprint]. - * @param context The [BytecodeContext] this [MethodFingerprintResult] is attached to, to create proxies. - */ -class MethodFingerprintResult( - val method: Method, - val classDef: ClassDef, - val scanResult: MethodFingerprintScanResult, - internal val context: BytecodeContext -) { - /** - * Returns a mutable clone of [classDef] - * - * Please note, this method allocates a [ClassProxy]. - * Use [classDef] where possible. - */ - @Suppress("MemberVisibilityCanBePrivate") - val mutableClass by lazy { context.proxy(classDef).mutableClass } - - /** - * Returns a mutable clone of [method] - * - * Please note, this method allocates a [ClassProxy]. - * Use [method] where possible. - */ - val mutableMethod by lazy { - mutableClass.methods.first { - MethodUtil.methodSignaturesMatch(it, this.method) - } - } - - /** - * The result of scanning on the [MethodFingerprint]. - * @param patternScanResult The result of the pattern scan. - * @param stringsScanResult The result of the string scan. - */ - class MethodFingerprintScanResult( - val patternScanResult: PatternScanResult?, - val stringsScanResult: StringsScanResult? - ) { - /** - * The result of scanning strings on the [MethodFingerprint]. - * @param matches The list of strings that were matched. - */ - class StringsScanResult(val matches: List) { - /** - * Represents a match for a string at an index. - * @param string The string that was matched. - * @param index The index of the string. - */ - class StringMatch(val string: String, val index: Int) - } - - /** - * The result of a pattern scan. - * @param startIndex The start index of the instructions where to which this pattern matches. - * @param endIndex The end index of the instructions where to which this pattern matches. - * @param warnings A list of warnings considering this [PatternScanResult]. - */ - class PatternScanResult( - val startIndex: Int, - val endIndex: Int, - var warnings: List? = null - ) { - /** - * Represents warnings of the pattern scan. - * @param correctOpcode The opcode the instruction list has. - * @param wrongOpcode The opcode the pattern list of the signature currently has. - * @param instructionIndex The index of the opcode relative to the instruction list. - * @param patternIndex The index of the opcode relative to the pattern list from the signature. - */ - class Warning( - val correctOpcode: Opcode, - val wrongOpcode: Opcode, - val instructionIndex: Int, - val patternIndex: Int, - ) - } - } -} diff --git a/src/main/kotlin/app/revanced/patcher/fingerprint/MethodFingerprintResult.kt b/src/main/kotlin/app/revanced/patcher/fingerprint/MethodFingerprintResult.kt new file mode 100644 index 0000000..5db1a47 --- /dev/null +++ b/src/main/kotlin/app/revanced/patcher/fingerprint/MethodFingerprintResult.kt @@ -0,0 +1,92 @@ +package app.revanced.patcher.fingerprint + +import app.revanced.patcher.data.BytecodeContext +import com.android.tools.smali.dexlib2.Opcode +import com.android.tools.smali.dexlib2.iface.ClassDef +import com.android.tools.smali.dexlib2.iface.Method +import com.android.tools.smali.dexlib2.util.MethodUtil + +/** + * Represents the result of a [MethodFingerprintResult]. + * + * @param method The matching method. + * @param classDef The [ClassDef] that contains the matching [method]. + * @param scanResult The result of scanning for the [MethodFingerprint]. + * @param context The [BytecodeContext] this [MethodFingerprintResult] is attached to, to create proxies. + */ +class MethodFingerprintResult( + val method: Method, + val classDef: ClassDef, + val scanResult: MethodFingerprintScanResult, + internal val context: BytecodeContext +) { + /** + * Returns a mutable clone of [classDef] + * + * Please note, this method allocates a [ClassProxy]. + * Use [classDef] where possible. + */ + @Suppress("MemberVisibilityCanBePrivate") + val mutableClass by lazy { context.proxy(classDef).mutableClass } + + /** + * Returns a mutable clone of [method] + * + * Please note, this method allocates a [ClassProxy]. + * Use [method] where possible. + */ + val mutableMethod by lazy { + mutableClass.methods.first { + MethodUtil.methodSignaturesMatch(it, this.method) + } + } + + /** + * The result of scanning on the [MethodFingerprint]. + * @param patternScanResult The result of the pattern scan. + * @param stringsScanResult The result of the string scan. + */ + class MethodFingerprintScanResult( + val patternScanResult: PatternScanResult?, + val stringsScanResult: StringsScanResult? + ) { + /** + * The result of scanning strings on the [MethodFingerprint]. + * @param matches The list of strings that were matched. + */ + class StringsScanResult(val matches: List) { + /** + * Represents a match for a string at an index. + * @param string The string that was matched. + * @param index The index of the string. + */ + class StringMatch(val string: String, val index: Int) + } + + /** + * The result of a pattern scan. + * @param startIndex The start index of the instructions where to which this pattern matches. + * @param endIndex The end index of the instructions where to which this pattern matches. + * @param warnings A list of warnings considering this [PatternScanResult]. + */ + class PatternScanResult( + val startIndex: Int, + val endIndex: Int, + var warnings: List? = null + ) { + /** + * Represents warnings of the pattern scan. + * @param correctOpcode The opcode the instruction list has. + * @param wrongOpcode The opcode the pattern list of the signature currently has. + * @param instructionIndex The index of the opcode relative to the instruction list. + * @param patternIndex The index of the opcode relative to the pattern list from the signature. + */ + class Warning( + val correctOpcode: Opcode, + val wrongOpcode: Opcode, + val instructionIndex: Int, + val patternIndex: Int, + ) + } + } +} \ No newline at end of file From 2ca543ffb9c37afd5fdcdcc4739c4a6a4cd339cf Mon Sep 17 00:00:00 2001 From: oSumAtrIX Date: Mon, 23 Oct 2023 01:24:51 +0200 Subject: [PATCH 33/36] refactor: Move lookup related classes and members to own file --- .../kotlin/app/revanced/patcher/Patcher.kt | 7 +- .../revanced/patcher/fingerprint/LookupMap.kt | 125 ++++++++++++ .../patcher/fingerprint/MethodFingerprint.kt | 179 ++++-------------- .../fingerprint/MethodFingerprintResult.kt | 2 + 4 files changed, 166 insertions(+), 147 deletions(-) create mode 100644 src/main/kotlin/app/revanced/patcher/fingerprint/LookupMap.kt diff --git a/src/main/kotlin/app/revanced/patcher/Patcher.kt b/src/main/kotlin/app/revanced/patcher/Patcher.kt index 86018e9..11d700b 100644 --- a/src/main/kotlin/app/revanced/patcher/Patcher.kt +++ b/src/main/kotlin/app/revanced/patcher/Patcher.kt @@ -2,7 +2,8 @@ package app.revanced.patcher import app.revanced.patcher.PatchBundleLoader.Utils.getInstance import app.revanced.patcher.data.ResourceContext -import app.revanced.patcher.fingerprint.MethodFingerprint +import app.revanced.patcher.fingerprint.LookupMap.Maps.clearLookupMaps +import app.revanced.patcher.fingerprint.LookupMap.Maps.initializeLookupMaps import app.revanced.patcher.fingerprint.MethodFingerprint.Companion.resolveUsingLookupMap import app.revanced.patcher.patch.* import kotlinx.coroutines.flow.flow @@ -187,7 +188,7 @@ class Patcher( if (context.bytecodeContext.integrations.merge) context.bytecodeContext.integrations.flush() - MethodFingerprint.initializeFingerprintResolutionLookupMaps(context.bytecodeContext) + initializeLookupMaps(context.bytecodeContext) // Prevent from decoding the app manifest twice if it is not needed. if (options.resourceDecodingMode == ResourceContext.ResourceDecodingMode.FULL) @@ -249,7 +250,7 @@ class Patcher( } } - override fun close() = MethodFingerprint.clearFingerprintResolutionLookupMaps() + override fun close() = clearLookupMaps() /** * Compile and save the patched APK file. diff --git a/src/main/kotlin/app/revanced/patcher/fingerprint/LookupMap.kt b/src/main/kotlin/app/revanced/patcher/fingerprint/LookupMap.kt new file mode 100644 index 0000000..a0adadf --- /dev/null +++ b/src/main/kotlin/app/revanced/patcher/fingerprint/LookupMap.kt @@ -0,0 +1,125 @@ +package app.revanced.patcher.fingerprint + +import app.revanced.patcher.data.BytecodeContext +import com.android.tools.smali.dexlib2.Opcode +import com.android.tools.smali.dexlib2.iface.ClassDef +import com.android.tools.smali.dexlib2.iface.Method +import com.android.tools.smali.dexlib2.iface.instruction.ReferenceInstruction +import com.android.tools.smali.dexlib2.iface.reference.StringReference +import java.util.* + +internal typealias MethodClassPair = Pair + +/** + * Lookup map for methods. + */ +internal class LookupMap : MutableMap by mutableMapOf() { + /** + * Adds a [MethodClassPair] to the list associated with the given key. + * If the key does not exist, a new list is created and the [MethodClassPair] is added to it. + */ + fun add( + key: String, + methodClassPair: MethodClassPair + ) { + getOrPut(key) { MethodClassList() }.add(methodClassPair) + } + + /** + * List of methods and the class they are a member of. + */ + internal class MethodClassList : LinkedList() + + companion object Maps { + /** + * A list of methods and the class they are a member of. + */ + internal val methods = MethodClassList() + + /** + * Lookup map for methods keyed to the methods access flags, return type and parameter. + */ + internal val methodSignatureLookupMap = LookupMap() + + /** + * Lookup map for methods associated by strings referenced in the method. + */ + internal val methodStringsLookupMap = LookupMap() + + /** + * Initializes lookup maps for [MethodFingerprint] resolution + * using attributes of methods such as the method signature or strings. + * + * @param context The [BytecodeContext] containing the classes to initialize the lookup maps with. + */ + internal fun initializeLookupMaps(context: BytecodeContext) { + if (methods.isNotEmpty()) clearLookupMaps() + + context.classes.forEach { classDef -> + classDef.methods.forEach { method -> + val methodClassPair = method to classDef + + // For fingerprints with no access or return type specified. + methods += methodClassPair + + val accessFlagsReturnKey = method.accessFlags.toString() + method.returnType.first() + + // Add as the key. + methodSignatureLookupMap.add(accessFlagsReturnKey, methodClassPair) + + // Add [parameters] as the key. + methodSignatureLookupMap.add( + buildString { + append(accessFlagsReturnKey) + appendParameters(method.parameterTypes) + }, + methodClassPair + ) + + // Add strings contained in the method as the key. + method.implementation?.instructions?.forEach instructions@{ instruction -> + if (instruction.opcode != Opcode.CONST_STRING && instruction.opcode != Opcode.CONST_STRING_JUMBO) + return@instructions + + val string = ((instruction as ReferenceInstruction).reference as StringReference).string + + methodStringsLookupMap.add(string, methodClassPair) + } + + // In the future, the class type could be added to the lookup map. + // This would require MethodFingerprint to be changed to include the class type. + } + } + } + + /** + * Clears the internal lookup maps created in [initializeLookupMaps] + */ + internal fun clearLookupMaps() { + methods.clear() + methodSignatureLookupMap.clear() + methodStringsLookupMap.clear() + } + + /** + * Appends a string based on the parameter reference types of this method. + */ + internal fun StringBuilder.appendParameters(parameters: Iterable) { + // Maximum parameters to use in the signature key. + // Some apps have methods with an incredible number of parameters (over 100 parameters have been seen). + // To keep the signature map from becoming needlessly bloated, + // group together in the same map entry all methods with the same access/return and 5 or more parameters. + // The value of 5 was chosen based on local performance testing and is not set in stone. + val maxSignatureParameters = 5 + // Must append a unique value before the parameters to distinguish this key includes the parameters. + // If this is not appended, then methods with no parameters + // will collide with different keys that specify access/return but omit the parameters. + append("p:") + parameters.forEachIndexed { index, parameter -> + if (index >= maxSignatureParameters) return + append(parameter.first()) + } + } + + } +} \ No newline at end of file diff --git a/src/main/kotlin/app/revanced/patcher/fingerprint/MethodFingerprint.kt b/src/main/kotlin/app/revanced/patcher/fingerprint/MethodFingerprint.kt index d1ee5b3..4efe14a 100644 --- a/src/main/kotlin/app/revanced/patcher/fingerprint/MethodFingerprint.kt +++ b/src/main/kotlin/app/revanced/patcher/fingerprint/MethodFingerprint.kt @@ -2,9 +2,14 @@ package app.revanced.patcher.fingerprint import app.revanced.patcher.data.BytecodeContext import app.revanced.patcher.extensions.MethodFingerprintExtensions.fuzzyPatternScanMethod +import app.revanced.patcher.fingerprint.LookupMap.Maps.appendParameters +import app.revanced.patcher.fingerprint.LookupMap.Maps.initializeLookupMaps +import app.revanced.patcher.fingerprint.LookupMap.Maps.methodSignatureLookupMap +import app.revanced.patcher.fingerprint.LookupMap.Maps.methodStringsLookupMap +import app.revanced.patcher.fingerprint.LookupMap.Maps.methods +import app.revanced.patcher.fingerprint.MethodFingerprintResult.MethodFingerprintScanResult.StringsScanResult import app.revanced.patcher.fingerprint.annotation.FuzzyPatternScanMethod import app.revanced.patcher.patch.PatchException -import app.revanced.patcher.util.proxy.ClassProxy import com.android.tools.smali.dexlib2.AccessFlags import com.android.tools.smali.dexlib2.Opcode import com.android.tools.smali.dexlib2.iface.ClassDef @@ -12,12 +17,6 @@ import com.android.tools.smali.dexlib2.iface.Method import com.android.tools.smali.dexlib2.iface.instruction.Instruction import com.android.tools.smali.dexlib2.iface.instruction.ReferenceInstruction import com.android.tools.smali.dexlib2.iface.reference.StringReference -import com.android.tools.smali.dexlib2.util.MethodUtil -import java.util.* - -private typealias StringMatch = MethodFingerprintResult.MethodFingerprintScanResult.StringsScanResult.StringMatch -private typealias StringsScanResult = MethodFingerprintResult.MethodFingerprintScanResult.StringsScanResult -private typealias MethodClassPair = Pair /** * A fingerprint to resolve methods. @@ -43,7 +42,7 @@ abstract class MethodFingerprint( var result: MethodFingerprintResult? = null /** - * Resolve a [MethodFingerprint] using the lookup map built by [initializeFingerprintResolutionLookupMaps]. + * Resolve a [MethodFingerprint] using the lookup map built by [initializeLookupMaps]. * * [MethodFingerprint] resolution is fast, but if many are present they can consume a noticeable * amount of time because they are resolved in sequence. @@ -60,7 +59,7 @@ abstract class MethodFingerprint( * * @return A list of [MethodClassPair]s that match the methods strings present in a [MethodFingerprint]. */ - fun MethodFingerprint.methodStringsLookup(): List? { + fun MethodFingerprint.methodStringsLookup(): LookupMap.MethodClassList? { strings?.forEach { val methods = methodStringsLookupMap[it] if (methods != null) return methods @@ -73,7 +72,7 @@ abstract class MethodFingerprint( * * @return A list of [MethodClassPair]s that match the method signature present in a [MethodFingerprint]. */ - fun MethodFingerprint.methodSignatureLookup(): List { + fun MethodFingerprint.methodSignatureLookup(): LookupMap.MethodClassList { if (accessFlags == null) return methods var returnTypeValue = returnType @@ -91,7 +90,7 @@ abstract class MethodFingerprint( append(returnTypeValue.first()) if (parameters != null) appendParameters(parameters) } - return methodSignatureLookupMap[key] ?: return emptyList() + return methodSignatureLookupMap[key] ?: return LookupMap.MethodClassList() } /** @@ -99,8 +98,8 @@ abstract class MethodFingerprint( * * @return True if the resolution was successful, false otherwise. */ - fun MethodFingerprint.resolveUsingMethodClassPair(classMethods: Iterable): Boolean { - classMethods.forEach { classAndMethod -> + fun MethodFingerprint.resolveUsingMethodClassPair(methodClasses: LookupMap.MethodClassList): Boolean { + methodClasses.forEach { classAndMethod -> if (resolve(context, classAndMethod.first, classAndMethod.second)) return true } return false @@ -187,12 +186,7 @@ abstract class MethodFingerprint( val index = stringsList.indexOfFirst(string::contains) if (index == -1) return@forEachIndexed - add( - StringMatch( - string, - instructionIndex - ) - ) + add(StringsScanResult.StringMatch(string, instructionIndex)) stringsList.removeAt(index) } @@ -204,6 +198,26 @@ abstract class MethodFingerprint( val patternScanResult = if (methodFingerprint.opcodes != null) { method.implementation?.instructions ?: return false + fun MethodFingerprintResult.MethodFingerprintScanResult.PatternScanResult.newWarnings( + pattern: Iterable, instructions: Iterable + ) = buildList { + for ((patternIndex, instructionIndex) in (this@newWarnings.startIndex until this@newWarnings.endIndex).withIndex()) { + val originalOpcode = instructions.elementAt(instructionIndex).opcode + val patternOpcode = pattern.elementAt(patternIndex) + + if (patternOpcode == null || patternOpcode.ordinal == originalOpcode.ordinal) continue + + this.add( + MethodFingerprintResult.MethodFingerprintScanResult.PatternScanResult.Warning( + originalOpcode, + patternOpcode, + instructionIndex, + patternIndex + ) + ) + } + } + fun Method.patternScan( fingerprint: MethodFingerprint ): MethodFingerprintResult.MethodFingerprintScanResult.PatternScanResult? { @@ -241,7 +255,7 @@ abstract class MethodFingerprint( index + patternIndex ) if (fingerprint.fuzzyPatternScanMethod !is FuzzyPatternScanMethod) return result - result.warnings = result.createWarnings(pattern, instructions) + result.warnings = result.newWarnings(pattern, instructions) return result } @@ -268,110 +282,7 @@ abstract class MethodFingerprint( companion object { /** - * A list of methods and the class they were found in. - */ - private val methods = mutableListOf() - - /** - * Lookup map for methods keyed to the methods access flags, return type and parameter. - */ - private val methodSignatureLookupMap = mutableMapOf>() - - /** - * Lookup map for methods keyed to the strings contained in the method. - */ - private val methodStringsLookupMap = mutableMapOf>() - - /** - * Appends a string based on the parameter reference types of this method. - */ - private fun StringBuilder.appendParameters(parameters: Iterable) { - // Maximum parameters to use in the signature key. - // Some apps have methods with an incredible number of parameters (over 100 parameters have been seen). - // To keep the signature map from becoming needlessly bloated, - // group together in the same map entry all methods with the same access/return and 5 or more parameters. - // The value of 5 was chosen based on local performance testing and is not set in stone. - val maxSignatureParameters = 5 - // Must append a unique value before the parameters to distinguish this key includes the parameters. - // If this is not appended, then methods with no parameters - // will collide with different keys that specify access/return but omit the parameters. - append("p:") - parameters.forEachIndexed { index, parameter -> - if (index >= maxSignatureParameters) return - append(parameter.first()) - } - } - - /** - * Initializes lookup maps for [MethodFingerprint] resolution - * using attributes of methods such as the method signature or strings. - * - * @param context The [BytecodeContext] containing the classes to initialize the lookup maps with. - */ - internal fun initializeFingerprintResolutionLookupMaps(context: BytecodeContext) { - fun MutableMap>.add( - key: String, - methodClassPair: MethodClassPair - ) { - var methodClassPairs = this[key] - - methodClassPairs ?: run { - methodClassPairs = LinkedList().also { this[key] = it } - } - - methodClassPairs!!.add(methodClassPair) - } - - if (methods.isNotEmpty()) clearFingerprintResolutionLookupMaps() - - context.classes.forEach { classDef -> - classDef.methods.forEach { method -> - val methodClassPair = method to classDef - - // For fingerprints with no access or return type specified. - methods += methodClassPair - - val accessFlagsReturnKey = method.accessFlags.toString() + method.returnType.first() - - // Add as the key. - methodSignatureLookupMap.add(accessFlagsReturnKey, methodClassPair) - - // Add [parameters] as the key. - methodSignatureLookupMap.add( - buildString { - append(accessFlagsReturnKey) - appendParameters(method.parameterTypes) - }, - methodClassPair - ) - - // Add strings contained in the method as the key. - method.implementation?.instructions?.forEach instructions@{ instruction -> - if (instruction.opcode != Opcode.CONST_STRING && instruction.opcode != Opcode.CONST_STRING_JUMBO) - return@instructions - - val string = ((instruction as ReferenceInstruction).reference as StringReference).string - - methodStringsLookupMap.add(string, methodClassPair) - } - - // In the future, the class type could be added to the lookup map. - // This would require MethodFingerprint to be changed to include the class type. - } - } - } - - /** - * Clears the internal lookup maps created in [initializeFingerprintResolutionLookupMaps] - */ - internal fun clearFingerprintResolutionLookupMaps() { - methods.clear() - methodSignatureLookupMap.clear() - methodStringsLookupMap.clear() - } - - /** - * Resolve a list of [MethodFingerprint] using the lookup map built by [initializeFingerprintResolutionLookupMaps]. + * Resolve a list of [MethodFingerprint] using the lookup map built by [initializeLookupMaps]. * * [MethodFingerprint] resolution is fast, but if many are present they can consume a noticeable * amount of time because they are resolved in sequence. @@ -403,26 +314,6 @@ abstract class MethodFingerprint( if (fingerprint.resolve(context, classDef)) break } } - - private fun MethodFingerprintResult.MethodFingerprintScanResult.PatternScanResult.createWarnings( - pattern: Iterable, instructions: Iterable - ) = buildList { - for ((patternIndex, instructionIndex) in (this@createWarnings.startIndex until this@createWarnings.endIndex).withIndex()) { - val originalOpcode = instructions.elementAt(instructionIndex).opcode - val patternOpcode = pattern.elementAt(patternIndex) - - if (patternOpcode == null || patternOpcode.ordinal == originalOpcode.ordinal) continue - - this.add( - MethodFingerprintResult.MethodFingerprintScanResult.PatternScanResult.Warning( - originalOpcode, - patternOpcode, - instructionIndex, - patternIndex - ) - ) - } - } } } diff --git a/src/main/kotlin/app/revanced/patcher/fingerprint/MethodFingerprintResult.kt b/src/main/kotlin/app/revanced/patcher/fingerprint/MethodFingerprintResult.kt index 5db1a47..318e1a0 100644 --- a/src/main/kotlin/app/revanced/patcher/fingerprint/MethodFingerprintResult.kt +++ b/src/main/kotlin/app/revanced/patcher/fingerprint/MethodFingerprintResult.kt @@ -1,6 +1,7 @@ package app.revanced.patcher.fingerprint import app.revanced.patcher.data.BytecodeContext +import app.revanced.patcher.util.proxy.ClassProxy import com.android.tools.smali.dexlib2.Opcode import com.android.tools.smali.dexlib2.iface.ClassDef import com.android.tools.smali.dexlib2.iface.Method @@ -14,6 +15,7 @@ import com.android.tools.smali.dexlib2.util.MethodUtil * @param scanResult The result of scanning for the [MethodFingerprint]. * @param context The [BytecodeContext] this [MethodFingerprintResult] is attached to, to create proxies. */ +@Suppress("MemberVisibilityCanBePrivate") class MethodFingerprintResult( val method: Method, val classDef: ClassDef, From 54a2f8f16fddf2b2ed47eb23717ba3734c4a6c5d Mon Sep 17 00:00:00 2001 From: oSumAtrIX Date: Mon, 23 Oct 2023 01:31:39 +0200 Subject: [PATCH 34/36] refactor!: Remove `Fingerprint` interface It served no purpose so far. BREAKING CHANGE: The `Fingerprint` interface is no longer present. --- api/revanced-patcher.api | 5 +---- .../kotlin/app/revanced/patcher/fingerprint/Fingerprint.kt | 7 ------- .../app/revanced/patcher/fingerprint/MethodFingerprint.kt | 2 +- 3 files changed, 2 insertions(+), 12 deletions(-) delete mode 100644 src/main/kotlin/app/revanced/patcher/fingerprint/Fingerprint.kt diff --git a/api/revanced-patcher.api b/api/revanced-patcher.api index d65c020..82bddc5 100644 --- a/api/revanced-patcher.api +++ b/api/revanced-patcher.api @@ -170,10 +170,7 @@ public final class app/revanced/patcher/extensions/MethodFingerprintExtensions { public final fun getFuzzyPatternScanMethod (Lapp/revanced/patcher/fingerprint/MethodFingerprint;)Lapp/revanced/patcher/fingerprint/annotation/FuzzyPatternScanMethod; } -public abstract interface class app/revanced/patcher/fingerprint/Fingerprint { -} - -public abstract class app/revanced/patcher/fingerprint/MethodFingerprint : app/revanced/patcher/fingerprint/Fingerprint { +public abstract class app/revanced/patcher/fingerprint/MethodFingerprint { public static final field Companion Lapp/revanced/patcher/fingerprint/MethodFingerprint$Companion; public fun ()V public fun (Ljava/lang/String;Ljava/lang/Integer;Ljava/lang/Iterable;Ljava/lang/Iterable;Ljava/lang/Iterable;Lkotlin/jvm/functions/Function2;)V diff --git a/src/main/kotlin/app/revanced/patcher/fingerprint/Fingerprint.kt b/src/main/kotlin/app/revanced/patcher/fingerprint/Fingerprint.kt deleted file mode 100644 index 05e949b..0000000 --- a/src/main/kotlin/app/revanced/patcher/fingerprint/Fingerprint.kt +++ /dev/null @@ -1,7 +0,0 @@ -package app.revanced.patcher.fingerprint - -/** - * A ReVanced fingerprint. - * Can be a [MethodFingerprint]. - */ -interface Fingerprint \ No newline at end of file diff --git a/src/main/kotlin/app/revanced/patcher/fingerprint/MethodFingerprint.kt b/src/main/kotlin/app/revanced/patcher/fingerprint/MethodFingerprint.kt index 4efe14a..8fef8e4 100644 --- a/src/main/kotlin/app/revanced/patcher/fingerprint/MethodFingerprint.kt +++ b/src/main/kotlin/app/revanced/patcher/fingerprint/MethodFingerprint.kt @@ -35,7 +35,7 @@ abstract class MethodFingerprint( internal val opcodes: Iterable? = null, internal val strings: Iterable? = null, internal val customFingerprint: ((methodDef: Method, classDef: ClassDef) -> Boolean)? = null -) : Fingerprint { +) { /** * The result of the [MethodFingerprint]. */ From aed1eac3157317acf87f522750cf2f41509606c3 Mon Sep 17 00:00:00 2001 From: oSumAtrIX Date: Mon, 23 Oct 2023 01:32:28 +0200 Subject: [PATCH 35/36] fix: Only allow setting `MethodFingerprint#result` privately BREAKING CHANGE: The `MethodFingerprint#result` member can now only be set inside `MethodFingerprint`. --- api/revanced-patcher.api | 1 - .../kotlin/app/revanced/patcher/fingerprint/MethodFingerprint.kt | 1 + 2 files changed, 1 insertion(+), 1 deletion(-) diff --git a/api/revanced-patcher.api b/api/revanced-patcher.api index 82bddc5..2047f55 100644 --- a/api/revanced-patcher.api +++ b/api/revanced-patcher.api @@ -178,7 +178,6 @@ public abstract class app/revanced/patcher/fingerprint/MethodFingerprint { public final fun getResult ()Lapp/revanced/patcher/fingerprint/MethodFingerprintResult; public final fun resolve (Lapp/revanced/patcher/data/BytecodeContext;Lcom/android/tools/smali/dexlib2/iface/ClassDef;)Z public final fun resolve (Lapp/revanced/patcher/data/BytecodeContext;Lcom/android/tools/smali/dexlib2/iface/Method;Lcom/android/tools/smali/dexlib2/iface/ClassDef;)Z - public final fun setResult (Lapp/revanced/patcher/fingerprint/MethodFingerprintResult;)V } public final class app/revanced/patcher/fingerprint/MethodFingerprint$Companion { diff --git a/src/main/kotlin/app/revanced/patcher/fingerprint/MethodFingerprint.kt b/src/main/kotlin/app/revanced/patcher/fingerprint/MethodFingerprint.kt index 8fef8e4..a2e0e3f 100644 --- a/src/main/kotlin/app/revanced/patcher/fingerprint/MethodFingerprint.kt +++ b/src/main/kotlin/app/revanced/patcher/fingerprint/MethodFingerprint.kt @@ -40,6 +40,7 @@ abstract class MethodFingerprint( * The result of the [MethodFingerprint]. */ var result: MethodFingerprintResult? = null + private set /** * Resolve a [MethodFingerprint] using the lookup map built by [initializeLookupMaps]. From 167bd83f4e2c6e41e9553b445f5bca095e306cf6 Mon Sep 17 00:00:00 2001 From: semantic-release-bot Date: Sun, 22 Oct 2023 23:54:59 +0000 Subject: [PATCH 36/36] chore(release): 18.0.0-dev.6 [skip ci] # [18.0.0-dev.6](https://github.com/ReVanced/revanced-patcher/compare/v18.0.0-dev.5...v18.0.0-dev.6) (2023-10-22) ### Bug Fixes * Only allow setting `MethodFingerprint#result` privately ([aed1eac](https://github.com/ReVanced/revanced-patcher/commit/aed1eac3157317acf87f522750cf2f41509606c3)) ### Code Refactoring * Change data classes to actual classes ([6192089](https://github.com/ReVanced/revanced-patcher/commit/6192089b71bdca15765369f3e607ddd1f8266205)) * Convert extension functions to member functions ([e2ca507](https://github.com/ReVanced/revanced-patcher/commit/e2ca50729da7085799c0ff6fc4f7afaf82579738)) * Move files to simplify package structure ([124a2e9](https://github.com/ReVanced/revanced-patcher/commit/124a2e9d3efb88f0f038ae306d941e918ad3ad3c)) * Remove deprecated classes and members ([a4212f6](https://github.com/ReVanced/revanced-patcher/commit/a4212f6bf952971541c4550e20f6bf57a382e19a)) * refactor!: Remove `Fingerprint` interface ([54a2f8f](https://github.com/ReVanced/revanced-patcher/commit/54a2f8f16fddf2b2ed47eb23717ba3734c4a6c5d)) ### BREAKING CHANGES * The `MethodFingerprint#result` member can now only be set inside `MethodFingerprint`. * The `Fingerprint` interface is no longer present. * Some extension functions are now member functions. * This gets rid of data class members. * Some deprecated classes and members are not present anymore. * Classes and members have changed packages. --- CHANGELOG.md | 28 ++++++++++++++++++++++++++++ gradle.properties | 2 +- 2 files changed, 29 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index df5448c..1da3f2f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,31 @@ +# [18.0.0-dev.6](https://github.com/ReVanced/revanced-patcher/compare/v18.0.0-dev.5...v18.0.0-dev.6) (2023-10-22) + + +### Bug Fixes + +* Only allow setting `MethodFingerprint#result` privately ([aed1eac](https://github.com/ReVanced/revanced-patcher/commit/aed1eac3157317acf87f522750cf2f41509606c3)) + + +### Code Refactoring + +* Change data classes to actual classes ([6192089](https://github.com/ReVanced/revanced-patcher/commit/6192089b71bdca15765369f3e607ddd1f8266205)) +* Convert extension functions to member functions ([e2ca507](https://github.com/ReVanced/revanced-patcher/commit/e2ca50729da7085799c0ff6fc4f7afaf82579738)) +* Move files to simplify package structure ([124a2e9](https://github.com/ReVanced/revanced-patcher/commit/124a2e9d3efb88f0f038ae306d941e918ad3ad3c)) +* Remove deprecated classes and members ([a4212f6](https://github.com/ReVanced/revanced-patcher/commit/a4212f6bf952971541c4550e20f6bf57a382e19a)) + + +* refactor!: Remove `Fingerprint` interface ([54a2f8f](https://github.com/ReVanced/revanced-patcher/commit/54a2f8f16fddf2b2ed47eb23717ba3734c4a6c5d)) + + +### BREAKING CHANGES + +* The `MethodFingerprint#result` member can now only be set inside `MethodFingerprint`. +* The `Fingerprint` interface is no longer present. +* Some extension functions are now member functions. +* This gets rid of data class members. +* Some deprecated classes and members are not present anymore. +* Classes and members have changed packages. + # [18.0.0-dev.5](https://github.com/ReVanced/revanced-patcher/compare/v18.0.0-dev.4...v18.0.0-dev.5) (2023-10-22) diff --git a/gradle.properties b/gradle.properties index ad697f2..9060278 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,4 +1,4 @@ org.gradle.parallel = true org.gradle.caching = true kotlin.code.style = official -version = 18.0.0-dev.5 +version = 18.0.0-dev.6