mirror of
https://github.com/ReVanced/revanced-cli.git
synced 2026-01-11 22:06:20 +00:00
Compare commits
29 Commits
v2.17.1-de
...
v2.20.0-de
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
1957a2c4ff | ||
|
|
07a423b19e | ||
|
|
31e4a41dd2 | ||
|
|
8284c1048f | ||
|
|
9c64f5ec3e | ||
|
|
f4c447e71b | ||
|
|
b69e784785 | ||
|
|
ccce9c926d | ||
|
|
dc4ab22f41 | ||
|
|
25d8ad4aaf | ||
|
|
3d9436e691 | ||
|
|
ee70423527 | ||
|
|
d5794b94ca | ||
|
|
3160d894da | ||
|
|
545597959a | ||
|
|
a6db0edc70 | ||
|
|
ff0d3dd224 | ||
|
|
d9a1fd33ed | ||
|
|
ad81a1b656 | ||
|
|
8c2aeff2cf | ||
|
|
eb6c659f5b | ||
|
|
bac4f839c9 | ||
|
|
c1e7215d31 | ||
|
|
18d132123f | ||
|
|
74d73ca3a7 | ||
|
|
ae91b0d597 | ||
|
|
1a67cd81da | ||
|
|
9b9fad7cc0 | ||
|
|
1620305b4a |
2
.github/workflows/pull_request.yml
vendored
2
.github/workflows/pull_request.yml
vendored
@@ -7,7 +7,7 @@ on:
|
|||||||
workflow_dispatch:
|
workflow_dispatch:
|
||||||
|
|
||||||
env:
|
env:
|
||||||
MESSAGE: merge branch \`${{ github.head_ref || github.ref_name }}\` to \`main\`
|
MESSAGE: merge branch `${{ github.head_ref || github.ref_name }}` to `main`
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
pull-request:
|
pull-request:
|
||||||
|
|||||||
@@ -7,11 +7,7 @@
|
|||||||
}
|
}
|
||||||
],
|
],
|
||||||
"plugins": [
|
"plugins": [
|
||||||
["@semantic-release/commit-analyzer", {
|
"@semantic-release/commit-analyzer",
|
||||||
"releaseRules": [
|
|
||||||
{"type": "build", "release": "patch"}
|
|
||||||
]
|
|
||||||
}],
|
|
||||||
"@semantic-release/release-notes-generator",
|
"@semantic-release/release-notes-generator",
|
||||||
"@semantic-release/changelog",
|
"@semantic-release/changelog",
|
||||||
"gradle-semantic-release-plugin",
|
"gradle-semantic-release-plugin",
|
||||||
|
|||||||
93
CHANGELOG.md
93
CHANGELOG.md
@@ -1,3 +1,96 @@
|
|||||||
|
# [2.20.0-dev.1](https://github.com/revanced/revanced-cli/compare/v2.19.0...v2.20.0-dev.1) (2023-01-01)
|
||||||
|
|
||||||
|
|
||||||
|
### Bug Fixes
|
||||||
|
|
||||||
|
* do not list compatible packages if patches do not define them ([31e4a41](https://github.com/revanced/revanced-cli/commit/31e4a41dd20f5fa62f840cd8e3b92fe0814eda87))
|
||||||
|
|
||||||
|
|
||||||
|
### Features
|
||||||
|
|
||||||
|
* remove option `--with-descriptions` ([07a423b](https://github.com/revanced/revanced-cli/commit/07a423b19ec72e9f020aeb0222f4ced571036dbe))
|
||||||
|
|
||||||
|
# [2.19.0](https://github.com/revanced/revanced-cli/compare/v2.18.2...v2.19.0) (2022-12-31)
|
||||||
|
|
||||||
|
|
||||||
|
### Features
|
||||||
|
|
||||||
|
* improve description of options ([#185](https://github.com/revanced/revanced-cli/issues/185)) ([b69e784](https://github.com/revanced/revanced-cli/commit/b69e784785f7f262f83b35c4f241c90036169fc7))
|
||||||
|
|
||||||
|
# [2.19.0-dev.1](https://github.com/revanced/revanced-cli/compare/v2.18.2...v2.19.0-dev.1) (2022-12-31)
|
||||||
|
|
||||||
|
|
||||||
|
### Features
|
||||||
|
|
||||||
|
* improve description of options ([#185](https://github.com/revanced/revanced-cli/issues/185)) ([b69e784](https://github.com/revanced/revanced-cli/commit/b69e784785f7f262f83b35c4f241c90036169fc7))
|
||||||
|
|
||||||
|
## [2.18.2](https://github.com/revanced/revanced-cli/compare/v2.18.1...v2.18.2) (2022-12-16)
|
||||||
|
|
||||||
|
|
||||||
|
### Bug Fixes
|
||||||
|
|
||||||
|
* exclude patcher dependency from minimizing ([d5794b9](https://github.com/revanced/revanced-cli/commit/d5794b94ca19c9287190a3b863c97a089893cc07))
|
||||||
|
|
||||||
|
## [2.18.2-dev.1](https://github.com/revanced/revanced-cli/compare/v2.18.1...v2.18.2-dev.1) (2022-12-16)
|
||||||
|
|
||||||
|
|
||||||
|
### Bug Fixes
|
||||||
|
|
||||||
|
* exclude patcher dependency from minimizing ([d5794b9](https://github.com/revanced/revanced-cli/commit/d5794b94ca19c9287190a3b863c97a089893cc07))
|
||||||
|
|
||||||
|
## [2.18.1](https://github.com/revanced/revanced-cli/compare/v2.18.0...v2.18.1) (2022-12-15)
|
||||||
|
|
||||||
|
|
||||||
|
### Bug Fixes
|
||||||
|
|
||||||
|
* don't log when package is incompatible and `exclusive` option is used ([ad81a1b](https://github.com/revanced/revanced-cli/commit/ad81a1b656586226f8b7b8d1123c52b0f3f2e6f7))
|
||||||
|
|
||||||
|
## [2.18.1-dev.1](https://github.com/revanced/revanced-cli/compare/v2.18.0...v2.18.1-dev.1) (2022-12-15)
|
||||||
|
|
||||||
|
|
||||||
|
### Bug Fixes
|
||||||
|
|
||||||
|
* don't log when package is incompatible and `exclusive` option is used ([ad81a1b](https://github.com/revanced/revanced-cli/commit/ad81a1b656586226f8b7b8d1123c52b0f3f2e6f7))
|
||||||
|
|
||||||
|
# [2.18.0](https://github.com/revanced/revanced-cli/compare/v2.17.0...v2.18.0) (2022-12-15)
|
||||||
|
|
||||||
|
|
||||||
|
### Bug Fixes
|
||||||
|
|
||||||
|
* start with uppercase in log message ([ae91b0d](https://github.com/revanced/revanced-cli/commit/ae91b0d597b107a152e1b630b8c16a795a7ca3b3))
|
||||||
|
* use correct prefix in log message ([1a67cd8](https://github.com/revanced/revanced-cli/commit/1a67cd81da5ed7f259b6dbaeb66a7eef4a113034))
|
||||||
|
|
||||||
|
|
||||||
|
### Features
|
||||||
|
|
||||||
|
* simplify log message ([74d73ca](https://github.com/revanced/revanced-cli/commit/74d73ca3a7ba2f5da872fe9a241629e1c143cd4e))
|
||||||
|
|
||||||
|
# [2.18.0](https://github.com/revanced/revanced-cli/compare/v2.17.0...v2.18.0) (2022-12-15)
|
||||||
|
|
||||||
|
|
||||||
|
### Bug Fixes
|
||||||
|
|
||||||
|
* start with uppercase in log message ([ae91b0d](https://github.com/revanced/revanced-cli/commit/ae91b0d597b107a152e1b630b8c16a795a7ca3b3))
|
||||||
|
* use correct prefix in log message ([1a67cd8](https://github.com/revanced/revanced-cli/commit/1a67cd81da5ed7f259b6dbaeb66a7eef4a113034))
|
||||||
|
|
||||||
|
|
||||||
|
### Features
|
||||||
|
|
||||||
|
* simplify log message ([74d73ca](https://github.com/revanced/revanced-cli/commit/74d73ca3a7ba2f5da872fe9a241629e1c143cd4e))
|
||||||
|
|
||||||
|
# [2.18.0-dev.1](https://github.com/revanced/revanced-cli/compare/v2.17.1-dev.2...v2.18.0-dev.1) (2022-12-15)
|
||||||
|
|
||||||
|
|
||||||
|
### Bug Fixes
|
||||||
|
|
||||||
|
* start with uppercase in log message ([ae91b0d](https://github.com/revanced/revanced-cli/commit/ae91b0d597b107a152e1b630b8c16a795a7ca3b3))
|
||||||
|
* use correct prefix in log message ([1a67cd8](https://github.com/revanced/revanced-cli/commit/1a67cd81da5ed7f259b6dbaeb66a7eef4a113034))
|
||||||
|
|
||||||
|
|
||||||
|
### Features
|
||||||
|
|
||||||
|
* simplify log message ([74d73ca](https://github.com/revanced/revanced-cli/commit/74d73ca3a7ba2f5da872fe9a241629e1c143cd4e))
|
||||||
|
|
||||||
## [2.17.1-dev.2](https://github.com/revanced/revanced-cli/compare/v2.17.1-dev.1...v2.17.1-dev.2) (2022-12-15)
|
## [2.17.1-dev.2](https://github.com/revanced/revanced-cli/compare/v2.17.1-dev.1...v2.17.1-dev.2) (2022-12-15)
|
||||||
|
|
||||||
## [2.17.1-dev.1](https://github.com/revanced/revanced-cli/compare/v2.17.0...v2.17.1-dev.1) (2022-12-15)
|
## [2.17.1-dev.1](https://github.com/revanced/revanced-cli/compare/v2.17.0...v2.17.1-dev.1) (2022-12-15)
|
||||||
|
|||||||
@@ -25,10 +25,10 @@ repositories {
|
|||||||
dependencies {
|
dependencies {
|
||||||
implementation(kotlin("reflect"))
|
implementation(kotlin("reflect"))
|
||||||
|
|
||||||
implementation("app.revanced:revanced-patcher:6.3.1")
|
implementation("app.revanced:revanced-patcher:6.3.2")
|
||||||
implementation("info.picocli:picocli:4.7.0")
|
implementation("info.picocli:picocli:4.7.0")
|
||||||
implementation("com.android.tools.build:apksig:7.2.1")
|
|
||||||
implementation("com.github.revanced:jadb:master-SNAPSHOT") // updated fork
|
implementation("com.github.revanced:jadb:master-SNAPSHOT") // updated fork
|
||||||
|
implementation("com.android.tools.build:apksig:7.2.1")
|
||||||
implementation("org.bouncycastle:bcpkix-jdk15on:1.70")
|
implementation("org.bouncycastle:bcpkix-jdk15on:1.70")
|
||||||
implementation("cc.ekblad:4koma:1.1.0")
|
implementation("cc.ekblad:4koma:1.1.0")
|
||||||
}
|
}
|
||||||
@@ -43,6 +43,8 @@ tasks {
|
|||||||
}
|
}
|
||||||
minimize {
|
minimize {
|
||||||
exclude(dependency("org.jetbrains.kotlin:.*"))
|
exclude(dependency("org.jetbrains.kotlin:.*"))
|
||||||
|
exclude(dependency("org.bouncycastle:.*"))
|
||||||
|
exclude(dependency("app.revanced:.*"))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// Dummy task to fix the Gradle semantic-release plugin.
|
// Dummy task to fix the Gradle semantic-release plugin.
|
||||||
|
|||||||
@@ -1,2 +1,2 @@
|
|||||||
kotlin.code.style = official
|
kotlin.code.style = official
|
||||||
version = 2.17.1-dev.2
|
version = 2.20.0-dev.1
|
||||||
|
|||||||
@@ -49,7 +49,7 @@ internal object MainCommand : Runnable {
|
|||||||
}
|
}
|
||||||
|
|
||||||
class PatchArgs {
|
class PatchArgs {
|
||||||
@Option(names = ["-b", "--bundles"], description = ["One or more bundles of patches"], required = true)
|
@Option(names = ["-b", "--bundle"], description = ["One or more bundles of patches"], required = true)
|
||||||
var patchBundles = arrayOf<String>()
|
var patchBundles = arrayOf<String>()
|
||||||
|
|
||||||
@Option(names = ["--options"], description = ["Configuration file for all patch options"])
|
@Option(names = ["--options"], description = ["Configuration file for all patch options"])
|
||||||
@@ -63,7 +63,7 @@ internal object MainCommand : Runnable {
|
|||||||
}
|
}
|
||||||
|
|
||||||
class ListingArgs {
|
class ListingArgs {
|
||||||
@Option(names = ["-l", "--list"], description = ["List patches only"], required = true)
|
@Option(names = ["-l", "--list"], description = ["List patches"], required = true)
|
||||||
var listOnly: Boolean = false
|
var listOnly: Boolean = false
|
||||||
|
|
||||||
@Option(names = ["--with-versions"], description = ["List patches with compatible versions"])
|
@Option(names = ["--with-versions"], description = ["List patches with compatible versions"])
|
||||||
@@ -71,9 +71,6 @@ internal object MainCommand : Runnable {
|
|||||||
|
|
||||||
@Option(names = ["--with-packages"], description = ["List patches with compatible packages"])
|
@Option(names = ["--with-packages"], description = ["List patches with compatible packages"])
|
||||||
var withPackages: Boolean = false
|
var withPackages: Boolean = false
|
||||||
|
|
||||||
@Option(names = ["--with-descriptions"], description = ["List patches with their descriptions"])
|
|
||||||
var withDescriptions: Boolean = true
|
|
||||||
}
|
}
|
||||||
|
|
||||||
class PatchingArgs {
|
class PatchingArgs {
|
||||||
@@ -87,7 +84,7 @@ internal object MainCommand : Runnable {
|
|||||||
names = ["--exclusive"],
|
names = ["--exclusive"],
|
||||||
description = ["Only installs the patches you include, not including any patch by default"]
|
description = ["Only installs the patches you include, not including any patch by default"]
|
||||||
)
|
)
|
||||||
var defaultExclude = false
|
var exclusive = false
|
||||||
|
|
||||||
@Option(names = ["-i", "--include"], description = ["Include patches"])
|
@Option(names = ["-i", "--include"], description = ["Include patches"])
|
||||||
var includedPatches = arrayOf<String>()
|
var includedPatches = arrayOf<String>()
|
||||||
@@ -220,7 +217,7 @@ internal object MainCommand : Runnable {
|
|||||||
for (patchBundlePath in args.patchArgs?.patchBundles!!) for (patch in PatchBundle.Jar(patchBundlePath)
|
for (patchBundlePath in args.patchArgs?.patchBundles!!) for (patch in PatchBundle.Jar(patchBundlePath)
|
||||||
.loadPatches()) {
|
.loadPatches()) {
|
||||||
if (patch.patchName in logged) continue
|
if (patch.patchName in logged) continue
|
||||||
for (compatiblePackage in patch.compatiblePackages!!) {
|
for (compatiblePackage in patch.compatiblePackages ?: continue) {
|
||||||
val packageEntryStr = buildString {
|
val packageEntryStr = buildString {
|
||||||
// Add package if flag is set
|
// Add package if flag is set
|
||||||
if (args.patchArgs?.listingArgs?.withPackages == true) {
|
if (args.patchArgs?.listingArgs?.withPackages == true) {
|
||||||
@@ -228,14 +225,15 @@ internal object MainCommand : Runnable {
|
|||||||
append(packageName)
|
append(packageName)
|
||||||
append("\t")
|
append("\t")
|
||||||
}
|
}
|
||||||
|
|
||||||
// Add patch name
|
// Add patch name
|
||||||
val patchName = patch.patchName.padStart(25)
|
val patchName = patch.patchName.padStart(25)
|
||||||
append(patchName)
|
append(patchName)
|
||||||
|
|
||||||
// Add description if flag is set.
|
// Add description if flag is set.
|
||||||
if (args.patchArgs?.listingArgs?.withDescriptions == true) {
|
append("\t")
|
||||||
append("\t")
|
append(patch.description)
|
||||||
append(patch.description)
|
|
||||||
}
|
|
||||||
// Add compatible versions, if flag is set
|
// Add compatible versions, if flag is set
|
||||||
if (args.patchArgs?.listingArgs?.withVersions == true) {
|
if (args.patchArgs?.listingArgs?.withVersions == true) {
|
||||||
val compatibleVersions = compatiblePackage.versions.joinToString(separator = ", ")
|
val compatibleVersions = compatiblePackage.versions.joinToString(separator = ", ")
|
||||||
|
|||||||
@@ -1,64 +0,0 @@
|
|||||||
package app.revanced.utils.filesystem
|
|
||||||
|
|
||||||
import java.io.Closeable
|
|
||||||
import java.io.File
|
|
||||||
import java.nio.file.FileSystems
|
|
||||||
import java.nio.file.Files
|
|
||||||
import java.nio.file.Path
|
|
||||||
import java.util.zip.ZipEntry
|
|
||||||
|
|
||||||
internal class ZipFileSystemUtils(
|
|
||||||
file: File
|
|
||||||
) : Closeable {
|
|
||||||
private var zipFileSystem = FileSystems.newFileSystem(file.toPath(), mapOf("noCompression" to true))
|
|
||||||
|
|
||||||
private fun Path.deleteRecursively() {
|
|
||||||
if (!Files.exists(this)) {
|
|
||||||
throw IllegalStateException("File exists in real folder but not in zip file system")
|
|
||||||
}
|
|
||||||
|
|
||||||
if (Files.isDirectory(this)) {
|
|
||||||
Files.list(this).forEach { path ->
|
|
||||||
path.deleteRecursively()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
Files.delete(this)
|
|
||||||
}
|
|
||||||
|
|
||||||
internal fun getFile(path: String) = zipFileSystem.getPath(path)
|
|
||||||
|
|
||||||
internal fun writePathRecursively(path: Path) {
|
|
||||||
Files.list(path).use { fileStream ->
|
|
||||||
fileStream.forEach { filePath ->
|
|
||||||
val fileSystemPath = filePath.getRelativePath(path)
|
|
||||||
fileSystemPath.deleteRecursively()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
Files.walk(path).use { fileStream ->
|
|
||||||
// don't include build directory
|
|
||||||
// by skipping the root node.
|
|
||||||
fileStream.skip(1).forEach { filePath ->
|
|
||||||
val relativePath = filePath.getRelativePath(path)
|
|
||||||
|
|
||||||
if (Files.isDirectory(filePath)) {
|
|
||||||
Files.createDirectory(relativePath)
|
|
||||||
return@forEach
|
|
||||||
}
|
|
||||||
|
|
||||||
Files.copy(filePath, relativePath)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
internal fun write(path: String, content: ByteArray) = Files.write(zipFileSystem.getPath(path), content)
|
|
||||||
|
|
||||||
private fun Path.getRelativePath(path: Path): Path = zipFileSystem.getPath(path.relativize(this).toString())
|
|
||||||
|
|
||||||
// TODO: figure out why the file system is uncompressed by default and how to fix it
|
|
||||||
internal fun uncompress(vararg paths: String) =
|
|
||||||
paths.forEach { Files.setAttribute(zipFileSystem.getPath(it), "zip:method", ZipEntry.STORED) }
|
|
||||||
|
|
||||||
override fun close() = zipFileSystem.close()
|
|
||||||
}
|
|
||||||
@@ -18,20 +18,11 @@ fun Patcher.addPatchesFiltered(allPatches: List<Class<out Patch<Context>>>) {
|
|||||||
allPatches.forEach patchLoop@{ patch ->
|
allPatches.forEach patchLoop@{ patch ->
|
||||||
val compatiblePackages = patch.compatiblePackages
|
val compatiblePackages = patch.compatiblePackages
|
||||||
val patchName = patch.patchName
|
val patchName = patch.patchName
|
||||||
|
|
||||||
val prefix = "Skipping $patchName, reason"
|
|
||||||
|
|
||||||
val args = MainCommand.args.patchArgs?.patchingArgs!!
|
val args = MainCommand.args.patchArgs?.patchingArgs!!
|
||||||
|
|
||||||
if (args.excludedPatches.contains(patchName)) {
|
val prefix = "Skipping $patchName"
|
||||||
logger.info("$prefix: manually excluded")
|
|
||||||
return@patchLoop
|
|
||||||
} else if ((!patch.include || args.defaultExclude) && !args.includedPatches.contains(patchName)) {
|
|
||||||
logger.info("$prefix: excluded by default")
|
|
||||||
return@patchLoop
|
|
||||||
}
|
|
||||||
|
|
||||||
if (compatiblePackages == null) logger.trace("$prefix: No constraint on packages. Continuing.")
|
if (compatiblePackages == null) logger.trace("$patchName: No constraint on packages.")
|
||||||
else {
|
else {
|
||||||
if (!compatiblePackages.any { it.name == packageName }) {
|
if (!compatiblePackages.any { it.name == packageName }) {
|
||||||
logger.trace("$prefix: Incompatible with $packageName. This patch is only compatible with ${
|
logger.trace("$prefix: Incompatible with $packageName. This patch is only compatible with ${
|
||||||
@@ -51,6 +42,14 @@ fun Patcher.addPatchesFiltered(allPatches: List<Class<out Patch<Context>>>) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (args.excludedPatches.contains(patchName)) {
|
||||||
|
logger.info("$prefix: Manually excluded")
|
||||||
|
return@patchLoop
|
||||||
|
} else if ((!patch.include || args.exclusive) && !args.includedPatches.contains(patchName)) {
|
||||||
|
logger.info("$prefix: Excluded by default")
|
||||||
|
return@patchLoop
|
||||||
|
}
|
||||||
|
|
||||||
logger.trace("Adding $patchName")
|
logger.trace("Adding $patchName")
|
||||||
includedPatches.add(patch)
|
includedPatches.add(patch)
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user