diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 424c8e09..09de4c15 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -1,5 +1,6 @@ name: Release on: + workflow_dispatch: push: branches: - main diff --git a/src/main/kotlin/app/revanced/patcher/util/patch/implementation/JarPatchBundle.kt b/src/main/kotlin/app/revanced/patcher/util/patch/implementation/JarPatchBundle.kt index 3d76fb2b..7e18c4ad 100644 --- a/src/main/kotlin/app/revanced/patcher/util/patch/implementation/JarPatchBundle.kt +++ b/src/main/kotlin/app/revanced/patcher/util/patch/implementation/JarPatchBundle.kt @@ -10,9 +10,21 @@ import java.util.jar.JarFile * @param patchBundlePath The path to the patch bundle. */ class JarPatchBundle(patchBundlePath: String) : PatchBundle(patchBundlePath) { - fun loadPatches() = loadPatches(URLClassLoader(arrayOf(this.toURI().toURL()), null), StringIterator( - JarFile(this).entries().iterator() - ) { - it.realName.replace('/', '.').replace(".class", "") - }) + fun loadPatches() = loadPatches( + URLClassLoader( + arrayOf(this.toURI().toURL()), + Thread.currentThread().contextClassLoader // TODO: find out why this is required + ), + StringIterator( + JarFile(this) + .entries() + .toList() // TODO: find a cleaner solution than that to filter non class files + .filter { + it.name.endsWith(".class") && !it.name.contains("$") + } + .iterator() + ) { + it.realName.replace('/', '.').replace(".class", "") + } + ) }