mirror of
https://github.com/ReVanced/revanced-cli.git
synced 2026-01-11 22:06:20 +00:00
Compare commits
15 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
a1bcd1fdaf | ||
|
|
206f2029d7 | ||
|
|
04e0027c08 | ||
|
|
e76983e01c | ||
|
|
11d67bc1ea | ||
|
|
cabd32fda4 | ||
|
|
61235d7c41 | ||
|
|
817154dd66 | ||
|
|
c76da7e5ff | ||
|
|
d946333c96 | ||
|
|
97a036bfbc | ||
|
|
153d8ce746 | ||
|
|
5cd3ea291c | ||
|
|
c8a5e97f0d | ||
|
|
329f8a383f |
1
.github/workflows/release.yml
vendored
1
.github/workflows/release.yml
vendored
@@ -1,5 +1,6 @@
|
||||
name: Release
|
||||
on:
|
||||
workflow_dispatch:
|
||||
push:
|
||||
branches:
|
||||
- main
|
||||
|
||||
2
.idea/vcs.xml
generated
2
.idea/vcs.xml
generated
@@ -8,5 +8,7 @@
|
||||
</component>
|
||||
<component name="VcsDirectoryMappings">
|
||||
<mapping directory="$PROJECT_DIR$" vcs="Git" />
|
||||
<mapping directory="$PROJECT_DIR$/../revanced-patcher" vcs="Git" />
|
||||
<mapping directory="$PROJECT_DIR$/../revanced-patches" vcs="Git" />
|
||||
</component>
|
||||
</project>
|
||||
28
CHANGELOG.md
28
CHANGELOG.md
@@ -1,3 +1,31 @@
|
||||
## [1.1.5](https://github.com/revanced/revanced-cli/compare/v1.1.4...v1.1.5) (2022-05-27)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* invalid code flow when adding patches ([206f202](https://github.com/revanced/revanced-cli/commit/206f2029d7498b6474c16a47cbe451c170fdd31f))
|
||||
|
||||
## [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)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* only accept directories when looking for files in resource patch ([c76da7e](https://github.com/revanced/revanced-cli/commit/c76da7e5ffa208860eea008dad358e4e3bb3d735))
|
||||
|
||||
## [1.1.2](https://github.com/revanced/revanced-cli/compare/v1.1.1...v1.1.2) (2022-05-22)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* delete `outputFile` after deploying ([329f8a3](https://github.com/revanced/revanced-cli/commit/329f8a383fe52f4c2a66075d893c6599d3550bee))
|
||||
|
||||
## [1.1.1](https://github.com/revanced/revanced-cli/compare/v1.1.0...v1.1.1) (2022-05-22)
|
||||
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
plugins {
|
||||
kotlin("jvm") version "1.6.20"
|
||||
kotlin("jvm") version "1.6.21"
|
||||
id("com.github.johnrengelman.shadow") version "7.1.2"
|
||||
java
|
||||
`maven-publish`
|
||||
@@ -23,15 +23,15 @@ repositories {
|
||||
}
|
||||
|
||||
dependencies {
|
||||
implementation(kotlin("stdlib"))
|
||||
implementation("app.revanced:revanced-patcher:+")
|
||||
implementation("app.revanced:revanced-patches:+")
|
||||
implementation("org.jetbrains.kotlin:kotlin-stdlib:1.6.21")
|
||||
implementation("app.revanced:revanced-patcher:1.0.0-dev.17")
|
||||
implementation("app.revanced:revanced-patches:1.0.0-dev.11")
|
||||
|
||||
implementation("info.picocli:picocli:+")
|
||||
implementation("info.picocli:picocli:4.6.3")
|
||||
|
||||
implementation("com.github.li-wjohnson:jadb:master-SNAPSHOT") // using a fork instead.
|
||||
implementation("org.bouncycastle:bcpkix-jdk15on:+")
|
||||
implementation(kotlin("reflect"))
|
||||
implementation("org.bouncycastle:bcpkix-jdk15on:1.70")
|
||||
implementation("org.jetbrains.kotlin:kotlin-reflect:1.6.21")
|
||||
}
|
||||
|
||||
java {
|
||||
@@ -68,4 +68,4 @@ publishing {
|
||||
from(components["java"])
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,2 +1,2 @@
|
||||
kotlin.code.style = official
|
||||
version = 1.1.1
|
||||
version = 1.1.5
|
||||
|
||||
2
gradle/wrapper/gradle-wrapper.properties
vendored
2
gradle/wrapper/gradle-wrapper.properties
vendored
@@ -1,5 +1,5 @@
|
||||
distributionBase=GRADLE_USER_HOME
|
||||
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
|
||||
zipStorePath=wrapper/dists
|
||||
|
||||
@@ -2,7 +2,7 @@ package app.revanced.cli
|
||||
|
||||
import app.revanced.patcher.annotation.Name
|
||||
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.patcher.addPatchesFiltered
|
||||
import app.revanced.utils.signature.Signature
|
||||
@@ -20,7 +20,7 @@ internal object MainCommand : Runnable {
|
||||
internal var includedPatches = arrayOf<String>()
|
||||
|
||||
@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)
|
||||
internal lateinit var cacheDirectory: String
|
||||
@@ -54,13 +54,13 @@ internal object MainCommand : Runnable {
|
||||
|
||||
override fun run() {
|
||||
if (listOnly) {
|
||||
for (patchBundle in patchBundles)
|
||||
for (it in PatchLoader.loadFromFile(patchBundle))
|
||||
for (patchBundlePath in patchBundles)
|
||||
for (it in JarPatchBundle(patchBundlePath).loadPatches())
|
||||
println(
|
||||
"[available] ${
|
||||
it.javaClass.findAnnotationRecursively(
|
||||
it.findAnnotationRecursively(
|
||||
Name::class.java
|
||||
)?.name ?: Name::class.java.name
|
||||
)?.name ?: it::class.java.name
|
||||
}"
|
||||
)
|
||||
return
|
||||
@@ -87,11 +87,10 @@ internal object MainCommand : Runnable {
|
||||
|
||||
Patcher.start(patcher)
|
||||
|
||||
if (clean) {
|
||||
File(cacheDirectory).deleteRecursively()
|
||||
outputFile.delete()
|
||||
}
|
||||
if (clean) File(cacheDirectory).deleteRecursively()
|
||||
|
||||
adb?.deploy()
|
||||
|
||||
if (clean) outputFile.delete()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6,6 +6,7 @@ import app.revanced.utils.patcher.applyPatchesPrint
|
||||
import app.revanced.utils.patcher.mergeFiles
|
||||
import app.revanced.utils.signing.Signer
|
||||
import java.io.File
|
||||
import java.io.FileFilter
|
||||
|
||||
internal class Patcher {
|
||||
internal companion object {
|
||||
@@ -30,7 +31,7 @@ internal class Patcher {
|
||||
}
|
||||
|
||||
if (MainCommand.patchResources) {
|
||||
for (file in File(MainCommand.cacheDirectory).resolve("build/").listFiles()?.first()?.listFiles()!!) {
|
||||
for (file in File(MainCommand.cacheDirectory).resolve("build/").listFiles(FileFilter { it.isDirectory })?.first()?.listFiles()!!) {
|
||||
if (!file.isDirectory) {
|
||||
zipFileSystem.replaceFile(file.name, file.readBytes())
|
||||
continue
|
||||
|
||||
@@ -1,2 +0,0 @@
|
||||
package app.revanced.patch
|
||||
|
||||
@@ -7,7 +7,7 @@ import app.revanced.patcher.annotation.Name
|
||||
import app.revanced.patcher.data.base.Data
|
||||
import app.revanced.patcher.extensions.findAnnotationRecursively
|
||||
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(
|
||||
packageCompatibilityFilter: Boolean = true,
|
||||
@@ -19,12 +19,12 @@ fun Patcher.addPatchesFiltered(
|
||||
|
||||
MainCommand.patchBundles.forEach { bundle ->
|
||||
val includedPatches = mutableListOf<Patch<Data>>()
|
||||
PatchLoader.loadFromFile(bundle).forEach patch@{ p ->
|
||||
JarPatchBundle(bundle).loadPatches().forEach patch@{ p ->
|
||||
val patch = p.getDeclaredConstructor().newInstance()
|
||||
|
||||
val compatibilityAnnotation = patch.javaClass.findAnnotationRecursively(Compatibility::class.java)
|
||||
|
||||
val patchName = patch.javaClass.findAnnotationRecursively(Name::class.java)?.name ?: Name::class.java.name
|
||||
val patchName = patch.javaClass.findAnnotationRecursively(Name::class.java)?.name ?: patch.javaClass.name
|
||||
|
||||
val prefix = "[skipped] $patchName"
|
||||
|
||||
@@ -41,15 +41,16 @@ fun Patcher.addPatchesFiltered(
|
||||
}
|
||||
|
||||
|
||||
for (compatiblePackage in compatibilityAnnotation.compatiblePackages) {
|
||||
compatibilityAnnotation.compatiblePackages.forEach { compatiblePackage ->
|
||||
if (packageCompatibilityFilter && compatiblePackage.name != packageName) {
|
||||
println("$prefix: Package name not matching ${compatiblePackage.name}.")
|
||||
return@patch
|
||||
}
|
||||
|
||||
if (!packageVersionCompatibilityFilter || compatiblePackage.versions.any { it == packageVersion }) continue
|
||||
println("$prefix: Unsupported version.")
|
||||
return@patch
|
||||
if (packageVersionCompatibilityFilter && !compatiblePackage.versions.any { it == packageVersion }) {
|
||||
println("$prefix: Unsupported version.")
|
||||
return@patch
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -61,8 +62,13 @@ fun Patcher.addPatchesFiltered(
|
||||
}
|
||||
|
||||
fun Patcher.applyPatchesPrint() {
|
||||
for ((patch, result) in this.applyPatches()) {
|
||||
println("[${if (result.isFailure) "error" else "success"}] $patch")
|
||||
this.applyPatches().forEach { (patch, result) ->
|
||||
if (result.isSuccess) {
|
||||
println("[success] $patch")
|
||||
return@forEach
|
||||
}
|
||||
println("[error] $patch:")
|
||||
result.exceptionOrNull()!!.printStackTrace()
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user