diff --git a/CHANGELOG.md b/CHANGELOG.md index 2f6129d..3f46431 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,22 @@ +# [4.6.0-dev.1](https://github.com/ReVanced/revanced-cli/compare/v4.5.1-dev.1...v4.6.0-dev.1) (2024-03-14) + + +### Bug Fixes + +* Use correct option description ([45a2ffa](https://github.com/ReVanced/revanced-cli/commit/45a2ffa2dd95ee8ac3c4d466463c9a5b869b8da1)) + + +### Features + +* Use more consistent option name ([223629c](https://github.com/ReVanced/revanced-cli/commit/223629c663dcd94d237110e09e4e152aa03867f9)) + +## [4.5.1-dev.1](https://github.com/ReVanced/revanced-cli/compare/v4.5.0...v4.5.1-dev.1) (2024-03-12) + + +### Bug Fixes + +* Copy APK to output path when it is not being signed ([366f400](https://github.com/ReVanced/revanced-cli/commit/366f400c5a46491f3f262c7ff4b0df1ae3721f74)) + # [4.5.0](https://github.com/ReVanced/revanced-cli/compare/v4.4.2...v4.5.0) (2024-03-11) diff --git a/docs/2_building.md b/docs/2_building.md index 7376562..864400a 100644 --- a/docs/2_building.md +++ b/docs/2_building.md @@ -23,4 +23,15 @@ To build ReVanced CLI, follow these steps: ./gradlew build ``` +> [!NOTE] +> If the build fails due to authentication, you may need to authenticate to GitHub Packages. +> Create a PAT with the scope `read:packages` [here](https://github.com/settings/tokens/new?scopes=read:packages&description=ReVanced) and add your token to ~/.gradle/gradle.properties. +> +> Example `gradle.properties` file: +> +> ```properties +> gpr.user = user +> gpr.key = key +> ``` + After the build succeeds, the built JAR file will be located at `build/libs/revanced-cli--all.jar`. diff --git a/gradle.properties b/gradle.properties index 03e1401..4c62d57 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,4 +1,4 @@ org.gradle.parallel = true org.gradle.caching = true kotlin.code.style = official -version = 4.5.0 +version = 4.6.0-dev.1 diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index 4830428..c3b1bd4 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -4,7 +4,7 @@ kotlin = "1.9.22" kotlinx-coroutines-core = "1.7.3" picocli = "4.7.5" revanced-patcher = "19.3.1" -revanced-library = "2.2.1" +revanced-library = "2.3.0" [libraries] kotlin-test = { module = "org.jetbrains.kotlin:kotlin-test", version.ref = "kotlin" } diff --git a/src/main/kotlin/app/revanced/cli/command/PatchCommand.kt b/src/main/kotlin/app/revanced/cli/command/PatchCommand.kt index b440d62..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 } @@ -115,7 +115,6 @@ internal object PatchCommand : Runnable { ) private var keystoreFilePath: File? = null - // key store password @CommandLine.Option( names = ["--keystore-password"], description = ["The password of the keystore to sign the patched APK file with. Empty password by default."], @@ -124,16 +123,26 @@ internal object PatchCommand : Runnable { @CommandLine.Option( names = ["--alias"], - description = ["The alias of the key from the keystore to sign the patched APK file with."], + 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"], @@ -307,19 +316,21 @@ internal object PatchCommand : Runnable { // region Save apk.copyTo(temporaryFilesPath.resolve(apk.name), overwrite = true).apply { patcherResult.applyTo(this) - }.let { + }.let { patchedApkFile -> if (!mount) { - sign( - it, + ApkUtils.signApk( + patchedApkFile, outputFilePath, - ApkUtils.SigningOptions( + signer, + ApkUtils.KeyStoreDetails( keystoreFilePath, keyStorePassword, - alias, - password, - signer, + keyStoreEntryAlias, + keyStoreEntryPassword, ), ) + } else { + patchedApkFile.copyTo(outputFilePath, overwrite = true) } }