Compare commits

..

No commits in common. "v5.0.2-dev.1" and "main" have entirely different histories.

3 changed files with 20 additions and 33 deletions

View File

@ -1,10 +1,3 @@
## [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) ## [5.0.1](https://github.com/ReVanced/revanced-cli/compare/v5.0.0...v5.0.1) (2025-04-14)

View File

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

View File

@ -115,27 +115,21 @@ internal object PatchCommand : Runnable {
this.outputFilePath = outputFilePath?.absoluteFile this.outputFilePath = outputFilePath?.absoluteFile
} }
@ArgGroup(exclusive = false, multiplicity = "0..1") @CommandLine.Option(
internal var installation: Installation? = null 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
internal class Installation { @CommandLine.Option(
@CommandLine.Option( names = ["--mount"],
names = ["-i", "--install"], description = ["Install the patched APK file by mounting."],
required = true, showDefaultValue = ALWAYS,
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. private var mount: Boolean = false
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( @CommandLine.Option(
names = ["--keystore"], names = ["--keystore"],
@ -251,11 +245,11 @@ internal object PatchCommand : Runnable {
keyStoreFilePath ?: outputFilePath.parentFile keyStoreFilePath ?: outputFilePath.parentFile
.resolve("${outputFilePath.nameWithoutExtension}.keystore") .resolve("${outputFilePath.nameWithoutExtension}.keystore")
val installer = if (installation?.deviceSerial != null) { val installer = if (deviceSerial != null) {
val deviceSerial = installation?.deviceSerial!!.ifEmpty { null } val deviceSerial = deviceSerial!!.ifEmpty { null }
try { try {
if (installation?.mount == true) { if (mount) {
AdbRootInstaller(deviceSerial) AdbRootInstaller(deviceSerial)
} else { } else {
AdbInstaller(deviceSerial) AdbInstaller(deviceSerial)
@ -338,7 +332,7 @@ internal object PatchCommand : Runnable {
apk.copyTo(temporaryFilesPath.resolve(apk.name), overwrite = true).apply { apk.copyTo(temporaryFilesPath.resolve(apk.name), overwrite = true).apply {
patcherResult.applyTo(this) patcherResult.applyTo(this)
}.let { patchedApkFile -> }.let { patchedApkFile ->
if (installation?.mount != true) { if (!mount) {
ApkUtils.signApk( ApkUtils.signApk(
patchedApkFile, patchedApkFile,
outputFilePath, outputFilePath,
@ -361,7 +355,7 @@ internal object PatchCommand : Runnable {
// region Install. // region Install.
installation?.deviceSerial?.let { deviceSerial?.let {
runBlocking { runBlocking {
when (val result = installer!!.install(Installer.Apk(outputFilePath, packageName))) { when (val result = installer!!.install(Installer.Apk(outputFilePath, packageName))) {
RootInstallerResult.FAILURE -> logger.severe("Failed to mount the patched APK file") RootInstallerResult.FAILURE -> logger.severe("Failed to mount the patched APK file")