feat: allow custom aapt path to be specified

This commit is contained in:
Lucaskyy 2022-06-11 20:08:00 +02:00
parent afcba5c212
commit 8eb4a8f87a
No known key found for this signature in database
GPG key ID: 1530BFF96D1EEB89
2 changed files with 9 additions and 12 deletions

View file

@ -41,11 +41,8 @@ val NAMER = BasicDexFileNamer()
* The ReVanced Patcher. * The ReVanced Patcher.
* @param options The options for the patcher. * @param options The options for the patcher.
*/ */
class Patcher( class Patcher(private val options: PatcherOptions) {
private val options: PatcherOptions
) {
val data: PatcherData val data: PatcherData
private val opcodes: Opcodes private val opcodes: Opcodes
init { init {
@ -145,12 +142,11 @@ class Patcher(
val cacheDirectory = ExtFile(options.resourceCacheDirectory) val cacheDirectory = ExtFile(options.resourceCacheDirectory)
val androlibResources = AndrolibResources().also { resources -> val androlibResources = AndrolibResources().also { resources ->
resources.buildOptions = BuildOptions().also { options -> resources.buildOptions = BuildOptions().also { buildOptions ->
// TODO: options.useAapt2 = true buildOptions.aaptPath = options.aaptPath
// TODO: options.aaptPath = "" buildOptions.isFramework = metaInfo.isFrameworkApk
options.isFramework = metaInfo.isFrameworkApk buildOptions.resourcesAreCompressed = metaInfo.compressionType
options.resourcesAreCompressed = metaInfo.compressionType buildOptions.doNotCompress = metaInfo.doNotCompress
options.doNotCompress = metaInfo.doNotCompress
} }
resources.setSdkInfo(metaInfo.sdkInfo) resources.setSdkInfo(metaInfo.sdkInfo)

View file

@ -7,10 +7,11 @@ import java.io.File
* @param inputFile The input file (usually an apk file). * @param inputFile The input file (usually an apk file).
* @param resourceCacheDirectory Directory to cache resources. * @param resourceCacheDirectory Directory to cache resources.
* @param patchResources Weather to use the resource patcher. Resources will still need to be decoded. * @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( data class PatcherOptions(
internal val inputFile: File, internal val inputFile: File,
// TODO: maybe a file system in memory is better. Could cause high memory usage.
internal val resourceCacheDirectory: String, internal val resourceCacheDirectory: String,
internal val patchResources: Boolean = false internal val patchResources: Boolean = false,
internal val aaptPath: String = ""
) )