chore: merge branch dev to main (#174)

This commit is contained in:
oSumAtrIX 2023-05-14 01:57:34 +02:00 committed by GitHub
commit ca9fe322eb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 23 additions and 39 deletions

View File

@ -26,7 +26,7 @@ jobs:
- name: Setup JDK - name: Setup JDK
uses: actions/setup-java@v3 uses: actions/setup-java@v3
with: with:
java-version: '11' java-version: '17'
distribution: 'zulu' distribution: 'zulu'
cache: gradle cache: gradle
- name: Setup Node.js - name: Setup Node.js

View File

@ -1,3 +1,13 @@
# [8.0.0-dev.1](https://github.com/revanced/revanced-patcher/compare/v7.1.1...v8.0.0-dev.1) (2023-05-10)
* feat!: add `classDef` parameter to `MethodFingerprint` (#175) ([a205220](https://github.com/revanced/revanced-patcher/commit/a2052202b23037150df6aadc47f6e91efcd481cf)), closes [#175](https://github.com/revanced/revanced-patcher/issues/175)
### BREAKING CHANGES
* This changes the signature of the `customFingerprint` function.
## [7.1.1](https://github.com/revanced/revanced-patcher/compare/v7.1.0...v7.1.1) (2023-05-07) ## [7.1.1](https://github.com/revanced/revanced-patcher/compare/v7.1.0...v7.1.1) (2023-05-07)

View File

@ -1,2 +1,2 @@
kotlin.code.style = official kotlin.code.style = official
version = 7.1.1 version = 8.0.0-dev.1

View File

@ -54,17 +54,6 @@ class BytecodeContext internal constructor(classes: MutableList<ClassDef>) : Con
} }
return proxy return proxy
} }
private companion object {
inline fun <reified T> Iterable<T>.find(predicate: (T) -> Boolean): T? {
for (element in this) {
if (predicate(element)) {
return element
}
}
return null
}
}
} }
/** /**

View File

@ -31,7 +31,7 @@ abstract class MethodFingerprint(
internal val parameters: Iterable<String>? = null, internal val parameters: Iterable<String>? = null,
internal val opcodes: Iterable<Opcode?>? = null, internal val opcodes: Iterable<Opcode?>? = null,
internal val strings: Iterable<String>? = null, internal val strings: Iterable<String>? = null,
internal val customFingerprint: ((methodDef: Method) -> Boolean)? = null internal val customFingerprint: ((methodDef: Method, classDef: ClassDef) -> Boolean)? = null
) : Fingerprint { ) : Fingerprint {
/** /**
* The result of the [MethodFingerprint] the [Method]. * The result of the [MethodFingerprint] the [Method].
@ -94,7 +94,7 @@ abstract class MethodFingerprint(
) return false ) return false
@Suppress("UNNECESSARY_NOT_NULL_ASSERTION") @Suppress("UNNECESSARY_NOT_NULL_ASSERTION")
if (methodFingerprint.customFingerprint != null && !methodFingerprint.customFingerprint!!(method)) if (methodFingerprint.customFingerprint != null && !methodFingerprint.customFingerprint!!(method, forClass))
return false return false
val stringsScanResult: StringsScanResult? = val stringsScanResult: StringsScanResult? =

View File

@ -41,18 +41,13 @@ sealed class PatchBundle(path: String) : File(path) {
arrayOf(this.toURI().toURL()), arrayOf(this.toURI().toURL()),
Thread.currentThread().contextClassLoader // TODO: find out why this is required Thread.currentThread().contextClassLoader // TODO: find out why this is required
), ),
StringIterator( JarFile(this)
JarFile(this) .stream()
.entries() .filter {it.name.endsWith(".class") && !it.name.contains("$")}
.toList() // TODO: find a cleaner solution than that to filter non class files .map({it -> it.realName.replace('/', '.').replace(".class", "")}).iterator()
.filter { )
it.name.endsWith(".class") && !it.name.contains("$")
}
.iterator()
) {
it.realName.replace('/', '.').replace(".class", "")
}
)
} }
/** /**
@ -68,8 +63,8 @@ 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,
StringIterator(DexFileFactory.loadDexFile(path, null).classes.iterator()) { 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())
} }
} }

View File

@ -1,10 +0,0 @@
package app.revanced.patcher.util.patch
internal class StringIterator<T, I : Iterator<T>>(
private val iterator: I,
private val _next: (T) -> String
) : Iterator<String> {
override fun hasNext() = iterator.hasNext()
override fun next() = _next(iterator.next())
}