build: Bump dependencies

This commit is contained in:
oSumAtrIX 2024-12-17 04:20:28 +01:00
parent fc505a8726
commit fe5fb736cb
No known key found for this signature in database
GPG Key ID: A9B3094ACDB604B4
5 changed files with 81 additions and 63 deletions

View File

@ -73,6 +73,8 @@ public final class app/revanced/patcher/Patcher : java/io/Closeable {
}
public final class app/revanced/patcher/PatcherConfig {
public fun <init> (Ljava/io/File;Ljava/io/File;Ljava/io/File;Ljava/lang/String;)V
public synthetic fun <init> (Ljava/io/File;Ljava/io/File;Ljava/io/File;Ljava/lang/String;ILkotlin/jvm/internal/DefaultConstructorMarker;)V
public fun <init> (Ljava/io/File;Ljava/io/File;Ljava/lang/String;Ljava/lang/String;)V
public synthetic fun <init> (Ljava/io/File;Ljava/io/File;Ljava/lang/String;Ljava/lang/String;ILkotlin/jvm/internal/DefaultConstructorMarker;)V
}

View File

@ -1,14 +1,14 @@
[versions]
android = "4.1.1.4"
apktool-lib = "2.9.3"
apktool-lib = "2.10.1.1"
binary-compatibility-validator = "0.15.1"
kotlin = "2.0.0"
kotlin = "2.0.20"
kotlinx-coroutines-core = "1.8.1"
mockk = "1.13.10"
multidexlib2 = "3.0.3.r3"
# Tracking https://github.com/google/smali/issues/64.
#noinspection GradleDependency
smali = "3.0.5"
smali = "3.0.8"
xpp3 = "1.1.4c"
[libraries]

View File

@ -16,9 +16,28 @@ import java.util.logging.Logger
class PatcherConfig(
internal val apkFile: File,
private val temporaryFilesPath: File = File("revanced-temporary-files"),
aaptBinaryPath: String? = null,
aaptBinaryPath: File? = null,
frameworkFileDirectory: String? = null,
) {
/**
* The configuration for the patcher.
*
* @param apkFile The apk file to patch.
* @param temporaryFilesPath A path to a folder to store temporary files in.
* @param aaptBinaryPath A path to a custom aapt binary.
* @param frameworkFileDirectory A path to the directory to cache the framework file in.
*/
@Deprecated(
"Use the constructor with a File for aaptBinaryPath instead.",
ReplaceWith("PatcherConfig(apkFile, temporaryFilesPath, aaptBinaryPath?.let { File(it) }, frameworkFileDirectory)"),
)
constructor(
apkFile: File,
temporaryFilesPath: File = File("revanced-temporary-files"),
aaptBinaryPath: String? = null,
frameworkFileDirectory: String? = null,
) : this(apkFile, temporaryFilesPath, aaptBinaryPath?.let { File(it) }, frameworkFileDirectory)
private val logger = Logger.getLogger(PatcherConfig::class.java.name)
/**
@ -33,8 +52,7 @@ class PatcherConfig(
*/
internal val resourceConfig =
Config.getDefaultConfig().apply {
useAapt2 = true
aaptPath = aaptBinaryPath ?: ""
aaptBinary = aaptBinaryPath
frameworkDirectory = frameworkFileDirectory
}

View File

@ -10,9 +10,9 @@ import brut.androlib.ApkDecoder
import brut.androlib.apk.UsesFramework
import brut.androlib.res.Framework
import brut.androlib.res.ResourcesDecoder
import brut.androlib.res.decoder.AndroidManifestPullStreamDecoder
import brut.androlib.res.decoder.AndroidManifestResourceParser
import brut.androlib.res.decoder.XmlPullStreamDecoder
import brut.androlib.res.xml.ResXmlPatcher
import brut.androlib.res.xml.ResXmlUtils
import brut.directory.ExtFile
import java.io.InputStream
import java.io.OutputStream
@ -51,8 +51,7 @@ class ResourcePatchContext internal constructor(
*
* @param mode The [ResourceMode] to use.
*/
internal fun decodeResources(mode: ResourceMode) =
with(packageMetadata.apkInfo) {
internal fun decodeResources(mode: ResourceMode) = with(packageMetadata.apkInfo) {
config.initializeTemporaryFilesDirectories()
// Needed to decode resources.
@ -65,8 +64,7 @@ class ResourcePatchContext internal constructor(
resourcesDecoder.decodeManifest(config.apkFiles)
// Needed to record uncompressed files.
val apkDecoder = ApkDecoder(config.resourceConfig, this)
apkDecoder.recordUncompressedFiles(resourcesDecoder.resFileMapping)
ApkDecoder(this, config.resourceConfig).recordUncompressedFiles(resourcesDecoder.resFileMapping)
usesFramework =
UsesFramework().apply {
@ -77,10 +75,10 @@ class ResourcePatchContext internal constructor(
// Decode manually instead of using resourceDecoder.decodeManifest
// because it does not support decoding to an OutputStream.
XmlPullStreamDecoder(
AndroidManifestPullStreamDecoder(
AndroidManifestResourceParser(resourcesDecoder.resTable),
resourcesDecoder.resXmlSerializer,
).decodeManifest(
resourcesDecoder.newXmlSerializer(),
).decode(
apkFile.directory.getFileInput("AndroidManifest.xml"),
// Older Android versions do not support OutputStream.nullOutputStream()
object : OutputStream() {
@ -90,7 +88,7 @@ class ResourcePatchContext internal constructor(
)
// Get the package name and version from the manifest using the XmlPullStreamDecoder.
// XmlPullStreamDecoder.decodeManifest() sets metadata.apkInfo.
// AndroidManifestPullStreamDecoder.decode() sets metadata.apkInfo.
packageMetadata.let { metadata ->
metadata.packageName = resourcesDecoder.resTable.packageRenamed
versionInfo.let {
@ -100,7 +98,7 @@ class ResourcePatchContext internal constructor(
/*
The ResTable if flagged as sparse if the main package is not loaded, which is the case here,
because ResourcesDecoder.decodeResources loads the main package
and not XmlPullStreamDecoder.decodeManifest.
and not AndroidManifestPullStreamDecoder.decode.
See ARSCDecoder.readTableType for more info.
Set this to false again to prevent the ResTable from being flagged as sparse falsely.
@ -130,10 +128,10 @@ class ResourcePatchContext internal constructor(
AaptInvoker(
config.resourceConfig,
packageMetadata.apkInfo,
).invokeAapt(
).invoke(
resources.resolve("resources.apk"),
config.apkFiles.resolve("AndroidManifest.xml").also {
ResXmlPatcher.fixingPublicAttrsInProviderAttributes(it)
ResXmlUtils.fixingPublicAttrsInProviderAttributes(it)
},
config.apkFiles.resolve("res"),
null,