From 0c53a2d1d75d3d934d134594751fe6cd0b000d1a Mon Sep 17 00:00:00 2001 From: laur89 Date: Mon, 21 Apr 2025 01:18:41 +0200 Subject: [PATCH 1/6] fix: Group `mount` and `install` options into an argument group (#364) Co-authored-by: oSumAtrIX --- .../app/revanced/cli/command/PatchCommand.kt | 46 +++++++++++-------- 1 file changed, 26 insertions(+), 20 deletions(-) diff --git a/src/main/kotlin/app/revanced/cli/command/PatchCommand.kt b/src/main/kotlin/app/revanced/cli/command/PatchCommand.kt index efbc7552..ba6b0440 100644 --- a/src/main/kotlin/app/revanced/cli/command/PatchCommand.kt +++ b/src/main/kotlin/app/revanced/cli/command/PatchCommand.kt @@ -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 - - @CommandLine.Option( - names = ["--mount"], - description = ["Install the patched APK file by mounting."], - showDefaultValue = ALWAYS, - ) - private var mount: Boolean = false + @ArgGroup(exclusive = false, multiplicity = "0..1") + internal var installation: Installation? = null + + 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") From 1717cc66f772652026ab04cc18011ec34120b23d Mon Sep 17 00:00:00 2001 From: semantic-release-bot Date: Sun, 20 Apr 2025 23:20:36 +0000 Subject: [PATCH 2/6] 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](https://github.com/ReVanced/revanced-cli/commit/0c53a2d1d75d3d934d134594751fe6cd0b000d1a)) --- CHANGELOG.md | 7 +++++++ gradle.properties | 2 +- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 54b16bcc..6d2f09bf 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,10 @@ +## [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) diff --git a/gradle.properties b/gradle.properties index d5a4aa32..54b7fe01 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,4 +1,4 @@ org.gradle.parallel = true org.gradle.caching = true kotlin.code.style = official -version = 5.0.1 +version = 5.0.2-dev.1 From bba90fede85e4632efb9509e5bcf9091a9435549 Mon Sep 17 00:00:00 2001 From: oSumAtrIX Date: Fri, 25 Apr 2025 22:26:45 +0200 Subject: [PATCH 3/6] fix: Do not print patch description if null --- .../cli/command/ListPatchesCommand.kt | 89 +++++++++---------- 1 file changed, 43 insertions(+), 46 deletions(-) diff --git a/src/main/kotlin/app/revanced/cli/command/ListPatchesCommand.kt b/src/main/kotlin/app/revanced/cli/command/ListPatchesCommand.kt index a2220e61..231017a8 100644 --- a/src/main/kotlin/app/revanced/cli/command/ListPatchesCommand.kt +++ b/src/main/kotlin/app/revanced/cli/command/ListPatchesCommand.kt @@ -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>.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") - - values?.let { values -> - appendLine("\nPossible values:") - append(values.map { "${it.value} (${it.key})" }.joinToString("\n").prependIndent("\t")) - } + if (withIndex) appendLine("Index: $index") - append("\nType: $type") - } + append("Name: ${patch.name}") - fun IndexedValue>.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 (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"), + ) + } + + 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() From f29eda8674a3406992f7127f0fd0a19c1188ca8a Mon Sep 17 00:00:00 2001 From: semantic-release-bot Date: Fri, 25 Apr 2025 20:29:10 +0000 Subject: [PATCH 4/6] 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](https://github.com/ReVanced/revanced-cli/commit/bba90fede85e4632efb9509e5bcf9091a9435549)) --- CHANGELOG.md | 7 +++++++ gradle.properties | 2 +- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 6d2f09bf..7058d6f1 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,10 @@ +## [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) diff --git a/gradle.properties b/gradle.properties index 54b7fe01..2e43ce1b 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,4 +1,4 @@ org.gradle.parallel = true org.gradle.caching = true kotlin.code.style = official -version = 5.0.2-dev.1 +version = 5.0.2-dev.2 From 77862e8940d7e76f9bdd7e0b449ccf38298758bd Mon Sep 17 00:00:00 2001 From: Pun Butrach Date: Thu, 22 May 2025 19:54:29 +0700 Subject: [PATCH 5/6] ci: Attest release artifacts (#367) Co-authored-by: oSumAtrIX --- .github/workflows/release.yml | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index ce715b38..e7799bf5 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -12,6 +12,8 @@ jobs: name: Release permissions: contents: write + id-token: write + attestations: write runs-on: ubuntu-latest steps: - name: Checkout @@ -47,6 +49,14 @@ jobs: fingerprint: ${{ vars.GPG_FINGERPRINT }} - name: Release + uses: cycjimmy/semantic-release-action@v4 + id: release env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - run: npm exec semantic-release + + - name: Attest + if: steps.release.outputs.new_release_published == 'true' + uses: actions/attest-build-provenance@v2 + with: + subject-name: 'ReVanced CLI ${{ steps.release.outputs.new_release_git_tag }}' + subject-path: build/libs/revanced-cli*.jar From 8e18082862b0523365df64401497efb8e404b777 Mon Sep 17 00:00:00 2001 From: Pun Butrach Date: Tue, 8 Jul 2025 23:01:12 +0700 Subject: [PATCH 6/6] ci: Use default fetch-depth of 1 for checkout step (#375) --- .github/workflows/build_pull_request.yml | 2 -- .github/workflows/release.yml | 5 ----- 2 files changed, 7 deletions(-) diff --git a/.github/workflows/build_pull_request.yml b/.github/workflows/build_pull_request.yml index 250871bc..1f671bb5 100644 --- a/.github/workflows/build_pull_request.yml +++ b/.github/workflows/build_pull_request.yml @@ -13,8 +13,6 @@ jobs: steps: - name: Checkout uses: actions/checkout@v4 - with: - fetch-depth: 0 - name: Cache Gradle uses: burrunan/gradle-cache-action@v1 diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index e7799bf5..106a2079 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -18,11 +18,6 @@ jobs: steps: - name: Checkout uses: actions/checkout@v4 - with: - # Make sure the release step uses its own credentials: - # https://github.com/cycjimmy/semantic-release-action#private-packages - persist-credentials: false - fetch-depth: 0 - name: Cache Gradle uses: burrunan/gradle-cache-action@v1