Skip to content

Commit

Permalink
feat: allow custom aapt path to be specified
Browse files Browse the repository at this point in the history
  • Loading branch information
Sculas committed Jun 11, 2022
1 parent afcba5c commit 8eb4a8f
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 12 deletions.
16 changes: 6 additions & 10 deletions src/main/kotlin/app/revanced/patcher/Patcher.kt
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -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)
Expand Down
5 changes: 3 additions & 2 deletions src/main/kotlin/app/revanced/patcher/PatcherOptions.kt
Original file line number Diff line number Diff line change
Expand Up @@ -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 = ""
)

0 comments on commit 8eb4a8f

Please sign in to comment.