mirror of
https://github.com/ReVanced/revanced-cli.git
synced 2026-01-12 14:26:19 +00:00
Compare commits
7 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
731865e167 | ||
|
|
8e18082862 | ||
|
|
77862e8940 | ||
|
|
f29eda8674 | ||
|
|
bba90fede8 | ||
|
|
1717cc66f7 | ||
|
|
0c53a2d1d7 |
2
.github/workflows/build_pull_request.yml
vendored
2
.github/workflows/build_pull_request.yml
vendored
@@ -13,8 +13,6 @@ jobs:
|
|||||||
steps:
|
steps:
|
||||||
- name: Checkout
|
- name: Checkout
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v4
|
||||||
with:
|
|
||||||
fetch-depth: 0
|
|
||||||
|
|
||||||
- name: Cache Gradle
|
- name: Cache Gradle
|
||||||
uses: burrunan/gradle-cache-action@v1
|
uses: burrunan/gradle-cache-action@v1
|
||||||
|
|||||||
17
.github/workflows/release.yml
vendored
17
.github/workflows/release.yml
vendored
@@ -12,15 +12,12 @@ jobs:
|
|||||||
name: Release
|
name: Release
|
||||||
permissions:
|
permissions:
|
||||||
contents: write
|
contents: write
|
||||||
|
id-token: write
|
||||||
|
attestations: write
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout
|
- name: Checkout
|
||||||
uses: actions/checkout@v4
|
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
|
- name: Cache Gradle
|
||||||
uses: burrunan/gradle-cache-action@v1
|
uses: burrunan/gradle-cache-action@v1
|
||||||
@@ -47,6 +44,14 @@ jobs:
|
|||||||
fingerprint: ${{ vars.GPG_FINGERPRINT }}
|
fingerprint: ${{ vars.GPG_FINGERPRINT }}
|
||||||
|
|
||||||
- name: Release
|
- name: Release
|
||||||
|
uses: cycjimmy/semantic-release-action@v4
|
||||||
|
id: release
|
||||||
env:
|
env:
|
||||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
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
|
||||||
|
|||||||
14
CHANGELOG.md
14
CHANGELOG.md
@@ -1,3 +1,17 @@
|
|||||||
|
## [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)
|
## [5.0.1](https://github.com/ReVanced/revanced-cli/compare/v5.0.0...v5.0.1) (2025-04-14)
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -100,7 +100,7 @@ To build a ReVanced CLI, you can follow the [documentation](/docs).
|
|||||||
|
|
||||||
You can find the documentation of ReVanced CLI [here](/docs).
|
You can find the documentation of ReVanced CLI [here](/docs).
|
||||||
|
|
||||||
## 📜 Licence
|
## 📜 License
|
||||||
|
|
||||||
ReVanced CLI is licensed under the GPLv3 license. Please see the [license file](LICENSE) for more information.
|
ReVanced CLI is licensed under the GPLv3 license. Please see the [license file](LICENSE) for more information.
|
||||||
[tl;dr](https://www.tldrlegal.com/license/gnu-general-public-license-v3-gpl-3) you may copy, distribute and modify ReVanced CLI as long as you track changes/dates in source files.
|
[tl;dr](https://www.tldrlegal.com/license/gnu-general-public-license-v3-gpl-3) you may copy, distribute and modify ReVanced CLI as long as you track changes/dates in source files.
|
||||||
|
|||||||
@@ -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.1
|
version = 5.0.2-dev.2
|
||||||
|
|||||||
@@ -85,8 +85,7 @@ internal object ListPatchesCommand : Runnable {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fun PatchOption<*>.buildString() =
|
fun PatchOption<*>.buildString() = buildString {
|
||||||
buildString {
|
|
||||||
appendLine("Title: $title")
|
appendLine("Title: $title")
|
||||||
description?.let { appendLine("Description: $it") }
|
description?.let { appendLine("Description: $it") }
|
||||||
appendLine("Required: $required")
|
appendLine("Required: $required")
|
||||||
@@ -103,14 +102,13 @@ internal object ListPatchesCommand : Runnable {
|
|||||||
append("\nType: $type")
|
append("\nType: $type")
|
||||||
}
|
}
|
||||||
|
|
||||||
fun IndexedValue<Patch<*>>.buildString() =
|
fun IndexedValue<Patch<*>>.buildString() = let { (index, patch) ->
|
||||||
let { (index, patch) ->
|
|
||||||
buildString {
|
buildString {
|
||||||
if (withIndex) appendLine("Index: $index")
|
if (withIndex) appendLine("Index: $index")
|
||||||
|
|
||||||
append("Name: ${patch.name}")
|
append("Name: ${patch.name}")
|
||||||
|
|
||||||
if (withDescriptions) append("\nDescription: ${patch.description}")
|
if (withDescriptions) patch.description?.let { append("\nDescription: $it") }
|
||||||
|
|
||||||
append("\nEnabled: ${patch.use}")
|
append("\nEnabled: ${patch.use}")
|
||||||
|
|
||||||
@@ -134,8 +132,7 @@ internal object ListPatchesCommand : Runnable {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fun Patch<*>.filterCompatiblePackages(name: String) =
|
fun Patch<*>.filterCompatiblePackages(name: String) = compatiblePackages?.any { (compatiblePackageName, _) -> compatiblePackageName == name }
|
||||||
compatiblePackages?.any { (compatiblePackageName, _) -> compatiblePackageName == name }
|
|
||||||
?: withUniversalPatches
|
?: withUniversalPatches
|
||||||
|
|
||||||
val patches = loadPatchesFromJar(patchesFiles).withIndex().toList()
|
val patches = loadPatchesFromJar(patchesFiles).withIndex().toList()
|
||||||
|
|||||||
@@ -115,21 +115,27 @@ internal object PatchCommand : Runnable {
|
|||||||
this.outputFilePath = outputFilePath?.absoluteFile
|
this.outputFilePath = outputFilePath?.absoluteFile
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ArgGroup(exclusive = false, multiplicity = "0..1")
|
||||||
|
internal var installation: Installation? = null
|
||||||
|
|
||||||
|
internal class Installation {
|
||||||
@CommandLine.Option(
|
@CommandLine.Option(
|
||||||
names = ["-i", "--install"],
|
names = ["-i", "--install"],
|
||||||
|
required = true,
|
||||||
description = ["Serial of the ADB device to install to. If not specified, the first connected device will be used."],
|
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 = "", // Empty string is used to select the first of connected devices.
|
||||||
fallbackValue = "",
|
|
||||||
arity = "0..1",
|
arity = "0..1",
|
||||||
)
|
)
|
||||||
private var deviceSerial: String? = null
|
internal var deviceSerial: String? = null
|
||||||
|
|
||||||
@CommandLine.Option(
|
@CommandLine.Option(
|
||||||
names = ["--mount"],
|
names = ["--mount"],
|
||||||
|
required = false,
|
||||||
description = ["Install the patched APK file by mounting."],
|
description = ["Install the patched APK file by mounting."],
|
||||||
showDefaultValue = ALWAYS,
|
showDefaultValue = ALWAYS,
|
||||||
)
|
)
|
||||||
private var mount: Boolean = false
|
internal var mount: Boolean = false
|
||||||
|
}
|
||||||
|
|
||||||
@CommandLine.Option(
|
@CommandLine.Option(
|
||||||
names = ["--keystore"],
|
names = ["--keystore"],
|
||||||
@@ -245,11 +251,11 @@ internal object PatchCommand : Runnable {
|
|||||||
keyStoreFilePath ?: outputFilePath.parentFile
|
keyStoreFilePath ?: outputFilePath.parentFile
|
||||||
.resolve("${outputFilePath.nameWithoutExtension}.keystore")
|
.resolve("${outputFilePath.nameWithoutExtension}.keystore")
|
||||||
|
|
||||||
val installer = if (deviceSerial != null) {
|
val installer = if (installation?.deviceSerial != null) {
|
||||||
val deviceSerial = deviceSerial!!.ifEmpty { null }
|
val deviceSerial = installation?.deviceSerial!!.ifEmpty { null }
|
||||||
|
|
||||||
try {
|
try {
|
||||||
if (mount) {
|
if (installation?.mount == true) {
|
||||||
AdbRootInstaller(deviceSerial)
|
AdbRootInstaller(deviceSerial)
|
||||||
} else {
|
} else {
|
||||||
AdbInstaller(deviceSerial)
|
AdbInstaller(deviceSerial)
|
||||||
@@ -332,7 +338,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 (!mount) {
|
if (installation?.mount != true) {
|
||||||
ApkUtils.signApk(
|
ApkUtils.signApk(
|
||||||
patchedApkFile,
|
patchedApkFile,
|
||||||
outputFilePath,
|
outputFilePath,
|
||||||
@@ -355,7 +361,7 @@ internal object PatchCommand : Runnable {
|
|||||||
|
|
||||||
// region Install.
|
// region Install.
|
||||||
|
|
||||||
deviceSerial?.let {
|
installation?.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")
|
||||||
|
|||||||
Reference in New Issue
Block a user