mirror of
https://github.com/ReVanced/revanced-patcher.git
synced 2026-01-29 22:21:03 +00:00
Compare commits
4 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
b19e1131e8 | ||
|
|
123ad54c15 | ||
|
|
09f6ab4155 | ||
|
|
01cf3fb50f |
@@ -1,3 +1,10 @@
|
|||||||
|
## [3.3.2](https://github.com/revanced/revanced-patcher/compare/v3.3.1...v3.3.2) (2022-08-06)
|
||||||
|
|
||||||
|
|
||||||
|
### Bug Fixes
|
||||||
|
|
||||||
|
* close open files ([#75](https://github.com/revanced/revanced-patcher/issues/75)) ([123ad54](https://github.com/revanced/revanced-patcher/commit/123ad54c150bd04f4b8ef5c65334ea468ceb99cc))
|
||||||
|
|
||||||
## [3.3.1](https://github.com/revanced/revanced-patcher/compare/v3.3.0...v3.3.1) (2022-08-03)
|
## [3.3.1](https://github.com/revanced/revanced-patcher/compare/v3.3.0...v3.3.1) (2022-08-03)
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -1,2 +1,2 @@
|
|||||||
kotlin.code.style = official
|
kotlin.code.style = official
|
||||||
version = 3.3.1
|
version = 3.3.2
|
||||||
|
|||||||
@@ -49,6 +49,7 @@ class Patcher(private val options: PatcherOptions) {
|
|||||||
|
|
||||||
init {
|
init {
|
||||||
val extInputFile = ExtFile(options.inputFile)
|
val extInputFile = ExtFile(options.inputFile)
|
||||||
|
try {
|
||||||
val outDir = File(options.resourceCacheDirectory)
|
val outDir = File(options.resourceCacheDirectory)
|
||||||
if (outDir.exists()) {
|
if (outDir.exists()) {
|
||||||
logger.info("Deleting existing resource cache directory")
|
logger.info("Deleting existing resource cache directory")
|
||||||
@@ -113,6 +114,9 @@ class Patcher(private val options: PatcherOptions) {
|
|||||||
data = PatcherData(
|
data = PatcherData(
|
||||||
dexFile.classes.toMutableList(), options.resourceCacheDirectory, packageMetadata
|
dexFile.classes.toMutableList(), options.resourceCacheDirectory, packageMetadata
|
||||||
)
|
)
|
||||||
|
} finally {
|
||||||
|
extInputFile.close()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -165,7 +169,7 @@ class Patcher(private val options: PatcherOptions) {
|
|||||||
|
|
||||||
if (options.patchResources) {
|
if (options.patchResources) {
|
||||||
val cacheDirectory = ExtFile(options.resourceCacheDirectory)
|
val cacheDirectory = ExtFile(options.resourceCacheDirectory)
|
||||||
|
try {
|
||||||
val androlibResources = AndrolibResources().also { resources ->
|
val androlibResources = AndrolibResources().also { resources ->
|
||||||
resources.buildOptions = BuildOptions().also { buildOptions ->
|
resources.buildOptions = BuildOptions().also { buildOptions ->
|
||||||
buildOptions.setBuildOptions(options)
|
buildOptions.setBuildOptions(options)
|
||||||
@@ -202,6 +206,9 @@ class Patcher(private val options: PatcherOptions) {
|
|||||||
)
|
)
|
||||||
|
|
||||||
resourceFile = aaptFile
|
resourceFile = aaptFile
|
||||||
|
} finally {
|
||||||
|
cacheDirectory.close()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
logger.trace("Creating new dex file")
|
logger.trace("Creating new dex file")
|
||||||
|
|||||||
@@ -5,6 +5,6 @@ import java.io.InputStream
|
|||||||
/**
|
/**
|
||||||
* Wrapper for dex files.
|
* Wrapper for dex files.
|
||||||
* @param name The original name of the dex file.
|
* @param name The original name of the dex file.
|
||||||
* @param dexFileInputStream The dex file as [InputStream].
|
* @param stream The dex file as [InputStream].
|
||||||
*/
|
*/
|
||||||
data class DexFile(val name: String, val dexFileInputStream: InputStream)
|
data class DexFile(val name: String, val stream: InputStream)
|
||||||
@@ -1,17 +1,17 @@
|
|||||||
package app.revanced.patcher.util.patch.base
|
package app.revanced.patcher.util.patch
|
||||||
|
|
||||||
import app.revanced.patcher.data.Data
|
import app.revanced.patcher.data.Data
|
||||||
import app.revanced.patcher.patch.Patch
|
import app.revanced.patcher.patch.Patch
|
||||||
import java.io.File
|
import java.io.File
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param patchBundlePath The path to the patch bundle.
|
* @param path The path to the patch bundle.
|
||||||
*/
|
*/
|
||||||
abstract class PatchBundle(patchBundlePath: String) : File(patchBundlePath) {
|
abstract 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 ->
|
for (className in classNames) {
|
||||||
val clazz = classLoader.loadClass(className)
|
val clazz = classLoader.loadClass(className)
|
||||||
if (!clazz.isAnnotationPresent(app.revanced.patcher.patch.annotations.Patch::class.java)) return@forEach
|
if (!clazz.isAnnotationPresent(app.revanced.patcher.patch.annotations.Patch::class.java)) continue
|
||||||
@Suppress("UNCHECKED_CAST") this.add(clazz as Class<out Patch<Data>>)
|
@Suppress("UNCHECKED_CAST") this.add(clazz as Class<out Patch<Data>>)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
package app.revanced.patcher.util.patch.util
|
package app.revanced.patcher.util.patch
|
||||||
|
|
||||||
internal class StringIterator<T, I : Iterator<T>>(
|
internal class StringIterator<T, I : Iterator<T>>(
|
||||||
private val iterator: I,
|
private val iterator: I,
|
||||||
@@ -1,7 +1,7 @@
|
|||||||
package app.revanced.patcher.util.patch.implementation
|
package app.revanced.patcher.util.patch.impl
|
||||||
|
|
||||||
import app.revanced.patcher.util.patch.base.PatchBundle
|
import app.revanced.patcher.util.patch.PatchBundle
|
||||||
import app.revanced.patcher.util.patch.util.StringIterator
|
import app.revanced.patcher.util.patch.StringIterator
|
||||||
import org.jf.dexlib2.DexFileFactory
|
import org.jf.dexlib2.DexFileFactory
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -1,7 +1,7 @@
|
|||||||
package app.revanced.patcher.util.patch.implementation
|
package app.revanced.patcher.util.patch.impl
|
||||||
|
|
||||||
import app.revanced.patcher.util.patch.base.PatchBundle
|
import app.revanced.patcher.util.patch.PatchBundle
|
||||||
import app.revanced.patcher.util.patch.util.StringIterator
|
import app.revanced.patcher.util.patch.StringIterator
|
||||||
import java.net.URLClassLoader
|
import java.net.URLClassLoader
|
||||||
import java.util.jar.JarFile
|
import java.util.jar.JarFile
|
||||||
|
|
||||||
Reference in New Issue
Block a user