mirror of
https://github.com/ReVanced/revanced-cli.git
synced 2026-01-13 14:43:15 +00:00
Compare commits
23 Commits
chore/scri
...
dev
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
731865e167 | ||
|
|
8e18082862 | ||
|
|
77862e8940 | ||
|
|
f29eda8674 | ||
|
|
bba90fede8 | ||
|
|
1717cc66f7 | ||
|
|
0c53a2d1d7 | ||
|
|
a0189aeaee | ||
|
|
19e8422588 | ||
|
|
d908595b22 | ||
|
|
68a48724eb | ||
|
|
bf31de4148 | ||
|
|
63b6350afc | ||
|
|
5d8beae7be | ||
|
|
dbbc00706d | ||
|
|
98ff0c34fa | ||
|
|
77be717de0 | ||
|
|
1bb0d13726 | ||
|
|
18e56e6ff4 | ||
|
|
94b9e2bc6c | ||
|
|
c2dc9d76be | ||
|
|
3d0c8c1526 | ||
|
|
b54308b0e2 |
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
|
||||||
|
|||||||
3
.gitignore
vendored
3
.gitignore
vendored
@@ -123,6 +123,3 @@ options.toml
|
|||||||
|
|
||||||
# Generated by Android projects
|
# Generated by Android projects
|
||||||
local.properties
|
local.properties
|
||||||
|
|
||||||
# Generated by scripts
|
|
||||||
scripts/workspace
|
|
||||||
76
CHANGELOG.md
76
CHANGELOG.md
@@ -1,3 +1,79 @@
|
|||||||
|
## [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)
|
||||||
|
|
||||||
|
|
||||||
|
### Bug Fixes
|
||||||
|
|
||||||
|
* Check for null when no device serial was specified ([1da8ae9](https://github.com/ReVanced/revanced-cli/commit/1da8ae9e46000dd3c4eecd793c559e75012cf535))
|
||||||
|
* List if patch option is required ([#346](https://github.com/ReVanced/revanced-cli/issues/346)) ([98ff0c3](https://github.com/ReVanced/revanced-cli/commit/98ff0c34fa71c3b3ecd96157d45a30ee2b8979c6))
|
||||||
|
* Make CLI ArgGroup non-exclusive to be able to disable and enable patches at the same time ([1bb0d13](https://github.com/ReVanced/revanced-cli/commit/1bb0d13726fd5790c59cb6d28df3618c7606710d))
|
||||||
|
* Make patches selectable by using a mutable collection for the selection option ([751fa1d](https://github.com/ReVanced/revanced-cli/commit/751fa1d889f40c51b291116029fd84f2b051f2f0))
|
||||||
|
* Make the patch command work without specifying any selection ([ba159a3](https://github.com/ReVanced/revanced-cli/commit/ba159a35a9a99d18a4c1e04128b08ae336a49b3e))
|
||||||
|
* Print in new line correctly ([c2dc9d7](https://github.com/ReVanced/revanced-cli/commit/c2dc9d76be33c98284741e23c406500483c47753))
|
||||||
|
* Use the first connected device when no ADB device is specified ([5f952f3](https://github.com/ReVanced/revanced-cli/commit/5f952f35f5cb388b6509b2b4d905b8143ebc7996))
|
||||||
|
|
||||||
|
|
||||||
|
### Features
|
||||||
|
|
||||||
|
* Set patch options via CLI ([#336](https://github.com/ReVanced/revanced-cli/issues/336)) ([2300243](https://github.com/ReVanced/revanced-cli/commit/23002434b2d51c2a3b30b33dd0526261432d90ce))
|
||||||
|
* Show error about no installation device found at the beginning ([3300e6b](https://github.com/ReVanced/revanced-cli/commit/3300e6b4333ed1c4e6785cb82eca9016fc6d4a20))
|
||||||
|
* Simplify command and option names and descriptions ([#338](https://github.com/ReVanced/revanced-cli/issues/338)) ([6e7797a](https://github.com/ReVanced/revanced-cli/commit/6e7797a3f0525a8f48af7182157da0d045600ac2))
|
||||||
|
* Simplify option descriptions ([45c998b](https://github.com/ReVanced/revanced-cli/commit/45c998b335b65ac233fece8b804dc7410142691c))
|
||||||
|
|
||||||
|
|
||||||
|
### BREAKING CHANGES
|
||||||
|
|
||||||
|
* Options have been renamed.
|
||||||
|
* This commit changes various CLI options and removes the `options.json` file. Instead, patch options can now be passed via CLI options
|
||||||
|
|
||||||
|
# [5.0.0-dev.11](https://github.com/ReVanced/revanced-cli/compare/v5.0.0-dev.10...v5.0.0-dev.11) (2024-11-10)
|
||||||
|
|
||||||
|
|
||||||
|
### Bug Fixes
|
||||||
|
|
||||||
|
* List if patch option is required ([#346](https://github.com/ReVanced/revanced-cli/issues/346)) ([98ff0c3](https://github.com/ReVanced/revanced-cli/commit/98ff0c34fa71c3b3ecd96157d45a30ee2b8979c6))
|
||||||
|
|
||||||
|
# [5.0.0-dev.10](https://github.com/ReVanced/revanced-cli/compare/v5.0.0-dev.9...v5.0.0-dev.10) (2024-11-05)
|
||||||
|
|
||||||
|
|
||||||
|
### Bug Fixes
|
||||||
|
|
||||||
|
* Make CLI ArgGroup non-exclusive to be able to disable and enable patches at the same time ([1bb0d13](https://github.com/ReVanced/revanced-cli/commit/1bb0d13726fd5790c59cb6d28df3618c7606710d))
|
||||||
|
|
||||||
|
# [5.0.0-dev.9](https://github.com/ReVanced/revanced-cli/compare/v5.0.0-dev.8...v5.0.0-dev.9) (2024-11-05)
|
||||||
|
|
||||||
|
|
||||||
|
### Bug Fixes
|
||||||
|
|
||||||
|
* Print in new line correctly ([c2dc9d7](https://github.com/ReVanced/revanced-cli/commit/c2dc9d76be33c98284741e23c406500483c47753))
|
||||||
|
|
||||||
# [5.0.0-dev.8](https://github.com/ReVanced/revanced-cli/compare/v5.0.0-dev.7...v5.0.0-dev.8) (2024-10-17)
|
# [5.0.0-dev.8](https://github.com/ReVanced/revanced-cli/compare/v5.0.0-dev.7...v5.0.0-dev.8) (2024-10-17)
|
||||||
|
|
||||||
# [5.0.0-dev.7](https://github.com/ReVanced/revanced-cli/compare/v5.0.0-dev.6...v5.0.0-dev.7) (2024-10-16)
|
# [5.0.0-dev.7](https://github.com/ReVanced/revanced-cli/compare/v5.0.0-dev.6...v5.0.0-dev.7) (2024-10-16)
|
||||||
|
|||||||
@@ -63,11 +63,11 @@
|
|||||||

|

|
||||||

|

|
||||||
|
|
||||||
Command line application to use ReVanced.
|
Command-line application to use ReVanced.
|
||||||
|
|
||||||
## ❓ About
|
## ❓ About
|
||||||
|
|
||||||
ReVanced CLI is a command line application that uses [ReVanced Patcher](https://github.com/revanced/revanced-patcher) to patch Android apps.
|
ReVanced CLI is a command-line application that uses [ReVanced Patcher](https://github.com/revanced/revanced-patcher) to patch Android apps.
|
||||||
|
|
||||||
## 💪 Features
|
## 💪 Features
|
||||||
|
|
||||||
@@ -75,7 +75,7 @@ Some of the features ReVanced CLI provides are:
|
|||||||
|
|
||||||
- 💉 **Patch apps**: Harness ReVanced Patcher to patch Android apps
|
- 💉 **Patch apps**: Harness ReVanced Patcher to patch Android apps
|
||||||
- 💾 **Install and uninstall apps**: Install and uninstall Apps via ADB,
|
- 💾 **Install and uninstall apps**: Install and uninstall Apps via ADB,
|
||||||
using the Android package manager, or by mounting using root permissions
|
using the Android package manager or by mounting using root permissions
|
||||||
- 📃 **List patches from patch bundles**: List available patches, compatible packages, and versions
|
- 📃 **List patches from patch bundles**: List available patches, compatible packages, and versions
|
||||||
- 💪 **Flexibility and functionality**: Apply any combination of patches to any version of Android apps
|
- 💪 **Flexibility and functionality**: Apply any combination of patches to any version of Android apps
|
||||||
|
|
||||||
@@ -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.
|
||||||
|
|||||||
@@ -59,10 +59,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"))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ To use ReVanced CLI, you will need to fulfill specific requirements.
|
|||||||
|
|
||||||
## 🤝 Requirements
|
## 🤝 Requirements
|
||||||
|
|
||||||
- Java Runtime Environment 11 or higher ([Eclipse Temurin JRE](https://adoptium.net/temurin/releases/?package=jre) or [OpenJDK](https://jdk.java.net/archive/))
|
- Java Runtime Environment 11 ([Azul Zulu JRE](https://www.azul.com/downloads/?version=java-11-lts&package=jre#zulu) or [OpenJDK](https://jdk.java.net/archive/))
|
||||||
- [Android Debug Bridge (ADB)](https://developer.android.com/studio/command-line/adb) if you want to install the patched APK file on your device
|
- [Android Debug Bridge (ADB)](https://developer.android.com/studio/command-line/adb) if you want to install the patched APK file on your device
|
||||||
- x86 or x86-64 (For [other architectures](https://github.com/ReVanced/revanced-manager/tree/main/android/app/src/main/jniLibs) use the `--custom-aapt2-binary` option)
|
- x86 or x86-64 (For [other architectures](https://github.com/ReVanced/revanced-manager/tree/main/android/app/src/main/jniLibs) use the `--custom-aapt2-binary` option)
|
||||||
|
|
||||||
|
|||||||
@@ -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-dev.8
|
version = 5.0.2-dev.2
|
||||||
|
|||||||
@@ -3,8 +3,8 @@ shadow = "8.1.1"
|
|||||||
kotlin = "2.0.20"
|
kotlin = "2.0.20"
|
||||||
kotlinx = "1.8.1"
|
kotlinx = "1.8.1"
|
||||||
picocli = "4.7.6"
|
picocli = "4.7.6"
|
||||||
revanced-patcher = "20.0.2"
|
revanced-patcher = "21.0.0"
|
||||||
revanced-library = "3.0.0"
|
revanced-library = "3.1.0"
|
||||||
|
|
||||||
[libraries]
|
[libraries]
|
||||||
kotlin-test = { module = "org.jetbrains.kotlin:kotlin-test", version.ref = "kotlin" }
|
kotlin-test = { module = "org.jetbrains.kotlin:kotlin-test", version.ref = "kotlin" }
|
||||||
|
|||||||
@@ -1,29 +0,0 @@
|
|||||||
@echo off
|
|
||||||
|
|
||||||
echo Check, if OpenJDK/ Eclipse Temurin 11 or newer is installed.
|
|
||||||
pause
|
|
||||||
echo:
|
|
||||||
|
|
||||||
cd modules
|
|
||||||
call run java -version
|
|
||||||
cd ..
|
|
||||||
|
|
||||||
echo:
|
|
||||||
set /P INSTALLED_JAVA=Can you see OpenJDK/ Eclipse Temurin 11 or newer? (y/n)
|
|
||||||
|
|
||||||
if "%INSTALLED_JAVA%"=="y" (
|
|
||||||
echo The environment is set up.
|
|
||||||
pause
|
|
||||||
exit
|
|
||||||
)
|
|
||||||
|
|
||||||
cls
|
|
||||||
echo Install Eclipse Temurin JRE 21.
|
|
||||||
pause
|
|
||||||
|
|
||||||
cd modules
|
|
||||||
call install-java
|
|
||||||
cd ..
|
|
||||||
|
|
||||||
echo The environment is set up. Rerun this script to check your environment.
|
|
||||||
pause
|
|
||||||
@@ -1,11 +0,0 @@
|
|||||||
@echo off
|
|
||||||
|
|
||||||
echo Download necessary files from GitHub.
|
|
||||||
pause
|
|
||||||
|
|
||||||
cd modules
|
|
||||||
call composite download %~dp0\workspace
|
|
||||||
cd ..
|
|
||||||
|
|
||||||
echo Files downloaded.
|
|
||||||
pause
|
|
||||||
@@ -1,14 +0,0 @@
|
|||||||
@echo off
|
|
||||||
setlocal
|
|
||||||
|
|
||||||
echo Patch an APK with the patches in the workspace.
|
|
||||||
pause
|
|
||||||
|
|
||||||
cd modules
|
|
||||||
call composite patch %~dp0\workspace
|
|
||||||
cd ..
|
|
||||||
|
|
||||||
mv %~dp0\workspace\patched.apk %~dp0\patched.apk
|
|
||||||
|
|
||||||
echo Patched APK saved at %~dp0\patched.apk.
|
|
||||||
pause
|
|
||||||
@@ -1,11 +0,0 @@
|
|||||||
@echo off
|
|
||||||
|
|
||||||
echo Clean the workspace.
|
|
||||||
pause
|
|
||||||
|
|
||||||
cd modules
|
|
||||||
call composite clean %~dp0\workspace
|
|
||||||
cd ..
|
|
||||||
|
|
||||||
echo Cleaned workspace.
|
|
||||||
pause
|
|
||||||
@@ -1,8 +0,0 @@
|
|||||||
# 📜 Scripts
|
|
||||||
|
|
||||||
This directory contain click-to-run scripts to use ReVanced CLI.
|
|
||||||
|
|
||||||
## Prerequisites
|
|
||||||
|
|
||||||
- [cURL](https://curl.haxx.se/)
|
|
||||||
- [WinGet](https://aka.ms/getwinget), if you are on Windows
|
|
||||||
@@ -1 +0,0 @@
|
|||||||
notepad modules\env.bat
|
|
||||||
@@ -1,12 +0,0 @@
|
|||||||
@echo off
|
|
||||||
setlocal
|
|
||||||
|
|
||||||
for /f "tokens=8 delims=. " %%a in ('java --version 2^>nul ^| findstr /r "build"') do (
|
|
||||||
set JAVA_VERSION_MAJOR=%%a
|
|
||||||
goto :break
|
|
||||||
)
|
|
||||||
:break
|
|
||||||
|
|
||||||
if %JAVA_VERSION_MAJOR% LSS 11 (
|
|
||||||
echo It looks like Java version is less than 11. Install OpenJDK/ Eclipse Temurin 11 or newer.
|
|
||||||
)
|
|
||||||
@@ -1,51 +0,0 @@
|
|||||||
@echo off
|
|
||||||
setlocal EnableDelayedExpansion
|
|
||||||
|
|
||||||
if "%~1"=="" (
|
|
||||||
set INVALID_ARGS=true
|
|
||||||
)
|
|
||||||
if "%~2"=="" (
|
|
||||||
set INVALID_ARGS=true
|
|
||||||
)
|
|
||||||
if defined INVALID_ARGS (
|
|
||||||
echo Runs curated compositions of scripts.
|
|
||||||
echo:
|
|
||||||
echo Usage: composite ^<script^> ^<workspace^>
|
|
||||||
echo Example: composite patch C:/revanced
|
|
||||||
echo:
|
|
||||||
echo Available commands:
|
|
||||||
echo: download - Download files
|
|
||||||
echo: patch - Patches an application
|
|
||||||
echo: clean - Cleans the workspace
|
|
||||||
echo: env - Check for a valid environment setup
|
|
||||||
exit /b 1
|
|
||||||
)
|
|
||||||
|
|
||||||
call env
|
|
||||||
|
|
||||||
set WORKSPACE=%2
|
|
||||||
|
|
||||||
if "%~1"=="download" (
|
|
||||||
call create %WORKSPACE%
|
|
||||||
|
|
||||||
if not exist %WORKSPACE%/revanced-cli.jar (
|
|
||||||
echo Downloading ReVanced CLI...
|
|
||||||
call download %CLI_REPO% jar %WORKSPACE%/revanced-cli.jar
|
|
||||||
)
|
|
||||||
|
|
||||||
if not exist %WORKSPACE%/patches.rvp (
|
|
||||||
echo Downloading ReVanced patches...
|
|
||||||
call download %PATCHES_REPO% jar %WORKSPACE%/patches.rvp
|
|
||||||
)
|
|
||||||
)
|
|
||||||
if "%~1"=="patch" (
|
|
||||||
set /p APK="Path to the APK file: "
|
|
||||||
|
|
||||||
call patch !APK! %WORKSPACE%
|
|
||||||
)
|
|
||||||
if "%~1"=="clean" (
|
|
||||||
call delete %WORKSPACE%
|
|
||||||
)
|
|
||||||
if "%~1"=="env" (
|
|
||||||
call check-java
|
|
||||||
)
|
|
||||||
@@ -1,19 +0,0 @@
|
|||||||
@echo off
|
|
||||||
setlocal
|
|
||||||
|
|
||||||
if "%~1"=="" (
|
|
||||||
set INVALID_ARGS=true
|
|
||||||
)
|
|
||||||
if defined INVALID_ARGS (
|
|
||||||
echo Creates a directory using the mkdir command.
|
|
||||||
echo:
|
|
||||||
echo Usage: create ^<path^>
|
|
||||||
echo Example: create C:/revanced
|
|
||||||
exit /b 1
|
|
||||||
)
|
|
||||||
|
|
||||||
set DIRECTORY=%1
|
|
||||||
|
|
||||||
if not exist %DIRECTORY% (
|
|
||||||
run "mkdir.exe" -p %DIRECTORY%
|
|
||||||
)
|
|
||||||
@@ -1,20 +0,0 @@
|
|||||||
@echo off
|
|
||||||
setlocal
|
|
||||||
|
|
||||||
if "%~1"=="" (
|
|
||||||
set INVALID_ARGS=true
|
|
||||||
)
|
|
||||||
if defined INVALID_ARGS (
|
|
||||||
echo Deletes a directory relative to the current directory using the rmdir command.
|
|
||||||
echo:
|
|
||||||
echo Usage: delete ^<path^>
|
|
||||||
echo Example: delete C:/revanced
|
|
||||||
exit /b 1
|
|
||||||
)
|
|
||||||
|
|
||||||
set DIRECTORY=%1
|
|
||||||
|
|
||||||
if exist %DIRECTORY% (
|
|
||||||
echo Confirm deletion of
|
|
||||||
run rmdir /s %DIRECTORY%
|
|
||||||
)
|
|
||||||
@@ -1,30 +0,0 @@
|
|||||||
@echo off
|
|
||||||
setlocal
|
|
||||||
|
|
||||||
if "%~1"=="" (
|
|
||||||
set INVALID_ARGS=true
|
|
||||||
)
|
|
||||||
if "%~2"=="" (
|
|
||||||
set INVALID_ARGS=true
|
|
||||||
)
|
|
||||||
if "%~3"=="" (
|
|
||||||
set INVALID_ARGS=true
|
|
||||||
)
|
|
||||||
if defined INVALID_ARGS (
|
|
||||||
echo Downloads a file from a GitHub repository release.
|
|
||||||
echo:
|
|
||||||
echo Usage: download ^<repo^> ^<asset-extension^> ^<out^>
|
|
||||||
echo Example: download revanced/revanced-cli jar C:/revanced/revanced-cli.jar
|
|
||||||
exit /b 1
|
|
||||||
)
|
|
||||||
|
|
||||||
set REPO=%1
|
|
||||||
set ASSET_EXTENSION=%2
|
|
||||||
set OUT=%3
|
|
||||||
|
|
||||||
set URL=https://api.github.com/repos/%REPO%/releases/latest
|
|
||||||
for /f "delims=" %%i in ('curl -s %URL% ^| jq -r ".assets[] | select(.name | endswith(\"%ASSET_EXTENSION%\")) | .browser_download_url"') do (
|
|
||||||
set JAR_URL=%%i
|
|
||||||
)
|
|
||||||
|
|
||||||
run curl --silent --location --output %OUT% %JAR_URL%
|
|
||||||
@@ -1,6 +0,0 @@
|
|||||||
@echo off
|
|
||||||
|
|
||||||
:: Customize your environment.
|
|
||||||
|
|
||||||
set CLI_REPO=revanced/revanced-cli
|
|
||||||
set PATCHES_REPO=revanced/revanced-patches
|
|
||||||
@@ -1 +0,0 @@
|
|||||||
run install EclipseAdoptium.Temurin.21.JRE
|
|
||||||
@@ -1 +0,0 @@
|
|||||||
run install jqlang.jq
|
|
||||||
@@ -1,14 +0,0 @@
|
|||||||
@echo off
|
|
||||||
|
|
||||||
if "%~1"=="" (
|
|
||||||
set INVALID_ARGS=true
|
|
||||||
)
|
|
||||||
if defined INVALID_ARGS (
|
|
||||||
echo Installs a package using winget.
|
|
||||||
echo:
|
|
||||||
echo Usage: install ^<id^>
|
|
||||||
echo Example: install jqlang.jq
|
|
||||||
exit /b 1
|
|
||||||
)
|
|
||||||
|
|
||||||
run winget install -e --id=%1
|
|
||||||
@@ -1,28 +0,0 @@
|
|||||||
@echo off
|
|
||||||
setlocal
|
|
||||||
|
|
||||||
if "%~1"=="" (
|
|
||||||
set INVALID_ARGS=true
|
|
||||||
)
|
|
||||||
if "%~2"=="" (
|
|
||||||
set INVALID_ARGS=true
|
|
||||||
)
|
|
||||||
if defined INVALID_ARGS (
|
|
||||||
echo Patches an application using the specified patches.
|
|
||||||
echo:
|
|
||||||
echo Usage: patch ^<apk^> ^<workspace^>
|
|
||||||
echo Example: patch C:/app.apk C:/workspace
|
|
||||||
exit /b 1
|
|
||||||
)
|
|
||||||
|
|
||||||
set APK=%1
|
|
||||||
set WORKSPACE=%2
|
|
||||||
|
|
||||||
call run java -jar %WORKSPACE%/revanced-cli.jar patch ^
|
|
||||||
--patch-bundle %WORKSPACE%/patches.rvp ^
|
|
||||||
--temporary-files-path %WORKSPACE%/temporary-files ^
|
|
||||||
--out %WORKSPACE%/patched.apk ^
|
|
||||||
--purge ^
|
|
||||||
%APK%
|
|
||||||
|
|
||||||
mv %WORKSPACE%/patched.apk
|
|
||||||
@@ -1,23 +0,0 @@
|
|||||||
@echo off
|
|
||||||
|
|
||||||
if "%~1"=="" (
|
|
||||||
set INVALID_ARGS=true
|
|
||||||
)
|
|
||||||
if defined INVALID_ARGS (
|
|
||||||
echo Run a command with arguments.
|
|
||||||
echo:
|
|
||||||
echo Usage: run.bat ^<command^> [arguments]
|
|
||||||
echo Example: run.bat echo Hello, World!
|
|
||||||
exit /b 1
|
|
||||||
)
|
|
||||||
|
|
||||||
%*
|
|
||||||
|
|
||||||
if %ERRORLEVEL% NEQ 0 (
|
|
||||||
echo:
|
|
||||||
echo Failed to run command with exit code %ERRORLEVEL%.
|
|
||||||
echo Failed command: %*
|
|
||||||
echo:
|
|
||||||
pause
|
|
||||||
exit /b %ERRORLEVEL%
|
|
||||||
)
|
|
||||||
@@ -85,10 +85,10 @@ 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")
|
||||||
default?.let {
|
default?.let {
|
||||||
appendLine("Key: $key")
|
appendLine("Key: $key")
|
||||||
append("Default: $it")
|
append("Default: $it")
|
||||||
@@ -102,16 +102,15 @@ 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("Enabled: ${patch.use}")
|
append("\nEnabled: ${patch.use}")
|
||||||
|
|
||||||
if (withOptions && patch.options.isNotEmpty()) {
|
if (withOptions && patch.options.isNotEmpty()) {
|
||||||
appendLine("\nOptions:")
|
appendLine("\nOptions:")
|
||||||
@@ -133,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()
|
||||||
|
|||||||
@@ -29,11 +29,11 @@ internal object PatchCommand : Runnable {
|
|||||||
@Spec
|
@Spec
|
||||||
private lateinit var spec: CommandSpec
|
private lateinit var spec: CommandSpec
|
||||||
|
|
||||||
@ArgGroup(multiplicity = "0..*")
|
@ArgGroup(exclusive = false, multiplicity = "0..*")
|
||||||
private var selection = mutableSetOf<Selection>()
|
private var selection = mutableSetOf<Selection>()
|
||||||
|
|
||||||
internal class Selection {
|
internal class Selection {
|
||||||
@ArgGroup(exclusive = false, multiplicity = "1")
|
@ArgGroup(exclusive = false)
|
||||||
internal var enabled: EnableSelection? = null
|
internal var enabled: EnableSelection? = null
|
||||||
|
|
||||||
internal class EnableSelection {
|
internal class EnableSelection {
|
||||||
@@ -65,7 +65,7 @@ internal object PatchCommand : Runnable {
|
|||||||
internal var options = mutableMapOf<String, Any?>()
|
internal var options = mutableMapOf<String, Any?>()
|
||||||
}
|
}
|
||||||
|
|
||||||
@ArgGroup(exclusive = false, multiplicity = "1")
|
@ArgGroup(exclusive = false)
|
||||||
internal var disable: DisableSelection? = null
|
internal var disable: DisableSelection? = null
|
||||||
|
|
||||||
internal class DisableSelection {
|
internal class DisableSelection {
|
||||||
@@ -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)
|
||||||
@@ -291,7 +297,6 @@ internal object PatchCommand : Runnable {
|
|||||||
patcherTemporaryFilesPath,
|
patcherTemporaryFilesPath,
|
||||||
aaptBinaryPath?.path,
|
aaptBinaryPath?.path,
|
||||||
patcherTemporaryFilesPath.absolutePath,
|
patcherTemporaryFilesPath.absolutePath,
|
||||||
true,
|
|
||||||
),
|
),
|
||||||
).use { patcher ->
|
).use { patcher ->
|
||||||
val packageName = patcher.context.packageMetadata.packageName
|
val packageName = patcher.context.packageMetadata.packageName
|
||||||
@@ -333,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,
|
||||||
@@ -356,9 +361,7 @@ internal object PatchCommand : Runnable {
|
|||||||
|
|
||||||
// region Install.
|
// region Install.
|
||||||
|
|
||||||
deviceSerial?.let {
|
installation?.deviceSerial?.let {
|
||||||
val deviceSerial = it.ifEmpty { null }
|
|
||||||
|
|
||||||
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