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.
* @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)

View file

@ -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 = ""
)