diff --git a/src/main/kotlin/app/revanced/patcher/Patcher.kt b/src/main/kotlin/app/revanced/patcher/Patcher.kt index aa4c100..4653a99 100644 --- a/src/main/kotlin/app/revanced/patcher/Patcher.kt +++ b/src/main/kotlin/app/revanced/patcher/Patcher.kt @@ -41,11 +41,8 @@ val NAMER = BasicDexFileNamer() * The ReVanced Patcher. * @param options The options for the patcher. */ -class Patcher( - private val options: PatcherOptions -) { +class Patcher(private val options: PatcherOptions) { val data: PatcherData - private val opcodes: Opcodes init { @@ -145,12 +142,11 @@ class Patcher( val cacheDirectory = ExtFile(options.resourceCacheDirectory) val androlibResources = AndrolibResources().also { resources -> - resources.buildOptions = BuildOptions().also { options -> - // TODO: options.useAapt2 = true - // TODO: options.aaptPath = "" - options.isFramework = metaInfo.isFrameworkApk - options.resourcesAreCompressed = metaInfo.compressionType - options.doNotCompress = metaInfo.doNotCompress + resources.buildOptions = BuildOptions().also { buildOptions -> + buildOptions.aaptPath = options.aaptPath + buildOptions.isFramework = metaInfo.isFrameworkApk + buildOptions.resourcesAreCompressed = metaInfo.compressionType + buildOptions.doNotCompress = metaInfo.doNotCompress } resources.setSdkInfo(metaInfo.sdkInfo) diff --git a/src/main/kotlin/app/revanced/patcher/PatcherOptions.kt b/src/main/kotlin/app/revanced/patcher/PatcherOptions.kt index 2e36a28..a371037 100644 --- a/src/main/kotlin/app/revanced/patcher/PatcherOptions.kt +++ b/src/main/kotlin/app/revanced/patcher/PatcherOptions.kt @@ -7,10 +7,11 @@ import java.io.File * @param inputFile The input file (usually an apk file). * @param resourceCacheDirectory Directory to cache resources. * @param patchResources Weather to use the resource patcher. Resources will still need to be decoded. + * @param aaptPath Optional path to a custom aapt binary. */ data class PatcherOptions( internal val inputFile: File, - // TODO: maybe a file system in memory is better. Could cause high memory usage. internal val resourceCacheDirectory: String, - internal val patchResources: Boolean = false + internal val patchResources: Boolean = false, + internal val aaptPath: String = "" )