From 223629c663dcd94d237110e09e4e152aa03867f9 Mon Sep 17 00:00:00 2001 From: oSumAtrIX Date: Thu, 14 Mar 2024 12:49:50 +0100 Subject: [PATCH] feat: Use more consistent option name --- .../app/revanced/cli/command/PatchCommand.kt | 26 +++++++++++++------ 1 file changed, 18 insertions(+), 8 deletions(-) diff --git a/src/main/kotlin/app/revanced/cli/command/PatchCommand.kt b/src/main/kotlin/app/revanced/cli/command/PatchCommand.kt index a77cf32..05238c2 100644 --- a/src/main/kotlin/app/revanced/cli/command/PatchCommand.kt +++ b/src/main/kotlin/app/revanced/cli/command/PatchCommand.kt @@ -2,7 +2,6 @@ package app.revanced.cli.command import app.revanced.library.ApkUtils import app.revanced.library.ApkUtils.applyTo -import app.revanced.library.ApkUtils.sign import app.revanced.library.Options import app.revanced.library.Options.setOptions import app.revanced.library.adb.AdbManager @@ -86,6 +85,7 @@ internal object PatchCommand : Runnable { names = ["-o", "--out"], description = ["Path to save the patched APK file to. Defaults to the same directory as the supplied APK file."], ) + @Suppress("unused") private fun setOutputFilePath(outputFilePath: File?) { this.outputFilePath = outputFilePath?.absoluteFile } @@ -126,13 +126,23 @@ internal object PatchCommand : Runnable { description = ["The alias of the keystore entry to sign the patched APK file with."], showDefaultValue = ALWAYS, ) - private var alias = "ReVanced Key" + private fun setKeyStoreEntryAlias(alias: String = "ReVanced Key") { + logger.warning("The --alias option is deprecated. Use --keystore-entry-alias instead.") + keyStoreEntryAlias = alias + } + + @CommandLine.Option( + names = ["--keystore-entry-alias"], + description = ["The alias of the keystore entry to sign the patched APK file with."], + showDefaultValue = ALWAYS, + ) + private var keyStoreEntryAlias = "ReVanced Key" @CommandLine.Option( names = ["--keystore-entry-password"], description = ["The password of the entry from the keystore for the key to sign the patched APK file with."], ) - private var password = "" // Empty password by default + private var keyStoreEntryPassword = "" // Empty password by default @CommandLine.Option( names = ["--signer"], @@ -308,15 +318,15 @@ internal object PatchCommand : Runnable { patcherResult.applyTo(this) }.let { patchedApkFile -> if (!mount) { - sign( + ApkUtils.signApk( patchedApkFile, outputFilePath, - ApkUtils.SigningOptions( + signer, + ApkUtils.KeyStoreDetails( keystoreFilePath, keyStorePassword, - alias, - password, - signer, + keyStoreEntryAlias, + keyStoreEntryPassword, ), ) } else {