Skip to content

Commit

Permalink
fix: Downgrade smali to fix dex compilation issue
Browse files Browse the repository at this point in the history
  • Loading branch information
oSumAtrIX committed Jul 31, 2024
1 parent 328aa87 commit 714447d
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 5 deletions.
6 changes: 4 additions & 2 deletions api/revanced-patcher.api
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,8 @@ public final class app/revanced/patcher/PatcherConfig {
public synthetic fun <init> (Ljava/io/File;Ljava/io/File;Ljava/lang/String;Ljava/lang/String;ZILkotlin/jvm/internal/DefaultConstructorMarker;)V
}

public final class app/revanced/patcher/PatcherContext {
public final class app/revanced/patcher/PatcherContext : java/io/Closeable {
public fun close ()V
public final fun getPackageMetadata ()Lapp/revanced/patcher/PackageMetadata;
}

Expand Down Expand Up @@ -152,9 +153,10 @@ public final class app/revanced/patcher/patch/BytecodePatchBuilder$InvokedFinger
public final fun getValue (Ljava/lang/Void;Lkotlin/reflect/KProperty;)Lapp/revanced/patcher/Match;
}

public final class app/revanced/patcher/patch/BytecodePatchContext : app/revanced/patcher/patch/PatchContext {
public final class app/revanced/patcher/patch/BytecodePatchContext : app/revanced/patcher/patch/PatchContext, java/io/Closeable {
public final fun classBy (Lkotlin/jvm/functions/Function1;)Lapp/revanced/patcher/util/proxy/ClassProxy;
public final fun classByType (Ljava/lang/String;)Lapp/revanced/patcher/util/proxy/ClassProxy;
public fun close ()V
public synthetic fun get ()Ljava/lang/Object;
public fun get ()Ljava/util/Set;
public final fun getClasses ()Lapp/revanced/patcher/util/ProxyClassList;
Expand Down
4 changes: 3 additions & 1 deletion gradle/libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,9 @@ kotlin = "2.0.0"
kotlinx-coroutines-core = "1.8.1"
mockk = "1.13.10"
multidexlib2 = "3.0.3.r3"
smali = "3.0.7"
# Tracking https://github.com/google/smali/issues/64.
#noinspection GradleDependency
smali = "3.0.5"
binary-compatibility-validator = "0.15.1"
xpp3 = "1.1.4c"

Expand Down
2 changes: 1 addition & 1 deletion src/main/kotlin/app/revanced/patcher/Patcher.kt
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ class Patcher(private val config: PatcherConfig) : Closeable {
}
}

override fun close() = context.bytecodeContext.close()
override fun close() = context.close()

/**
* Compile and save patched APK files.
Expand Down
5 changes: 4 additions & 1 deletion src/main/kotlin/app/revanced/patcher/PatcherContext.kt
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,15 @@ import app.revanced.patcher.patch.Patch
import app.revanced.patcher.patch.ResourcePatchContext
import brut.androlib.apk.ApkInfo
import brut.directory.ExtFile
import java.io.Closeable

/**
* A context for the patcher containing the current state of the patcher.
*
* @param config The configuration for the patcher.
*/
@Suppress("MemberVisibilityCanBePrivate")
class PatcherContext internal constructor(config: PatcherConfig) {
class PatcherContext internal constructor(config: PatcherConfig): Closeable {
/**
* [PackageMetadata] of the supplied [PatcherConfig.apkFile].
*/
Expand All @@ -37,4 +38,6 @@ class PatcherContext internal constructor(config: PatcherConfig) {
* The context for patches containing the current state of the bytecode.
*/
internal val bytecodeContext = BytecodePatchContext(config)

override fun close() = bytecodeContext.close()
}
1 change: 1 addition & 0 deletions src/test/kotlin/app/revanced/patcher/PatcherTest.kt
Original file line number Diff line number Diff line change
Expand Up @@ -192,6 +192,7 @@ internal object PatcherTest {

private operator fun Set<Patch<*>>.invoke(): List<PatchResult> {
every { patcher.context.executablePatches } returns toMutableSet()
every { patcher.context.bytecodeContext.lookupMaps } returns LookupMaps(patcher.context.bytecodeContext.classes)

return runBlocking { patcher().toList() }
}
Expand Down

0 comments on commit 714447d

Please sign in to comment.