mirror of
https://github.com/ReVanced/revanced-patcher.git
synced 2026-01-19 17:33:56 +00:00
Compare commits
2 Commits
v11.0.2-de
...
v11.0.2-de
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
0a8ccba33e | ||
|
|
519359a9eb |
@@ -1,3 +1,10 @@
|
|||||||
|
## [11.0.2-dev.4](https://github.com/revanced/revanced-patcher/compare/v11.0.2-dev.3...v11.0.2-dev.4) (2023-06-27)
|
||||||
|
|
||||||
|
|
||||||
|
### Bug Fixes
|
||||||
|
|
||||||
|
* do not load annotations as patches ([519359a](https://github.com/revanced/revanced-patcher/commit/519359a9eb0e9dfa390c5016e9fe4a7490b8ab18))
|
||||||
|
|
||||||
## [11.0.2-dev.3](https://github.com/revanced/revanced-patcher/compare/v11.0.2-dev.2...v11.0.2-dev.3) (2023-06-27)
|
## [11.0.2-dev.3](https://github.com/revanced/revanced-patcher/compare/v11.0.2-dev.2...v11.0.2-dev.3) (2023-06-27)
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -1,2 +1,2 @@
|
|||||||
kotlin.code.style = official
|
kotlin.code.style = official
|
||||||
version = 11.0.2-dev.3
|
version = 11.0.2-dev.4
|
||||||
|
|||||||
@@ -3,6 +3,7 @@
|
|||||||
package app.revanced.patcher.util.patch
|
package app.revanced.patcher.util.patch
|
||||||
|
|
||||||
import app.revanced.patcher.data.Context
|
import app.revanced.patcher.data.Context
|
||||||
|
import app.revanced.patcher.extensions.AnnotationExtensions.findAnnotationRecursively
|
||||||
import app.revanced.patcher.extensions.PatchExtensions.patchName
|
import app.revanced.patcher.extensions.PatchExtensions.patchName
|
||||||
import app.revanced.patcher.patch.Patch
|
import app.revanced.patcher.patch.Patch
|
||||||
import org.jf.dexlib2.DexFileFactory
|
import org.jf.dexlib2.DexFileFactory
|
||||||
@@ -19,7 +20,13 @@ sealed class PatchBundle(path: String) : File(path) {
|
|||||||
internal fun loadPatches(classLoader: ClassLoader, classNames: Iterator<String>) = buildList {
|
internal fun loadPatches(classLoader: ClassLoader, classNames: Iterator<String>) = buildList {
|
||||||
classNames.forEach { className ->
|
classNames.forEach { className ->
|
||||||
val clazz = classLoader.loadClass(className)
|
val clazz = classLoader.loadClass(className)
|
||||||
if (!clazz.isAnnotationPresent(app.revanced.patcher.patch.annotations.Patch::class.java)) return@forEach
|
|
||||||
|
// Annotations can not Patch.
|
||||||
|
if (clazz.isAnnotation) return@forEach
|
||||||
|
|
||||||
|
clazz.findAnnotationRecursively(app.revanced.patcher.patch.annotations.Patch::class)
|
||||||
|
?: return@forEach
|
||||||
|
|
||||||
@Suppress("UNCHECKED_CAST") this.add(clazz as Class<out Patch<Context>>)
|
@Suppress("UNCHECKED_CAST") this.add(clazz as Class<out Patch<Context>>)
|
||||||
}
|
}
|
||||||
}.sortedBy { it.patchName }
|
}.sortedBy { it.patchName }
|
||||||
@@ -43,11 +50,9 @@ sealed class PatchBundle(path: String) : File(path) {
|
|||||||
),
|
),
|
||||||
JarFile(this)
|
JarFile(this)
|
||||||
.stream()
|
.stream()
|
||||||
.filter {it.name.endsWith(".class") && !it.name.contains("$")}
|
.filter { it.name.endsWith(".class") && !it.name.contains("$") }
|
||||||
.map({it -> it.realName.replace('/', '.').replace(".class", "")}).iterator()
|
.map { it.realName.replace('/', '.').replace(".class", "") }.iterator()
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -63,8 +68,9 @@ sealed class PatchBundle(path: String) : File(path) {
|
|||||||
* Patches will be loaded to the provided [dexClassLoader].
|
* Patches will be loaded to the provided [dexClassLoader].
|
||||||
*/
|
*/
|
||||||
fun loadPatches() = loadPatches(dexClassLoader,
|
fun loadPatches() = loadPatches(dexClassLoader,
|
||||||
DexFileFactory.loadDexFile(path, null).classes.asSequence().map({ classDef ->
|
DexFileFactory.loadDexFile(path, null).classes.asSequence().map { classDef ->
|
||||||
classDef.type.substring(1, classDef.length - 1).replace('/', '.')
|
classDef.type.substring(1, classDef.length - 1).replace('/', '.')
|
||||||
}).iterator())
|
}.iterator()
|
||||||
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user