mirror of
https://github.com/ReVanced/revanced-cli.git
synced 2026-01-18 17:03:58 +00:00
Compare commits
4 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
04e0027c08 | ||
|
|
e76983e01c | ||
|
|
11d67bc1ea | ||
|
|
cabd32fda4 |
@@ -1,3 +1,10 @@
|
|||||||
|
## [1.1.4](https://github.com/revanced/revanced-cli/compare/v1.1.3...v1.1.4) (2022-05-26)
|
||||||
|
|
||||||
|
|
||||||
|
### Bug Fixes
|
||||||
|
|
||||||
|
* migrate from `PatchLoader.load(...)` to `JarPatchBundle(...).loadPatches()` ([cabd32f](https://github.com/revanced/revanced-cli/commit/cabd32fda41d32616a61ae450c60e1ee7c35bc59))
|
||||||
|
|
||||||
## [1.1.3](https://github.com/revanced/revanced-cli/compare/v1.1.2...v1.1.3) (2022-05-25)
|
## [1.1.3](https://github.com/revanced/revanced-cli/compare/v1.1.2...v1.1.3) (2022-05-25)
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -24,8 +24,8 @@ repositories {
|
|||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
implementation("org.jetbrains.kotlin:kotlin-stdlib:1.6.21")
|
implementation("org.jetbrains.kotlin:kotlin-stdlib:1.6.21")
|
||||||
implementation("app.revanced:revanced-patcher:+")
|
implementation("app.revanced:revanced-patcher:1.0.0-dev.16")
|
||||||
implementation("app.revanced:revanced-patches:+")
|
implementation("app.revanced:revanced-patches:1.0.0-dev.11")
|
||||||
|
|
||||||
implementation("info.picocli:picocli:4.6.3")
|
implementation("info.picocli:picocli:4.6.3")
|
||||||
|
|
||||||
|
|||||||
@@ -1,2 +1,2 @@
|
|||||||
kotlin.code.style = official
|
kotlin.code.style = official
|
||||||
version = 1.1.3
|
version = 1.1.4
|
||||||
|
|||||||
2
gradle/wrapper/gradle-wrapper.properties
vendored
2
gradle/wrapper/gradle-wrapper.properties
vendored
@@ -1,5 +1,5 @@
|
|||||||
distributionBase=GRADLE_USER_HOME
|
distributionBase=GRADLE_USER_HOME
|
||||||
distributionPath=wrapper/dists
|
distributionPath=wrapper/dists
|
||||||
distributionUrl=https\://services.gradle.org/distributions/gradle-7.1.1-bin.zip
|
distributionUrl=https\://services.gradle.org/distributions/gradle-7.4.2-all.zip
|
||||||
zipStoreBase=GRADLE_USER_HOME
|
zipStoreBase=GRADLE_USER_HOME
|
||||||
zipStorePath=wrapper/dists
|
zipStorePath=wrapper/dists
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ package app.revanced.cli
|
|||||||
|
|
||||||
import app.revanced.patcher.annotation.Name
|
import app.revanced.patcher.annotation.Name
|
||||||
import app.revanced.patcher.extensions.findAnnotationRecursively
|
import app.revanced.patcher.extensions.findAnnotationRecursively
|
||||||
import app.revanced.patcher.util.patch.PatchLoader
|
import app.revanced.patcher.util.patch.implementation.JarPatchBundle
|
||||||
import app.revanced.utils.adb.Adb
|
import app.revanced.utils.adb.Adb
|
||||||
import app.revanced.utils.patcher.addPatchesFiltered
|
import app.revanced.utils.patcher.addPatchesFiltered
|
||||||
import app.revanced.utils.signature.Signature
|
import app.revanced.utils.signature.Signature
|
||||||
@@ -20,7 +20,7 @@ internal object MainCommand : Runnable {
|
|||||||
internal var includedPatches = arrayOf<String>()
|
internal var includedPatches = arrayOf<String>()
|
||||||
|
|
||||||
@Option(names = ["-p", "--patches"], description = ["One or more bundles of patches"])
|
@Option(names = ["-p", "--patches"], description = ["One or more bundles of patches"])
|
||||||
internal var patchBundles = arrayOf<File>()
|
internal var patchBundles = arrayOf<String>()
|
||||||
|
|
||||||
@Option(names = ["-t", "--temp-dir"], description = ["Temporal resource cache directory"], required = true)
|
@Option(names = ["-t", "--temp-dir"], description = ["Temporal resource cache directory"], required = true)
|
||||||
internal lateinit var cacheDirectory: String
|
internal lateinit var cacheDirectory: String
|
||||||
@@ -54,8 +54,8 @@ internal object MainCommand : Runnable {
|
|||||||
|
|
||||||
override fun run() {
|
override fun run() {
|
||||||
if (listOnly) {
|
if (listOnly) {
|
||||||
for (patchBundle in patchBundles)
|
for (patchBundlePath in patchBundles)
|
||||||
for (it in PatchLoader.loadFromFile(patchBundle))
|
for (it in JarPatchBundle(patchBundlePath).loadPatches())
|
||||||
println(
|
println(
|
||||||
"[available] ${
|
"[available] ${
|
||||||
it.javaClass.findAnnotationRecursively(
|
it.javaClass.findAnnotationRecursively(
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ import app.revanced.patcher.annotation.Name
|
|||||||
import app.revanced.patcher.data.base.Data
|
import app.revanced.patcher.data.base.Data
|
||||||
import app.revanced.patcher.extensions.findAnnotationRecursively
|
import app.revanced.patcher.extensions.findAnnotationRecursively
|
||||||
import app.revanced.patcher.patch.base.Patch
|
import app.revanced.patcher.patch.base.Patch
|
||||||
import app.revanced.patcher.util.patch.PatchLoader
|
import app.revanced.patcher.util.patch.implementation.JarPatchBundle
|
||||||
|
|
||||||
fun Patcher.addPatchesFiltered(
|
fun Patcher.addPatchesFiltered(
|
||||||
packageCompatibilityFilter: Boolean = true,
|
packageCompatibilityFilter: Boolean = true,
|
||||||
@@ -19,7 +19,7 @@ fun Patcher.addPatchesFiltered(
|
|||||||
|
|
||||||
MainCommand.patchBundles.forEach { bundle ->
|
MainCommand.patchBundles.forEach { bundle ->
|
||||||
val includedPatches = mutableListOf<Patch<Data>>()
|
val includedPatches = mutableListOf<Patch<Data>>()
|
||||||
PatchLoader.loadFromFile(bundle).forEach patch@{ p ->
|
JarPatchBundle(bundle).loadPatches().forEach patch@{ p ->
|
||||||
val patch = p.getDeclaredConstructor().newInstance()
|
val patch = p.getDeclaredConstructor().newInstance()
|
||||||
|
|
||||||
val compatibilityAnnotation = patch.javaClass.findAnnotationRecursively(Compatibility::class.java)
|
val compatibilityAnnotation = patch.javaClass.findAnnotationRecursively(Compatibility::class.java)
|
||||||
@@ -41,13 +41,13 @@ fun Patcher.addPatchesFiltered(
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
for (compatiblePackage in compatibilityAnnotation.compatiblePackages) {
|
compatibilityAnnotation.compatiblePackages.forEach { compatiblePackage ->
|
||||||
if (packageCompatibilityFilter && compatiblePackage.name != packageName) {
|
if (packageCompatibilityFilter && compatiblePackage.name != packageName) {
|
||||||
println("$prefix: Package name not matching ${compatiblePackage.name}.")
|
println("$prefix: Package name not matching ${compatiblePackage.name}.")
|
||||||
return@patch
|
return@patch
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!packageVersionCompatibilityFilter || compatiblePackage.versions.any { it == packageVersion }) continue
|
if (!packageVersionCompatibilityFilter || compatiblePackage.versions.any { it == packageVersion }) return@patch
|
||||||
println("$prefix: Unsupported version.")
|
println("$prefix: Unsupported version.")
|
||||||
return@patch
|
return@patch
|
||||||
}
|
}
|
||||||
@@ -61,8 +61,13 @@ fun Patcher.addPatchesFiltered(
|
|||||||
}
|
}
|
||||||
|
|
||||||
fun Patcher.applyPatchesPrint() {
|
fun Patcher.applyPatchesPrint() {
|
||||||
for ((patch, result) in this.applyPatches()) {
|
this.applyPatches().forEach { (patch, result) ->
|
||||||
println("[${if (result.isFailure) "error" else "success"}] $patch")
|
if (result.isSuccess) {
|
||||||
|
println("[success] $patch")
|
||||||
|
return@forEach
|
||||||
|
}
|
||||||
|
println("[error] $patch:")
|
||||||
|
result.exceptionOrNull()!!.printStackTrace()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user