mirror of
https://github.com/ReVanced/revanced-cli.git
synced 2026-01-18 17:03:58 +00:00
Compare commits
15 Commits
v2.18.1
...
v2.20.0-de
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
1957a2c4ff | ||
|
|
07a423b19e | ||
|
|
31e4a41dd2 | ||
|
|
8284c1048f | ||
|
|
9c64f5ec3e | ||
|
|
f4c447e71b | ||
|
|
b69e784785 | ||
|
|
ccce9c926d | ||
|
|
dc4ab22f41 | ||
|
|
25d8ad4aaf | ||
|
|
3d9436e691 | ||
|
|
ee70423527 | ||
|
|
d5794b94ca | ||
|
|
3160d894da | ||
|
|
545597959a |
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:
|
||||||
|
|||||||
40
CHANGELOG.md
40
CHANGELOG.md
@@ -1,3 +1,43 @@
|
|||||||
|
# [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)
|
## [2.18.1](https://github.com/revanced/revanced-cli/compare/v2.18.0...v2.18.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")
|
||||||
}
|
}
|
||||||
@@ -44,6 +44,7 @@ tasks {
|
|||||||
minimize {
|
minimize {
|
||||||
exclude(dependency("org.jetbrains.kotlin:.*"))
|
exclude(dependency("org.jetbrains.kotlin:.*"))
|
||||||
exclude(dependency("org.bouncycastle:.*"))
|
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.18.1
|
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 {
|
||||||
@@ -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()
|
|
||||||
}
|
|
||||||
Reference in New Issue
Block a user