mirror of
https://github.com/revanced/revanced-patcher.git
synced 2025-05-01 21:54:24 +02:00
feat: improve logging
This commit is contained in:
parent
78663cde88
commit
c20dfe12d5
@ -62,7 +62,7 @@ class Patcher(private val options: PatcherOptions) {
|
|||||||
val packageMetadata = PackageMetadata()
|
val packageMetadata = PackageMetadata()
|
||||||
|
|
||||||
if (options.patchResources) {
|
if (options.patchResources) {
|
||||||
logger.info("Decoding resources using Androlib, this may take a long time...")
|
logger.info("Decoding resources")
|
||||||
|
|
||||||
// decode resources to cache directory
|
// decode resources to cache directory
|
||||||
androlib.decodeManifestWithResources(extInputFile, outDir, resourceTable)
|
androlib.decodeManifestWithResources(extInputFile, outDir, resourceTable)
|
||||||
@ -78,7 +78,7 @@ class Patcher(private val options: PatcherOptions) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
logger.info("Decoding AndroidManifest.xml manually because resource patching is disabled")
|
logger.info("Only decoding AndroidManifest.xml because resource patching is disabled")
|
||||||
|
|
||||||
// create decoder for the resource table
|
// create decoder for the resource table
|
||||||
val decoder = ResAttrDecoder()
|
val decoder = ResAttrDecoder()
|
||||||
@ -102,7 +102,7 @@ class Patcher(private val options: PatcherOptions) {
|
|||||||
packageMetadata.metaInfo.versionInfo = resourceTable.versionInfo
|
packageMetadata.metaInfo.versionInfo = resourceTable.versionInfo
|
||||||
packageMetadata.metaInfo.sdkInfo = resourceTable.sdkInfo
|
packageMetadata.metaInfo.sdkInfo = resourceTable.sdkInfo
|
||||||
|
|
||||||
logger.info("Reading input as dex file")
|
logger.info("Reading dex files")
|
||||||
|
|
||||||
// read dex files
|
// read dex files
|
||||||
val dexFile = MultiDexIO.readDexFile(true, options.inputFile, NAMER, null, null)
|
val dexFile = MultiDexIO.readDexFile(true, options.inputFile, NAMER, null, null)
|
||||||
@ -164,7 +164,6 @@ class Patcher(private val options: PatcherOptions) {
|
|||||||
var resourceFile: File? = null
|
var resourceFile: File? = null
|
||||||
|
|
||||||
if (options.patchResources) {
|
if (options.patchResources) {
|
||||||
logger.info("Patching resources")
|
|
||||||
val cacheDirectory = ExtFile(options.resourceCacheDirectory)
|
val cacheDirectory = ExtFile(options.resourceCacheDirectory)
|
||||||
|
|
||||||
val androlibResources = AndrolibResources().also { resources ->
|
val androlibResources = AndrolibResources().also { resources ->
|
||||||
@ -197,7 +196,7 @@ class Patcher(private val options: PatcherOptions) {
|
|||||||
)
|
)
|
||||||
}.toTypedArray()
|
}.toTypedArray()
|
||||||
|
|
||||||
logger.trace("Packaging using aapt")
|
logger.info("Compiling resources")
|
||||||
androlibResources.aaptPackage(
|
androlibResources.aaptPackage(
|
||||||
aaptFile, manifestFile, resDirectory, null, null, includedFiles
|
aaptFile, manifestFile, resDirectory, null, null, includedFiles
|
||||||
)
|
)
|
||||||
@ -251,8 +250,6 @@ class Patcher(private val options: PatcherOptions) {
|
|||||||
): PatchResult {
|
): PatchResult {
|
||||||
val patchName = patch.patchName
|
val patchName = patch.patchName
|
||||||
|
|
||||||
logger.trace("Applying patch $patchName")
|
|
||||||
|
|
||||||
// if the patch has already applied silently skip it
|
// if the patch has already applied silently skip it
|
||||||
if (appliedPatches.contains(patchName)) {
|
if (appliedPatches.contains(patchName)) {
|
||||||
logger.trace("Skipping patch $patchName because it has already been applied")
|
logger.trace("Skipping patch $patchName because it has already been applied")
|
||||||
@ -317,7 +314,7 @@ class Patcher(private val options: PatcherOptions) {
|
|||||||
Result.failure(patchResult.error()!!)
|
Result.failure(patchResult.error()!!)
|
||||||
}
|
}
|
||||||
|
|
||||||
yield(patch.name to result)
|
yield(patch.patchName to result)
|
||||||
if (stopOnError && patchResult.isError()) break
|
if (stopOnError && patchResult.isError()) break
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user