mirror of
https://github.com/revanced/revanced-patcher.git
synced 2025-05-19 12:07:05 +02:00
Build log strings in suppliers
This commit is contained in:
parent
f62e952514
commit
35b85b2c29
@ -89,9 +89,9 @@ val patcherResult = Patcher(PatcherConfig(apkFile = File("some.apk"))).use { pat
|
||||
runBlocking {
|
||||
patcher().collect { patchResult ->
|
||||
if (patchResult.exception != null)
|
||||
logger.info("\"${patchResult.patch}\" failed:\n${patchResult.exception}")
|
||||
logger.info { "\"${patchResult.patch}\" failed:\n${patchResult.exception}" }
|
||||
else
|
||||
logger.info("\"${patchResult.patch}\" succeeded")
|
||||
logger.info { "\"${patchResult.patch}\" succeeded" }
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -97,7 +97,7 @@ class BytecodePatchContext internal constructor(private val config: PatcherConfi
|
||||
bytecodePatch.extensionInputStream?.get()?.use { extensionStream ->
|
||||
RawDexIO.readRawDexFile(extensionStream, 0, null).classes.forEach { classDef ->
|
||||
val existingClass = lookupMaps.classesByType[classDef.type] ?: run {
|
||||
logger.fine("Adding class \"$classDef\"")
|
||||
logger.fine { "Adding class \"$classDef\"" }
|
||||
|
||||
classes += classDef
|
||||
lookupMaps.classesByType[classDef.type] = classDef
|
||||
@ -105,7 +105,7 @@ class BytecodePatchContext internal constructor(private val config: PatcherConfi
|
||||
return@forEach
|
||||
}
|
||||
|
||||
logger.fine("Class \"$classDef\" exists already. Adding missing methods and fields.")
|
||||
logger.fine { "Class \"$classDef\" exists already. Adding missing methods and fields." }
|
||||
|
||||
existingClass.merge(classDef, this@BytecodePatchContext).let { mergedClass ->
|
||||
// If the class was merged, replace the original class with the merged class.
|
||||
@ -178,7 +178,7 @@ class BytecodePatchContext internal constructor(private val config: PatcherConfi
|
||||
override fun getOpcodes() = this@BytecodePatchContext.opcodes
|
||||
},
|
||||
DexIO.DEFAULT_MAX_DEX_POOL_SIZE,
|
||||
) { _, entryName, _ -> logger.info("Compiled $entryName") }
|
||||
) { _, entryName, _ -> logger.info { "Compiled $entryName" } }
|
||||
}.listFiles(FileFilter { it.isFile })!!.map {
|
||||
PatcherResult.PatchedDexFile(it.name, it.inputStream())
|
||||
}.toSet()
|
||||
|
@ -60,7 +60,7 @@ internal object ClassMerger {
|
||||
|
||||
if (missingMethods.isEmpty()) return this
|
||||
|
||||
logger.fine("Found ${missingMethods.size} missing methods")
|
||||
logger.fine { "Found ${missingMethods.size} missing methods" }
|
||||
|
||||
return asMutableClass().apply {
|
||||
methods.addAll(missingMethods.map { it.toMutable() })
|
||||
@ -80,7 +80,7 @@ internal object ClassMerger {
|
||||
|
||||
if (missingFields.isEmpty()) return this
|
||||
|
||||
logger.fine("Found ${missingFields.size} missing fields")
|
||||
logger.fine { "Found ${missingFields.size} missing fields" }
|
||||
|
||||
return asMutableClass().apply {
|
||||
fields.addAll(missingFields.map { it.toMutable() })
|
||||
@ -100,7 +100,7 @@ internal object ClassMerger {
|
||||
context.traverseClassHierarchy(this) {
|
||||
if (accessFlags.isPublic()) return@traverseClassHierarchy
|
||||
|
||||
logger.fine("Publicizing ${this.type}")
|
||||
logger.fine { "Publicizing ${this.type}" }
|
||||
|
||||
accessFlags = accessFlags.toPublic()
|
||||
}
|
||||
@ -124,7 +124,7 @@ internal object ClassMerger {
|
||||
|
||||
if (brokenFields.isEmpty()) return this
|
||||
|
||||
logger.fine("Found ${brokenFields.size} broken fields")
|
||||
logger.fine { "Found ${brokenFields.size} broken fields" }
|
||||
|
||||
/**
|
||||
* Make a field public.
|
||||
@ -153,7 +153,7 @@ internal object ClassMerger {
|
||||
|
||||
if (brokenMethods.isEmpty()) return this
|
||||
|
||||
logger.fine("Found ${brokenMethods.size} methods")
|
||||
logger.fine { "Found ${brokenMethods.size} methods" }
|
||||
|
||||
/**
|
||||
* Make a method public.
|
||||
|
Loading…
x
Reference in New Issue
Block a user