Compare commits

...

9 Commits

Author SHA1 Message Date
semantic-release-bot
f29eda8674 chore: Release v5.0.2-dev.2 [skip ci]
## [5.0.2-dev.2](https://github.com/ReVanced/revanced-cli/compare/v5.0.2-dev.1...v5.0.2-dev.2) (2025-04-25)

### Bug Fixes

* Do not print patch description if null ([bba90fe](bba90fede8))
2025-04-25 20:29:10 +00:00
oSumAtrIX
bba90fede8 fix: Do not print patch description if null 2025-04-25 22:27:11 +02:00
semantic-release-bot
1717cc66f7 chore: Release v5.0.2-dev.1 [skip ci]
## [5.0.2-dev.1](https://github.com/ReVanced/revanced-cli/compare/v5.0.1...v5.0.2-dev.1) (2025-04-20)

### Bug Fixes

* Group `mount` and `install` options into an argument group  ([#364](https://github.com/ReVanced/revanced-cli/issues/364)) ([0c53a2d](0c53a2d1d7))
2025-04-20 23:20:36 +00:00
laur89
0c53a2d1d7 fix: Group mount and install options into an argument group (#364)
Co-authored-by: oSumAtrIX <johan.melkonyan1@web.de>
2025-04-21 01:18:41 +02:00
semantic-release-bot
a0189aeaee chore: Release v5.0.1 [skip ci]
## [5.0.1](https://github.com/ReVanced/revanced-cli/compare/v5.0.0...v5.0.1) (2025-04-14)

### Bug Fixes

* Make mounting work again by bumping dependencies ([#359](https://github.com/ReVanced/revanced-cli/issues/359)) ([68a4872](68a48724eb))
2025-04-14 08:53:31 +00:00
oSumAtrIX
19e8422588 chore: Merge branch dev to main (#354)
Co-authored-by: kitadai31 <90122968+kitadai31@users.noreply.github.com>
Co-authored-by: Jamie McCullough <92225779+AoifeMcCull@users.noreply.github.com>
Co-authored-by: semantic-release-bot <semantic-release-bot@martynus.net>
2025-04-14 10:51:31 +02:00
semantic-release-bot
d908595b22 chore: Release v5.0.1-dev.1 [skip ci]
## [5.0.1-dev.1](https://github.com/ReVanced/revanced-cli/compare/v5.0.0...v5.0.1-dev.1) (2025-02-26)

### Bug Fixes

* Make mounting work again by bumping dependencies ([#359](https://github.com/ReVanced/revanced-cli/issues/359)) ([68a4872](68a48724eb))
2025-02-26 21:52:52 +00:00
Jamie McCullough
68a48724eb fix: Make mounting work again by bumping dependencies (#359) 2025-02-26 22:50:58 +01:00
kitadai31
bf31de4148 build: Remove AAPT1 binary & minimize ReVanced Library (#340) 2024-12-24 01:52:44 +01:00
6 changed files with 99 additions and 68 deletions

View File

@@ -1,3 +1,31 @@
## [5.0.2-dev.2](https://github.com/ReVanced/revanced-cli/compare/v5.0.2-dev.1...v5.0.2-dev.2) (2025-04-25)
### Bug Fixes
* Do not print patch description if null ([bba90fe](https://github.com/ReVanced/revanced-cli/commit/bba90fede85e4632efb9509e5bcf9091a9435549))
## [5.0.2-dev.1](https://github.com/ReVanced/revanced-cli/compare/v5.0.1...v5.0.2-dev.1) (2025-04-20)
### Bug Fixes
* Group `mount` and `install` options into an argument group ([#364](https://github.com/ReVanced/revanced-cli/issues/364)) ([0c53a2d](https://github.com/ReVanced/revanced-cli/commit/0c53a2d1d75d3d934d134594751fe6cd0b000d1a))
## [5.0.1](https://github.com/ReVanced/revanced-cli/compare/v5.0.0...v5.0.1) (2025-04-14)
### Bug Fixes
* Make mounting work again by bumping dependencies ([#359](https://github.com/ReVanced/revanced-cli/issues/359)) ([68a4872](https://github.com/ReVanced/revanced-cli/commit/68a48724ebf01a0c8f8adc0fec63037bff672dc9))
## [5.0.1-dev.1](https://github.com/ReVanced/revanced-cli/compare/v5.0.0...v5.0.1-dev.1) (2025-02-26)
### Bug Fixes
* Make mounting work again by bumping dependencies ([#359](https://github.com/ReVanced/revanced-cli/issues/359)) ([68a4872](https://github.com/ReVanced/revanced-cli/commit/68a48724ebf01a0c8f8adc0fec63037bff672dc9))
# [5.0.0](https://github.com/ReVanced/revanced-cli/compare/v4.6.0...v5.0.0) (2024-11-10)

View File

@@ -59,10 +59,10 @@ tasks {
}
shadowJar {
exclude("/prebuilt/linux/aapt", "/prebuilt/windows/aapt.exe", "/prebuilt/*/aapt_*")
minimize {
exclude(dependency("org.jetbrains.kotlin:.*"))
exclude(dependency("org.bouncycastle:.*"))
exclude(dependency("app.revanced:.*"))
exclude(dependency("app.revanced:revanced-patcher"))
}
}

View File

@@ -1,4 +1,4 @@
org.gradle.parallel = true
org.gradle.caching = true
kotlin.code.style = official
version = 5.0.0
version = 5.0.2-dev.2

View File

@@ -4,7 +4,7 @@ kotlin = "2.0.20"
kotlinx = "1.8.1"
picocli = "4.7.6"
revanced-patcher = "21.0.0"
revanced-library = "3.0.2"
revanced-library = "3.1.0"
[libraries]
kotlin-test = { module = "org.jetbrains.kotlin:kotlin-test", version.ref = "kotlin" }

View File

@@ -85,58 +85,55 @@ internal object ListPatchesCommand : Runnable {
}
}
fun PatchOption<*>.buildString() =
fun PatchOption<*>.buildString() = buildString {
appendLine("Title: $title")
description?.let { appendLine("Description: $it") }
appendLine("Required: $required")
default?.let {
appendLine("Key: $key")
append("Default: $it")
} ?: append("Key: $key")
values?.let { values ->
appendLine("\nPossible values:")
append(values.map { "${it.value} (${it.key})" }.joinToString("\n").prependIndent("\t"))
}
append("\nType: $type")
}
fun IndexedValue<Patch<*>>.buildString() = let { (index, patch) ->
buildString {
appendLine("Title: $title")
description?.let { appendLine("Description: $it") }
appendLine("Required: $required")
default?.let {
appendLine("Key: $key")
append("Default: $it")
} ?: append("Key: $key")
if (withIndex) appendLine("Index: $index")
values?.let { values ->
appendLine("\nPossible values:")
append(values.map { "${it.value} (${it.key})" }.joinToString("\n").prependIndent("\t"))
append("Name: ${patch.name}")
if (withDescriptions) patch.description?.let { append("\nDescription: $it") }
append("\nEnabled: ${patch.use}")
if (withOptions && patch.options.isNotEmpty()) {
appendLine("\nOptions:")
append(
patch.options.values.joinToString("\n\n") { option ->
option.buildString()
}.prependIndent("\t"),
)
}
append("\nType: $type")
}
fun IndexedValue<Patch<*>>.buildString() =
let { (index, patch) ->
buildString {
if (withIndex) appendLine("Index: $index")
append("Name: ${patch.name}")
if (withDescriptions) append("\nDescription: ${patch.description}")
append("\nEnabled: ${patch.use}")
if (withOptions && patch.options.isNotEmpty()) {
appendLine("\nOptions:")
append(
patch.options.values.joinToString("\n\n") { option ->
option.buildString()
}.prependIndent("\t"),
)
}
if (withPackages && patch.compatiblePackages != null) {
appendLine("\nCompatible packages:")
append(
patch.compatiblePackages!!.joinToString("\n") {
it.buildString()
}.prependIndent("\t"),
)
}
if (withPackages && patch.compatiblePackages != null) {
appendLine("\nCompatible packages:")
append(
patch.compatiblePackages!!.joinToString("\n") {
it.buildString()
}.prependIndent("\t"),
)
}
}
}
fun Patch<*>.filterCompatiblePackages(name: String) =
compatiblePackages?.any { (compatiblePackageName, _) -> compatiblePackageName == name }
?: withUniversalPatches
fun Patch<*>.filterCompatiblePackages(name: String) = compatiblePackages?.any { (compatiblePackageName, _) -> compatiblePackageName == name }
?: withUniversalPatches
val patches = loadPatchesFromJar(patchesFiles).withIndex().toList()

View File

@@ -115,21 +115,27 @@ internal object PatchCommand : Runnable {
this.outputFilePath = outputFilePath?.absoluteFile
}
@CommandLine.Option(
names = ["-i", "--install"],
description = ["Serial of the ADB device to install to. If not specified, the first connected device will be used."],
// Empty string to indicate that the first connected device should be used.
fallbackValue = "",
arity = "0..1",
)
private var deviceSerial: String? = null
@ArgGroup(exclusive = false, multiplicity = "0..1")
internal var installation: Installation? = null
@CommandLine.Option(
names = ["--mount"],
description = ["Install the patched APK file by mounting."],
showDefaultValue = ALWAYS,
)
private var mount: Boolean = false
internal class Installation {
@CommandLine.Option(
names = ["-i", "--install"],
required = true,
description = ["Serial of the ADB device to install to. If not specified, the first connected device will be used."],
fallbackValue = "", // Empty string is used to select the first of connected devices.
arity = "0..1",
)
internal var deviceSerial: String? = null
@CommandLine.Option(
names = ["--mount"],
required = false,
description = ["Install the patched APK file by mounting."],
showDefaultValue = ALWAYS,
)
internal var mount: Boolean = false
}
@CommandLine.Option(
names = ["--keystore"],
@@ -245,11 +251,11 @@ internal object PatchCommand : Runnable {
keyStoreFilePath ?: outputFilePath.parentFile
.resolve("${outputFilePath.nameWithoutExtension}.keystore")
val installer = if (deviceSerial != null) {
val deviceSerial = deviceSerial!!.ifEmpty { null }
val installer = if (installation?.deviceSerial != null) {
val deviceSerial = installation?.deviceSerial!!.ifEmpty { null }
try {
if (mount) {
if (installation?.mount == true) {
AdbRootInstaller(deviceSerial)
} else {
AdbInstaller(deviceSerial)
@@ -332,7 +338,7 @@ internal object PatchCommand : Runnable {
apk.copyTo(temporaryFilesPath.resolve(apk.name), overwrite = true).apply {
patcherResult.applyTo(this)
}.let { patchedApkFile ->
if (!mount) {
if (installation?.mount != true) {
ApkUtils.signApk(
patchedApkFile,
outputFilePath,
@@ -355,7 +361,7 @@ internal object PatchCommand : Runnable {
// region Install.
deviceSerial?.let {
installation?.deviceSerial?.let {
runBlocking {
when (val result = installer!!.install(Installer.Apk(outputFilePath, packageName))) {
RootInstallerResult.FAILURE -> logger.severe("Failed to mount the patched APK file")