oSumAtrIX 11a911dc67 feat: Convert APIs to Kotlin DSL (#298)
This commit converts various APIs to Kotlin DSL.

BREAKING CHANGE: Various old APIs are removed, and DSL APIs are added instead.
2024-08-06 16:53:42 +02:00

41 lines
1.2 KiB
Kotlin

package app.revanced.patcher
import app.revanced.patcher.patch.BytecodePatchContext
import app.revanced.patcher.patch.Patch
import app.revanced.patcher.patch.ResourcePatchContext
import brut.androlib.apk.ApkInfo
import brut.directory.ExtFile
/**
* 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) {
/**
* [PackageMetadata] of the supplied [PatcherConfig.apkFile].
*/
val packageMetadata = PackageMetadata(ApkInfo(ExtFile(config.apkFile)))
/**
* The set of [Patch]es.
*/
internal val executablePatches = mutableSetOf<Patch<*>>()
/**
* The set of all [Patch]es and their dependencies.
*/
internal val allPatches = mutableSetOf<Patch<*>>()
/**
* The context for patches containing the current state of the resources.
*/
internal val resourceContext = ResourcePatchContext(packageMetadata, config)
/**
* The context for patches containing the current state of the bytecode.
*/
internal val bytecodeContext = BytecodePatchContext(config)
}