mirror of
https://github.com/ReVanced/revanced-cli.git
synced 2026-01-11 22:06:20 +00:00
Compare commits
13 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
b8f4f1eea3 | ||
|
|
356ee97e01 | ||
|
|
8e18082862 | ||
|
|
77862e8940 | ||
|
|
f29eda8674 | ||
|
|
bba90fede8 | ||
|
|
1717cc66f7 | ||
|
|
0c53a2d1d7 | ||
|
|
a0189aeaee | ||
|
|
19e8422588 | ||
|
|
d908595b22 | ||
|
|
68a48724eb | ||
|
|
bf31de4148 |
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
|
||||||
|
|||||||
28
CHANGELOG.md
28
CHANGELOG.md
@@ -1,3 +1,31 @@
|
|||||||
|
## [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)
|
||||||
|
|
||||||
|
|
||||||
|
### Bug Fixes
|
||||||
|
|
||||||
|
* Make mounting work again by bumping dependencies ([#359](https://github.com/ReVanced/revanced-cli/issues/359)) ([68a4872](https://github.com/ReVanced/revanced-cli/commit/68a48724ebf01a0c8f8adc0fec63037bff672dc9))
|
||||||
|
|
||||||
|
## [5.0.1-dev.1](https://github.com/ReVanced/revanced-cli/compare/v5.0.0...v5.0.1-dev.1) (2025-02-26)
|
||||||
|
|
||||||
|
|
||||||
|
### Bug Fixes
|
||||||
|
|
||||||
|
* Make mounting work again by bumping dependencies ([#359](https://github.com/ReVanced/revanced-cli/issues/359)) ([68a4872](https://github.com/ReVanced/revanced-cli/commit/68a48724ebf01a0c8f8adc0fec63037bff672dc9))
|
||||||
|
|
||||||
# [5.0.0](https://github.com/ReVanced/revanced-cli/compare/v4.6.0...v5.0.0) (2024-11-10)
|
# [5.0.0](https://github.com/ReVanced/revanced-cli/compare/v4.6.0...v5.0.0) (2024-11-10)
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -15,6 +15,7 @@ application {
|
|||||||
}
|
}
|
||||||
|
|
||||||
repositories {
|
repositories {
|
||||||
|
mavenLocal()
|
||||||
mavenCentral()
|
mavenCentral()
|
||||||
google()
|
google()
|
||||||
maven {
|
maven {
|
||||||
@@ -28,6 +29,8 @@ repositories {
|
|||||||
}
|
}
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
|
implementation(libs.bcpg.jdk18on)
|
||||||
|
implementation(libs.sigstore.java)
|
||||||
implementation(libs.revanced.patcher)
|
implementation(libs.revanced.patcher)
|
||||||
implementation(libs.revanced.library)
|
implementation(libs.revanced.library)
|
||||||
implementation(libs.kotlinx.coroutines.core)
|
implementation(libs.kotlinx.coroutines.core)
|
||||||
@@ -59,10 +62,10 @@ tasks {
|
|||||||
}
|
}
|
||||||
|
|
||||||
shadowJar {
|
shadowJar {
|
||||||
|
exclude("/prebuilt/linux/aapt", "/prebuilt/windows/aapt.exe", "/prebuilt/*/aapt_*")
|
||||||
minimize {
|
minimize {
|
||||||
exclude(dependency("org.jetbrains.kotlin:.*"))
|
|
||||||
exclude(dependency("org.bouncycastle:.*"))
|
exclude(dependency("org.bouncycastle:.*"))
|
||||||
exclude(dependency("app.revanced:.*"))
|
exclude(dependency("app.revanced:revanced-patcher"))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -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.0
|
version = 5.0.2-dev.2
|
||||||
|
|||||||
@@ -1,18 +1,22 @@
|
|||||||
[versions]
|
[versions]
|
||||||
shadow = "8.1.1"
|
bcpg-jdk18on = "1.82"
|
||||||
kotlin = "2.0.20"
|
shadow = "9.3.1"
|
||||||
kotlinx = "1.8.1"
|
kotlin = "2.3.0"
|
||||||
picocli = "4.7.6"
|
kotlinx = "1.10.2"
|
||||||
revanced-patcher = "21.0.0"
|
picocli = "4.7.7"
|
||||||
revanced-library = "3.0.2"
|
revanced-patcher = "22.0.0-local"
|
||||||
|
revanced-library = "3.2.0-dev.2-local"
|
||||||
|
sigstore = "2.0.0"
|
||||||
|
|
||||||
[libraries]
|
[libraries]
|
||||||
|
bcpg-jdk18on = { module = "org.bouncycastle:bcpg-jdk18on", version.ref = "bcpg-jdk18on" }
|
||||||
kotlin-test = { module = "org.jetbrains.kotlin:kotlin-test", version.ref = "kotlin" }
|
kotlin-test = { module = "org.jetbrains.kotlin:kotlin-test", version.ref = "kotlin" }
|
||||||
kotlinx-coroutines-core = { module = "org.jetbrains.kotlinx:kotlinx-coroutines-core", version.ref = "kotlinx" }
|
kotlinx-coroutines-core = { module = "org.jetbrains.kotlinx:kotlinx-coroutines-core", version.ref = "kotlinx" }
|
||||||
picocli = { module = "info.picocli:picocli", version.ref = "picocli" }
|
picocli = { module = "info.picocli:picocli", version.ref = "picocli" }
|
||||||
revanced-patcher = { module = "app.revanced:revanced-patcher", version.ref = "revanced-patcher" }
|
revanced-patcher = { module = "app.revanced:revanced-patcher", version.ref = "revanced-patcher" }
|
||||||
revanced-library = { module = "app.revanced:revanced-library-jvm", version.ref = "revanced-library" }
|
revanced-library = { module = "app.revanced:revanced-library-jvm", version.ref = "revanced-library" }
|
||||||
|
sigstore-java = { module = "dev.sigstore:sigstore-java", version.ref = "sigstore" }
|
||||||
|
|
||||||
[plugins]
|
[plugins]
|
||||||
shadow = { id = "com.github.johnrengelman.shadow", version.ref = "shadow" }
|
shadow = { id = "com.gradleup.shadow", version.ref = "shadow" }
|
||||||
kotlin = { id = "org.jetbrains.kotlin.jvm", version.ref = "kotlin" }
|
kotlin = { id = "org.jetbrains.kotlin.jvm", version.ref = "kotlin" }
|
||||||
|
|||||||
BIN
gradle/wrapper/gradle-wrapper.jar
vendored
BIN
gradle/wrapper/gradle-wrapper.jar
vendored
Binary file not shown.
3
gradle/wrapper/gradle-wrapper.properties
vendored
3
gradle/wrapper/gradle-wrapper.properties
vendored
@@ -1,7 +1,6 @@
|
|||||||
distributionBase=GRADLE_USER_HOME
|
distributionBase=GRADLE_USER_HOME
|
||||||
distributionPath=wrapper/dists
|
distributionPath=wrapper/dists
|
||||||
distributionSha256Sum=d725d707bfabd4dfdc958c624003b3c80accc03f7037b5122c4b1d0ef15cecab
|
distributionUrl=https\://services.gradle.org/distributions/gradle-9.2.1-bin.zip
|
||||||
distributionUrl=https\://services.gradle.org/distributions/gradle-8.9-bin.zip
|
|
||||||
networkTimeout=10000
|
networkTimeout=10000
|
||||||
validateDistributionUrl=true
|
validateDistributionUrl=true
|
||||||
zipStoreBase=GRADLE_USER_HOME
|
zipStoreBase=GRADLE_USER_HOME
|
||||||
|
|||||||
7
gradlew
vendored
7
gradlew
vendored
@@ -15,6 +15,8 @@
|
|||||||
# See the License for the specific language governing permissions and
|
# See the License for the specific language governing permissions and
|
||||||
# limitations under the License.
|
# limitations under the License.
|
||||||
#
|
#
|
||||||
|
# SPDX-License-Identifier: Apache-2.0
|
||||||
|
#
|
||||||
|
|
||||||
##############################################################################
|
##############################################################################
|
||||||
#
|
#
|
||||||
@@ -55,7 +57,7 @@
|
|||||||
# Darwin, MinGW, and NonStop.
|
# Darwin, MinGW, and NonStop.
|
||||||
#
|
#
|
||||||
# (3) This script is generated from the Groovy template
|
# (3) This script is generated from the Groovy template
|
||||||
# https://github.com/gradle/gradle/blob/HEAD/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
|
# https://github.com/gradle/gradle/blob/HEAD/platforms/jvm/plugins-application/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
|
||||||
# within the Gradle project.
|
# within the Gradle project.
|
||||||
#
|
#
|
||||||
# You can find Gradle at https://github.com/gradle/gradle/.
|
# You can find Gradle at https://github.com/gradle/gradle/.
|
||||||
@@ -84,7 +86,8 @@ done
|
|||||||
# shellcheck disable=SC2034
|
# shellcheck disable=SC2034
|
||||||
APP_BASE_NAME=${0##*/}
|
APP_BASE_NAME=${0##*/}
|
||||||
# Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036)
|
# Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036)
|
||||||
APP_HOME=$( cd "${APP_HOME:-./}" > /dev/null && pwd -P ) || exit
|
APP_HOME=$( cd -P "${APP_HOME:-./}" > /dev/null && printf '%s
|
||||||
|
' "$PWD" ) || exit
|
||||||
|
|
||||||
# Use the maximum available, or set MAX_FD != -1 to use that value.
|
# Use the maximum available, or set MAX_FD != -1 to use that value.
|
||||||
MAX_FD=maximum
|
MAX_FD=maximum
|
||||||
|
|||||||
2
gradlew.bat
vendored
2
gradlew.bat
vendored
@@ -13,6 +13,8 @@
|
|||||||
@rem See the License for the specific language governing permissions and
|
@rem See the License for the specific language governing permissions and
|
||||||
@rem limitations under the License.
|
@rem limitations under the License.
|
||||||
@rem
|
@rem
|
||||||
|
@rem SPDX-License-Identifier: Apache-2.0
|
||||||
|
@rem
|
||||||
|
|
||||||
@if "%DEBUG%"=="" @echo off
|
@if "%DEBUG%"=="" @echo off
|
||||||
@rem ##########################################################################
|
@rem ##########################################################################
|
||||||
|
|||||||
@@ -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<Patch<*>>.buildString() = let { (index, patch) ->
|
||||||
buildString {
|
buildString {
|
||||||
appendLine("Title: $title")
|
if (withIndex) appendLine("Index: $index")
|
||||||
description?.let { appendLine("Description: $it") }
|
|
||||||
appendLine("Required: $required")
|
|
||||||
default?.let {
|
|
||||||
appendLine("Key: $key")
|
|
||||||
append("Default: $it")
|
|
||||||
} ?: append("Key: $key")
|
|
||||||
|
|
||||||
values?.let { values ->
|
append("Name: ${patch.name}")
|
||||||
appendLine("\nPossible values:")
|
|
||||||
append(values.map { "${it.value} (${it.key})" }.joinToString("\n").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"),
|
||||||
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
append("\nType: $type")
|
if (withPackages && patch.compatiblePackages != null) {
|
||||||
}
|
appendLine("\nCompatible packages:")
|
||||||
|
append(
|
||||||
fun IndexedValue<Patch<*>>.buildString() =
|
patch.compatiblePackages!!.joinToString("\n") {
|
||||||
let { (index, patch) ->
|
it.buildString()
|
||||||
buildString {
|
}.prependIndent("\t"),
|
||||||
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"),
|
|
||||||
)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
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
|
||||||
}
|
}
|
||||||
|
|
||||||
@CommandLine.Option(
|
@ArgGroup(exclusive = false, multiplicity = "0..1")
|
||||||
names = ["-i", "--install"],
|
internal var installation: Installation? = null
|
||||||
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(
|
internal class Installation {
|
||||||
names = ["--mount"],
|
@CommandLine.Option(
|
||||||
description = ["Install the patched APK file by mounting."],
|
names = ["-i", "--install"],
|
||||||
showDefaultValue = ALWAYS,
|
required = true,
|
||||||
)
|
description = ["Serial of the ADB device to install to. If not specified, the first connected device will be used."],
|
||||||
private var mount: Boolean = false
|
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(
|
@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