You've already forked revanced-patcher
mirror of
https://github.com/revanced/revanced-patcher
synced 2025-09-13 18:30:49 +02:00
Compare commits
10 Commits
v14.2.0
...
v14.2.2-de
Author | SHA1 | Date | |
---|---|---|---|
![]() |
9818d730e4 | ||
![]() |
11a3378659 | ||
![]() |
1bb05f22d3 | ||
![]() |
26b70554c4 | ||
![]() |
93b29d2e83 | ||
![]() |
072986374a | ||
![]() |
2c590d212a | ||
![]() |
6cc863efb3 | ||
![]() |
b832812767 | ||
![]() |
c44558cacd |
2
.github/workflows/release.yml
vendored
2
.github/workflows/release.yml
vendored
@@ -36,7 +36,7 @@ jobs:
|
|||||||
- name: Build with Gradle
|
- name: Build with Gradle
|
||||||
env:
|
env:
|
||||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
run: ./gradlew clean --no-daemon
|
run: ./gradlew build clean --no-daemon
|
||||||
- name: Setup semantic-release
|
- name: Setup semantic-release
|
||||||
run: npm install
|
run: npm install
|
||||||
- name: Release
|
- name: Release
|
||||||
|
21
CHANGELOG.md
21
CHANGELOG.md
@@ -1,3 +1,24 @@
|
|||||||
|
## [14.2.2-dev.1](https://github.com/ReVanced/revanced-patcher/compare/v14.2.1...v14.2.2-dev.1) (2023-08-29)
|
||||||
|
|
||||||
|
|
||||||
|
### Bug Fixes
|
||||||
|
|
||||||
|
* allow setting `DexClassLoader.optimizedDirectory` ([11a3378](https://github.com/ReVanced/revanced-patcher/commit/11a337865947a6ac74a63ebb3f3f9bc2610f7771))
|
||||||
|
|
||||||
|
## [14.2.1](https://github.com/ReVanced/revanced-patcher/compare/v14.2.0...v14.2.1) (2023-08-27)
|
||||||
|
|
||||||
|
|
||||||
|
### Bug Fixes
|
||||||
|
|
||||||
|
* do not flag resource table as sparse when main package is not loaded ([b832812](https://github.com/ReVanced/revanced-patcher/commit/b832812767a06ec6ec232291e6d14c8c2f14118c))
|
||||||
|
|
||||||
|
## [14.2.1-dev.1](https://github.com/ReVanced/revanced-patcher/compare/v14.2.0...v14.2.1-dev.1) (2023-08-27)
|
||||||
|
|
||||||
|
|
||||||
|
### Bug Fixes
|
||||||
|
|
||||||
|
* do not flag resource table as sparse when main package is not loaded ([b832812](https://github.com/ReVanced/revanced-patcher/commit/b832812767a06ec6ec232291e6d14c8c2f14118c))
|
||||||
|
|
||||||
# [14.2.0](https://github.com/ReVanced/revanced-patcher/compare/v14.1.0...v14.2.0) (2023-08-27)
|
# [14.2.0](https://github.com/ReVanced/revanced-patcher/compare/v14.1.0...v14.2.0) (2023-08-27)
|
||||||
|
|
||||||
|
|
||||||
|
843
api/revanced-patcher.api
Normal file
843
api/revanced-patcher.api
Normal file
File diff suppressed because it is too large
Load Diff
@@ -1,6 +1,7 @@
|
|||||||
plugins {
|
plugins {
|
||||||
kotlin("jvm") version "1.8.20"
|
kotlin("jvm") version "1.8.20"
|
||||||
`maven-publish`
|
`maven-publish`
|
||||||
|
alias(libs.plugins.binary.compatibility.validator)
|
||||||
}
|
}
|
||||||
|
|
||||||
group = "app.revanced"
|
group = "app.revanced"
|
||||||
|
@@ -1,4 +1,4 @@
|
|||||||
org.gradle.parallel = true
|
org.gradle.parallel = true
|
||||||
org.gradle.caching = true
|
org.gradle.caching = true
|
||||||
kotlin.code.style = official
|
kotlin.code.style = official
|
||||||
version = 14.2.0
|
version = 14.2.2-dev.1
|
||||||
|
@@ -1,14 +1,13 @@
|
|||||||
[versions]
|
[versions]
|
||||||
android = "4.1.1.4"
|
android = "4.1.1.4"
|
||||||
kotlin-reflect = "1.9.0"
|
kotlin-reflect = "1.9.0"
|
||||||
apktool-lib = "2.8.2-5"
|
apktool-lib = "2.8.2-6"
|
||||||
kotlin-test = "1.8.20-RC"
|
kotlin-test = "1.8.20-RC"
|
||||||
kotlinx-coroutines-core = "1.7.1"
|
kotlinx-coroutines-core = "1.7.1"
|
||||||
multidexlib2 = "3.0.3.r2"
|
multidexlib2 = "3.0.3.r2"
|
||||||
shadow = "8.1.1"
|
|
||||||
smali = "3.0.3"
|
smali = "3.0.3"
|
||||||
xpp3 = "1.1.4c"
|
xpp3 = "1.1.4c"
|
||||||
|
binary-compatibility-validator = "0.13.2"
|
||||||
|
|
||||||
[libraries]
|
[libraries]
|
||||||
android = { module = "com.google.android:android", version.ref = "android" }
|
android = { module = "com.google.android:android", version.ref = "android" }
|
||||||
@@ -19,3 +18,6 @@ kotlinx-coroutines-core = { module = "org.jetbrains.kotlinx:kotlinx-coroutines-c
|
|||||||
multidexlib2 = { module = "app.revanced:multidexlib2", version.ref = "multidexlib2" }
|
multidexlib2 = { module = "app.revanced:multidexlib2", version.ref = "multidexlib2" }
|
||||||
smali = { module = "com.android.tools.smali:smali", version.ref = "smali" }
|
smali = { module = "com.android.tools.smali:smali", version.ref = "smali" }
|
||||||
xpp3 = { module = "xpp3:xpp3", version.ref = "xpp3" }
|
xpp3 = { module = "xpp3:xpp3", version.ref = "xpp3" }
|
||||||
|
|
||||||
|
[plugins]
|
||||||
|
binary-compatibility-validator = { id = "org.jetbrains.kotlinx.binary-compatibility-validator", version.ref = "binary-compatibility-validator" }
|
||||||
|
@@ -16,6 +16,7 @@ import java.util.jar.JarFile
|
|||||||
/**
|
/**
|
||||||
* A patch bundle.
|
* A patch bundle.
|
||||||
*
|
*
|
||||||
|
*
|
||||||
* @param fromClasses The classes to get [Patch]es from.
|
* @param fromClasses The classes to get [Patch]es from.
|
||||||
*/
|
*/
|
||||||
sealed class PatchBundleLoader private constructor(
|
sealed class PatchBundleLoader private constructor(
|
||||||
@@ -39,8 +40,10 @@ sealed class PatchBundleLoader private constructor(
|
|||||||
*
|
*
|
||||||
* @param patchBundles The path to patch bundles of JAR format.
|
* @param patchBundles The path to patch bundles of JAR format.
|
||||||
*/
|
*/
|
||||||
class Jar(vararg patchBundles: File) :
|
class Jar(vararg patchBundles: File) : PatchBundleLoader(
|
||||||
PatchBundleLoader(with(URLClassLoader(patchBundles.map { it.toURI().toURL() }.toTypedArray())) {
|
with(
|
||||||
|
URLClassLoader(patchBundles.map { it.toURI().toURL() }.toTypedArray())
|
||||||
|
) {
|
||||||
patchBundles.flatMap { patchBundle ->
|
patchBundles.flatMap { patchBundle ->
|
||||||
// Get the names of all classes in the DEX file.
|
// Get the names of all classes in the DEX file.
|
||||||
|
|
||||||
@@ -55,20 +58,25 @@ sealed class PatchBundleLoader private constructor(
|
|||||||
* A [PatchBundleLoader] for [Dex] files.
|
* A [PatchBundleLoader] for [Dex] files.
|
||||||
*
|
*
|
||||||
* @param patchBundles The path to patch bundles of DEX format.
|
* @param patchBundles The path to patch bundles of DEX format.
|
||||||
|
* @param optimizedDexDirectory The directory to store optimized DEX files in.
|
||||||
|
* This parameter is deprecated and has no effect since API level 26.
|
||||||
*/
|
*/
|
||||||
class Dex(vararg patchBundles: File) : PatchBundleLoader(with(
|
class Dex(vararg patchBundles: File, optimizedDexDirectory: File? = null) : PatchBundleLoader(
|
||||||
DexClassLoader(
|
with(
|
||||||
patchBundles.joinToString(File.pathSeparator) { it.absolutePath },
|
DexClassLoader(
|
||||||
null,
|
patchBundles.joinToString(File.pathSeparator) { it.absolutePath }, optimizedDexDirectory?.absolutePath,
|
||||||
null,
|
null,
|
||||||
PatchBundleLoader::class.java.classLoader
|
PatchBundleLoader::class.java.classLoader
|
||||||
)
|
)
|
||||||
) {
|
) {
|
||||||
patchBundles
|
patchBundles
|
||||||
.flatMap {
|
.flatMap {
|
||||||
MultiDexIO.readDexFile(true, it, BasicDexFileNamer(), null, null).classes
|
MultiDexIO.readDexFile(true, it, BasicDexFileNamer(), null, null).classes
|
||||||
}
|
}
|
||||||
.map { classDef -> classDef.type.substring(1, classDef.length - 1) }
|
.map { classDef -> classDef.type.substring(1, classDef.length - 1) }
|
||||||
.map { loadClass(it) }
|
.map { loadClass(it) }
|
||||||
})
|
}) {
|
||||||
|
@Deprecated("This constructor is deprecated. Use the constructor with the second parameter instead.")
|
||||||
|
constructor(vararg patchBundles: File) : this(*patchBundles, optimizedDexDirectory = null)
|
||||||
|
}
|
||||||
}
|
}
|
@@ -83,6 +83,16 @@ class ResourceContext internal constructor(
|
|||||||
versionInfo.let {
|
versionInfo.let {
|
||||||
metadata.packageVersion = it.versionName ?: it.versionCode
|
metadata.packageVersion = it.versionName ?: it.versionCode
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
The ResTable if flagged as sparse if the main package is not loaded, which is the case here,
|
||||||
|
because ResourcesDecoder.decodeResources loads the main package
|
||||||
|
and not XmlPullStreamDecoder.decodeManifest.
|
||||||
|
See ARSCDecoder.readTableType for more info.
|
||||||
|
|
||||||
|
Set this to false again to prevent the ResTable from being flagged as sparse falsely.
|
||||||
|
*/
|
||||||
|
metadata.apkInfo.sparseResources = false
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -3,7 +3,9 @@ package app.revanced.patcher.patch
|
|||||||
import app.revanced.patcher.usage.bytecode.ExampleBytecodePatch
|
import app.revanced.patcher.usage.bytecode.ExampleBytecodePatch
|
||||||
import org.junit.jupiter.api.Test
|
import org.junit.jupiter.api.Test
|
||||||
import org.junit.jupiter.api.assertThrows
|
import org.junit.jupiter.api.assertThrows
|
||||||
|
import kotlin.test.assertEquals
|
||||||
import kotlin.test.assertNotEquals
|
import kotlin.test.assertNotEquals
|
||||||
|
import kotlin.test.assertNotNull
|
||||||
|
|
||||||
internal class PatchOptionsTest {
|
internal class PatchOptionsTest {
|
||||||
private val options = ExampleBytecodePatch.options
|
private val options = ExampleBytecodePatch.options
|
||||||
@@ -23,14 +25,14 @@ internal class PatchOptionsTest {
|
|||||||
is PatchOption.StringListOption -> {
|
is PatchOption.StringListOption -> {
|
||||||
option.value = option.options.first()
|
option.value = option.options.first()
|
||||||
for (choice in option.options) {
|
for (choice in option.options) {
|
||||||
println(choice)
|
assertNotNull(choice)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
is PatchOption.IntListOption -> {
|
is PatchOption.IntListOption -> {
|
||||||
option.value = option.options.first()
|
option.value = option.options.first()
|
||||||
for (choice in option.options) {
|
for (choice in option.options) {
|
||||||
println(choice)
|
assertNotNull(choice)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -38,9 +40,9 @@ internal class PatchOptionsTest {
|
|||||||
val option = options.get<String>("key1")
|
val option = options.get<String>("key1")
|
||||||
// or: val option: String? by options["key1"]
|
// or: val option: String? by options["key1"]
|
||||||
// then you won't need `.value` every time
|
// then you won't need `.value` every time
|
||||||
println(option.value)
|
assertEquals("Hello World", option.value)
|
||||||
options["key1"] = "Hello, world!"
|
options["key1"] = "Hello, world!"
|
||||||
println(option.value)
|
assertEquals("Hello, world!", option.value)
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@@ -101,7 +103,7 @@ internal class PatchOptionsTest {
|
|||||||
@Test
|
@Test
|
||||||
fun `should fail because getting a non-initialized option is illegal`() {
|
fun `should fail because getting a non-initialized option is illegal`() {
|
||||||
assertThrows<RequirementNotMetException> {
|
assertThrows<RequirementNotMetException> {
|
||||||
println(options["key5"].value)
|
options["key5"].value
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
Reference in New Issue
Block a user