mirror of
https://github.com/revanced/revanced-cli.git
synced 2024-12-04 17:32:53 +01:00
chore: Merge branch dev
to main
(#309)
This commit is contained in:
commit
164d09dec1
3
.editorconfig
Normal file
3
.editorconfig
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
[*.{kt,kts}]
|
||||||
|
ktlint_code_style = intellij_idea
|
||||||
|
ktlint_standard_no-wildcard-imports = disabled
|
22
.github/dependabot.yml
vendored
Normal file
22
.github/dependabot.yml
vendored
Normal file
@ -0,0 +1,22 @@
|
|||||||
|
version: 2
|
||||||
|
updates:
|
||||||
|
- package-ecosystem: github-actions
|
||||||
|
labels: []
|
||||||
|
directory: /
|
||||||
|
target-branch: dev
|
||||||
|
schedule:
|
||||||
|
interval: monthly
|
||||||
|
|
||||||
|
- package-ecosystem: npm
|
||||||
|
labels: []
|
||||||
|
directory: /
|
||||||
|
target-branch: dev
|
||||||
|
schedule:
|
||||||
|
interval: monthly
|
||||||
|
|
||||||
|
- package-ecosystem: gradle
|
||||||
|
labels: []
|
||||||
|
directory: /
|
||||||
|
target-branch: dev
|
||||||
|
schedule:
|
||||||
|
interval: monthly
|
25
.github/workflows/build_pull_request.yml
vendored
Normal file
25
.github/workflows/build_pull_request.yml
vendored
Normal file
@ -0,0 +1,25 @@
|
|||||||
|
name: Build pull request
|
||||||
|
|
||||||
|
on:
|
||||||
|
workflow_dispatch:
|
||||||
|
pull_request:
|
||||||
|
branches:
|
||||||
|
- dev
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
release:
|
||||||
|
name: Build
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- name: Checkout
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
with:
|
||||||
|
fetch-depth: 0
|
||||||
|
|
||||||
|
- name: Cache Gradle
|
||||||
|
uses: burrunan/gradle-cache-action@v1
|
||||||
|
|
||||||
|
- name: Build
|
||||||
|
env:
|
||||||
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
run: ./gradlew build --no-daemon
|
29
.github/workflows/release.yml
vendored
29
.github/workflows/release.yml
vendored
@ -6,10 +6,6 @@ on:
|
|||||||
branches:
|
branches:
|
||||||
- main
|
- main
|
||||||
- dev
|
- dev
|
||||||
pull_request:
|
|
||||||
branches:
|
|
||||||
- main
|
|
||||||
- dev
|
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
release:
|
release:
|
||||||
@ -24,25 +20,30 @@ jobs:
|
|||||||
persist-credentials: false
|
persist-credentials: false
|
||||||
fetch-depth: 0
|
fetch-depth: 0
|
||||||
|
|
||||||
- name: Cache Node modules
|
|
||||||
uses: actions/cache@v3
|
|
||||||
with:
|
|
||||||
path: |
|
|
||||||
node_modules
|
|
||||||
key: npm-${{ hashFiles('package-lock.json') }}
|
|
||||||
|
|
||||||
- name: Cache Gradle
|
- name: Cache Gradle
|
||||||
uses: burrunan/gradle-cache-action@v1
|
uses: burrunan/gradle-cache-action@v1
|
||||||
|
|
||||||
- name: Build
|
- name: Build
|
||||||
env:
|
env:
|
||||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
# Cleaning is necessary to avoid uploading two identical artifacts with different versions
|
run: ./gradlew build clean
|
||||||
run: ./gradlew clean --no-daemon
|
|
||||||
|
|
||||||
- name: Setup semantic-release
|
- name: Setup Node.js
|
||||||
|
uses: actions/setup-node@v4
|
||||||
|
with:
|
||||||
|
node-version: "lts/*"
|
||||||
|
cache: 'npm'
|
||||||
|
|
||||||
|
- name: Install dependencies
|
||||||
run: npm install
|
run: npm install
|
||||||
|
|
||||||
|
- name: Import GPG key
|
||||||
|
uses: crazy-max/ghaction-import-gpg@v6
|
||||||
|
with:
|
||||||
|
gpg_private_key: ${{ secrets.GPG_PRIVATE_KEY }}
|
||||||
|
passphrase: ${{ secrets.GPG_PASSPHRASE }}
|
||||||
|
fingerprint: ${{ env.GPG_FINGERPRINT }}
|
||||||
|
|
||||||
- name: Release
|
- name: Release
|
||||||
env:
|
env:
|
||||||
GITHUB_TOKEN: ${{ secrets.REPOSITORY_PUSH_ACCESS }}
|
GITHUB_TOKEN: ${{ secrets.REPOSITORY_PUSH_ACCESS }}
|
||||||
|
@ -11,7 +11,7 @@ jobs:
|
|||||||
name: Dispatch event to documentation repository
|
name: Dispatch event to documentation repository
|
||||||
if: github.ref == 'refs/heads/main'
|
if: github.ref == 'refs/heads/main'
|
||||||
steps:
|
steps:
|
||||||
- uses: peter-evans/repository-dispatch@v2
|
- uses: peter-evans/repository-dispatch@v3
|
||||||
with:
|
with:
|
||||||
token: ${{ secrets.DOCUMENTATION_REPO_ACCESS_TOKEN }}
|
token: ${{ secrets.DOCUMENTATION_REPO_ACCESS_TOKEN }}
|
||||||
repository: revanced/revanced-documentation
|
repository: revanced/revanced-documentation
|
5
.gitignore
vendored
5
.gitignore
vendored
@ -119,4 +119,7 @@ node_modules/
|
|||||||
|
|
||||||
# ReVanced CLI
|
# ReVanced CLI
|
||||||
revanced-cache/
|
revanced-cache/
|
||||||
options.toml
|
options.toml
|
||||||
|
|
||||||
|
# Generated by an Android project (such as ReVanced Integrations)
|
||||||
|
local.properties
|
@ -31,7 +31,7 @@
|
|||||||
{
|
{
|
||||||
"assets": [
|
"assets": [
|
||||||
{
|
{
|
||||||
"path": "build/libs/*all.jar"
|
"path": "build/libs/*-all*"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
successComment: false
|
successComment: false
|
||||||
|
@ -1,3 +1,12 @@
|
|||||||
|
## [4.4.1-dev.2](https://github.com/ReVanced/revanced-cli/compare/v4.4.1-dev.1...v4.4.1-dev.2) (2024-03-04)
|
||||||
|
|
||||||
|
|
||||||
|
### Bug Fixes
|
||||||
|
|
||||||
|
* Bump dependencies to support BCS keystore ([1c10a77](https://github.com/ReVanced/revanced-cli/commit/1c10a7760d76ea850260ca49b448be7ad121de44))
|
||||||
|
|
||||||
|
## [4.4.1-dev.1](https://github.com/ReVanced/revanced-cli/compare/v4.4.0...v4.4.1-dev.1) (2024-02-21)
|
||||||
|
|
||||||
# [4.4.0](https://github.com/ReVanced/revanced-cli/compare/v4.3.0...v4.4.0) (2023-12-28)
|
# [4.4.0](https://github.com/ReVanced/revanced-cli/compare/v4.3.0...v4.4.0) (2023-12-28)
|
||||||
|
|
||||||
|
|
||||||
|
@ -64,14 +64,14 @@ This document describes how to contribute to ReVanced CLI.
|
|||||||
|
|
||||||
## 📖 Resources to help you get started
|
## 📖 Resources to help you get started
|
||||||
|
|
||||||
* The [documentation](/docs) explains how to use ReVanced CLI
|
- The [documentation](/docs) explains how to use ReVanced CLI
|
||||||
* [Our backlog](https://github.com/orgs/ReVanced/projects/12) is where we keep track of what we're working on
|
- [Our backlog](https://github.com/orgs/ReVanced/projects/12) is where we keep track of what we're working on
|
||||||
* [Issues](https://github.com/ReVanced/revanced-cli/issues) are where we keep track of bugs and feature requests
|
- [Issues](https://github.com/ReVanced/revanced-cli/issues) are where we keep track of bugs and feature requests
|
||||||
|
|
||||||
## 🙏 Submitting a feature request
|
## 🙏 Submitting a feature request
|
||||||
|
|
||||||
Features can be requested by opening an issue using the
|
Features can be requested by opening an issue using the
|
||||||
[Feature request issue template](https://github.com/ReVanced/revanced-cli/issues/new?assignees=&labels=Feature+request&projects=&template=feature-request.yml&title=feat%3A+).
|
[Feature request issue template](https://github.com/ReVanced/revanced-cli/issues/new?assignees=&labels=Feature+request&projects=&template=feature_request.yml&title=feat%3A+).
|
||||||
|
|
||||||
> **Note**
|
> **Note**
|
||||||
> Requests can be accepted or rejected at the discretion of maintainers of ReVanced CLI.
|
> Requests can be accepted or rejected at the discretion of maintainers of ReVanced CLI.
|
||||||
@ -80,7 +80,7 @@ Features can be requested by opening an issue using the
|
|||||||
## 🐞 Submitting a bug report
|
## 🐞 Submitting a bug report
|
||||||
|
|
||||||
If you encounter a bug while using ReVanced CLI, open an issue using the
|
If you encounter a bug while using ReVanced CLI, open an issue using the
|
||||||
[Bug report issue template](https://github.com/ReVanced/revanced-cli/issues/new?assignees=&labels=Bug+report&projects=&template=bug-report.yml&title=bug%3A+).
|
[Bug report issue template](https://github.com/ReVanced/revanced-cli/issues/new?assignees=&labels=Bug+report&projects=&template=bug_report.yml&title=bug%3A+).
|
||||||
|
|
||||||
## 📝 How to contribute
|
## 📝 How to contribute
|
||||||
|
|
||||||
@ -88,11 +88,11 @@ If you encounter a bug while using ReVanced CLI, open an issue using the
|
|||||||
with the maintainers of ReVanced CLI. This will help you determine whether your change is acceptable
|
with the maintainers of ReVanced CLI. This will help you determine whether your change is acceptable
|
||||||
and whether it is worth your time to implement it
|
and whether it is worth your time to implement it
|
||||||
2. Development happens on the `dev` branch. Fork the repository and create your branch from `dev`
|
2. Development happens on the `dev` branch. Fork the repository and create your branch from `dev`
|
||||||
3. Commit your changes.
|
3. Commit your changes
|
||||||
4. Submit a pull request to the `dev` branch of the repository and reference issues
|
4. Submit a pull request to the `dev` branch of the repository and reference issues
|
||||||
that your pull request closes in the description of your pull request
|
that your pull request closes in the description of your pull request
|
||||||
5. Our team will review your pull request and provide feedback. Once your pull request is approved,
|
5. Our team will review your pull request and provide feedback. Once your pull request is approved,
|
||||||
it will be merged into the `dev` branch and will be included in the next release of ReVanced CLI
|
it will be merged into the `dev` branch and will be included in the next release of ReVanced CLI
|
||||||
|
|
||||||
❤️ Thank you for considering contributing to ReVanced CLI,
|
❤️ Thank you for considering contributing to ReVanced CLI,
|
||||||
ReVanced
|
ReVanced
|
||||||
|
30
README.md
30
README.md
@ -67,13 +67,23 @@ Command line application to use ReVanced.
|
|||||||
|
|
||||||
## ❓ About
|
## ❓ About
|
||||||
|
|
||||||
ReVanced CLI is a command line application to patch apps using ReVanced.
|
ReVanced CLI is a command line application that uses [ReVanced Patcher](https://github.com/revanced/revanced-patcher) to patch Android apps.
|
||||||
ReVanced CLI also comes with commands to uninstall or install patched apps and list patches from supplied patch bundles.
|
|
||||||
|
|
||||||
## 🚀 Download
|
## 💪 Features
|
||||||
|
|
||||||
You can download the most recent version of ReVanced CLI from
|
Some of the features ReVanced CLI provides are:
|
||||||
[here](https://github.com/ReVanced/revanced-cli/releases/latest). Learn how to use ReVanced CLI by following the [documentation](/docs).
|
|
||||||
|
- 💉 **Patch apps**: Harness ReVanced Patcher to patch Android apps
|
||||||
|
- 💾 **Install and uninstall apps**: Install and uninstall Apps via ADB,
|
||||||
|
using the Android package manager, or by mounting using root permissions
|
||||||
|
- 📃 **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
|
||||||
|
|
||||||
|
## 🔽 Download
|
||||||
|
|
||||||
|
You can download the most recent version of ReVanced CLI from
|
||||||
|
[here](https://github.com/ReVanced/revanced-cli/releases/latest).
|
||||||
|
Learn how to use ReVanced CLI by following the [documentation](/docs).
|
||||||
|
|
||||||
## 📚 Everything else
|
## 📚 Everything else
|
||||||
|
|
||||||
@ -84,10 +94,14 @@ You can find the contribution guidelines [here](CONTRIBUTING.md).
|
|||||||
|
|
||||||
### 🛠️ Building
|
### 🛠️ Building
|
||||||
|
|
||||||
In order to build ReVanced CLI, you can follow the [documentation](/docs).
|
To build a ReVanced CLI, you can follow the [documentation](/docs).
|
||||||
|
|
||||||
|
### 📃 Documentation
|
||||||
|
|
||||||
|
You can find the documentation of ReVanced CLI [here](/docs).
|
||||||
|
|
||||||
## 📜 Licence
|
## 📜 Licence
|
||||||
|
|
||||||
ReVanced CLI is licensed under the GPLv3 licence. Please see the [licence 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.
|
||||||
Any modifications to ReVanced CLI must also be made available under the GPL along with build & install instructions.
|
Any modifications to ReVanced CLI must also be made available under the GPL, along with build & install instructions.
|
||||||
|
@ -1,15 +1,31 @@
|
|||||||
|
import org.jetbrains.kotlin.gradle.dsl.JvmTarget
|
||||||
|
|
||||||
plugins {
|
plugins {
|
||||||
kotlin("jvm") version "1.9.10"
|
alias(libs.plugins.kotlin)
|
||||||
alias(libs.plugins.shadow)
|
alias(libs.plugins.shadow)
|
||||||
|
application
|
||||||
|
`maven-publish`
|
||||||
|
signing
|
||||||
}
|
}
|
||||||
|
|
||||||
group = "app.revanced"
|
group = "app.revanced"
|
||||||
|
|
||||||
|
application {
|
||||||
|
mainClass = "app.revanced.cli.command.MainCommandKt"
|
||||||
|
}
|
||||||
|
|
||||||
repositories {
|
repositories {
|
||||||
mavenCentral()
|
mavenCentral()
|
||||||
mavenLocal()
|
mavenLocal()
|
||||||
google()
|
google()
|
||||||
maven { url = uri("https://jitpack.io") }
|
maven {
|
||||||
|
// A repository must be speficied for some reason. "registry" is a dummy.
|
||||||
|
url = uri("https://maven.pkg.github.com/revanced/registry")
|
||||||
|
credentials {
|
||||||
|
username = project.findProperty("gpr.user") as String? ?: System.getenv("GITHUB_ACTOR")
|
||||||
|
password = project.findProperty("gpr.key") as String? ?: System.getenv("GITHUB_TOKEN")
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
@ -21,7 +37,15 @@ dependencies {
|
|||||||
testImplementation(libs.kotlin.test)
|
testImplementation(libs.kotlin.test)
|
||||||
}
|
}
|
||||||
|
|
||||||
kotlin { jvmToolchain(11) }
|
kotlin {
|
||||||
|
compilerOptions {
|
||||||
|
jvmTarget.set(JvmTarget.JVM_11)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
java {
|
||||||
|
targetCompatibility = JavaVersion.VERSION_11
|
||||||
|
}
|
||||||
|
|
||||||
tasks {
|
tasks {
|
||||||
test {
|
test {
|
||||||
@ -36,9 +60,6 @@ tasks {
|
|||||||
}
|
}
|
||||||
|
|
||||||
shadowJar {
|
shadowJar {
|
||||||
manifest {
|
|
||||||
attributes("Main-Class" to "app.revanced.cli.command.MainCommandKt")
|
|
||||||
}
|
|
||||||
minimize {
|
minimize {
|
||||||
exclude(dependency("org.jetbrains.kotlin:.*"))
|
exclude(dependency("org.jetbrains.kotlin:.*"))
|
||||||
exclude(dependency("org.bouncycastle:.*"))
|
exclude(dependency("org.bouncycastle:.*"))
|
||||||
@ -46,25 +67,29 @@ tasks {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
build {
|
publish {
|
||||||
dependsOn(shadowJar)
|
dependsOn(shadowJar)
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
// Needed by gradle-semantic-release-plugin.
|
||||||
Dummy task to hack gradle-semantic-release-plugin to release this project.
|
// Tracking: https://github.com/KengoTODA/gradle-semantic-release-plugin/issues/435
|
||||||
|
|
||||||
Explanation:
|
// The maven-publish is also necessary to make the signing plugin work.
|
||||||
SemVer is a standard for versioning libraries.
|
publishing {
|
||||||
For that reason the semantic-release plugin uses the "publish" task to publish libraries.
|
repositories {
|
||||||
However, this subproject is not a library, and the "publish" task is not available for this subproject.
|
mavenLocal()
|
||||||
Because semantic-release is not designed to handle this case, we need to hack it.
|
}
|
||||||
|
|
||||||
RE: https://github.com/KengoTODA/gradle-semantic-release-plugin/issues/435
|
publications {
|
||||||
*/
|
create<MavenPublication>("revanced-cli-publication") {
|
||||||
|
from(components["java"])
|
||||||
register<DefaultTask>("publish") {
|
}
|
||||||
group = "publishing"
|
|
||||||
description = "Dummy task to hack gradle-semantic-release-plugin to release ReVanced CLI"
|
|
||||||
dependsOn(build)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
signing {
|
||||||
|
useGpgCmd()
|
||||||
|
|
||||||
|
sign(publishing.publications["revanced-cli-publication"])
|
||||||
|
}
|
||||||
|
@ -4,7 +4,7 @@ To use ReVanced CLI, you will need to fulfill specific requirements.
|
|||||||
|
|
||||||
## 🤝 Requirements
|
## 🤝 Requirements
|
||||||
|
|
||||||
- Java Runtime Environment 11 (Azul Zulu JRE or OpenJDK)
|
- Java Runtime Environment 11 ([Azul Zulu JRE](https://www.azul.com/downloads/?version=java-11-lts&package=jdk#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
|
||||||
- An ABI other than ARMv7 such as x86 or x86-64 (or a custom AAPT binary that supports ARMv7)
|
- An ABI other than ARMv7 such as x86 or x86-64 (or a custom AAPT binary that supports ARMv7)
|
||||||
|
|
||||||
|
105
docs/1_usage.md
105
docs/1_usage.md
@ -1,6 +1,6 @@
|
|||||||
# 🛠️ Using ReVanced CLI
|
# 🛠️ Using ReVanced CLI
|
||||||
|
|
||||||
Learn how to ReVanced CLI.
|
Learn how to use ReVanced CLI.
|
||||||
|
|
||||||
## 🔨 Usage
|
## 🔨 Usage
|
||||||
|
|
||||||
@ -26,7 +26,7 @@ ReVanced CLI is divided into the following fundamental commands:
|
|||||||
|
|
||||||
This will generate an `options.json` file for the patches from a list of supplied patch bundles.
|
This will generate an `options.json` file for the patches from a list of supplied patch bundles.
|
||||||
The file can be supplied to ReVanced CLI later on.
|
The file can be supplied to ReVanced CLI later on.
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
java -jar revanced-cli.jar options \
|
java -jar revanced-cli.jar options \
|
||||||
--path options.json \
|
--path options.json \
|
||||||
@ -34,71 +34,50 @@ ReVanced CLI is divided into the following fundamental commands:
|
|||||||
revanced-patches.jar [<patch-bundle> ...]
|
revanced-patches.jar [<patch-bundle> ...]
|
||||||
```
|
```
|
||||||
|
|
||||||
> [!NOTE]
|
> **ℹ️ Note**
|
||||||
> A default `options.json` file will be automatically created if it does not exist
|
> A default `options.json` file will be automatically created if it does not exist
|
||||||
without any need for intervention when using the `patch` command.
|
> without any need for intervention when using the `patch` command.
|
||||||
|
|
||||||
- ### 💉 Patch an app
|
- ### 💉 Patch an app
|
||||||
|
|
||||||
You can patch apps by supplying patch bundles and the app to patch.
|
You can patch apps by supplying patch bundles and the app to patch.
|
||||||
After patching, ReVanced CLI can install the patched app on your device using two methods:
|
After patching, ReVanced CLI can install the patched app on your device using two methods:
|
||||||
|
|
||||||
> [!NOTE]
|
> **💡 Tip**
|
||||||
> For ReVanced CLI to be able to install the patched app on your device, make sure ADB is working:
|
> For ReVanced CLI to be able to install the patched app on your device, make sure ADB is working:
|
||||||
>
|
>
|
||||||
> ```bash
|
> ```bash
|
||||||
> adb shell exit
|
> adb shell exit
|
||||||
> ```
|
> ```
|
||||||
>
|
>
|
||||||
> To get your device's serial, run the following command:
|
> If you want to mount the patched app on top of the un-patched app, make sure you have root permissions:
|
||||||
>
|
>
|
||||||
> ```bash
|
> ```bash
|
||||||
> adb devices
|
> adb shell su -c exit
|
||||||
> ```
|
> ```
|
||||||
>
|
|
||||||
> If you want to mount the patched app on top of the un-patched app, make sure you have root permissions:
|
|
||||||
>
|
|
||||||
> ```bash
|
|
||||||
> adb shell su -c exit
|
|
||||||
> ```
|
|
||||||
>
|
|
||||||
|
|
||||||
> [!WARNING]
|
> **⚠️ Warning**
|
||||||
> Some patches may require integrations
|
> Some patches may require integrations
|
||||||
> such as [ReVanced Integrations](https://github.com/revanced/revanced-integrations).
|
> such as [ReVanced Integrations](https://github.com/revanced/revanced-integrations).
|
||||||
> Supply them with the option `--merge`. ReVanced Patcher will automatically determine if they are necessary.
|
> Supply them with the option `--merge`. ReVanced Patcher will automatically determine if they are necessary.
|
||||||
|
|
||||||
- #### 👾 Patch an app and install it on your device regularly
|
- #### 👾 Patch an app and install it on your device regularly
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
java -jar revanced-cli.jar patch \
|
java -jar revanced-cli.jar patch \
|
||||||
--patch-bundle revanced-patches.jar \
|
--patch-bundle revanced-patches.jar \
|
||||||
--device-serial <device-serial> \
|
-d \
|
||||||
input.apk
|
input.apk
|
||||||
```
|
```
|
||||||
|
|
||||||
- #### 👾 Patch an app and mount it on top of the un-patched app with root permissions
|
- #### 👾 Patch an app and mount it on top of the un-patched app with root permissions
|
||||||
|
|
||||||
> [!IMPORTANT]
|
|
||||||
> Ensure that the same app you are patching and mounting over is installed on your device:
|
|
||||||
>
|
|
||||||
> ```bash
|
|
||||||
> adb install app.apk
|
|
||||||
> ```
|
|
||||||
|
|
||||||
> [!NOTE]
|
> **❗ Caution**
|
||||||
> You can use the option `--ii` to include or `--ie` to exclude
|
> Ensure that the same app you are patching and mounting over is installed on your device:
|
||||||
> patches by their index in relation to supplied patch bundles,
|
>
|
||||||
> similarly to the option `--include` and `--exclude`.
|
> ```bash
|
||||||
>
|
> adb install app.apk
|
||||||
> This is useful in case two patches have the same name, and you must include or exclude one.
|
> ```
|
||||||
> The patch index is calculated by the position of the patch in the list of patches
|
|
||||||
> from patch bundles supplied using the option `--patch-bundle`.
|
|
||||||
>
|
|
||||||
> You can list all patches with their indices using the command `list-patches`.
|
|
||||||
>
|
|
||||||
> Keep in mind that the indices can change based on the order of the patch bundles supplied,
|
|
||||||
> as well if the patch bundles are updated because patches can be added or removed.
|
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
java -jar revanced-cli.jar patch \
|
java -jar revanced-cli.jar patch \
|
||||||
@ -106,11 +85,25 @@ without any need for intervention when using the `patch` command.
|
|||||||
--include "Some patch" \
|
--include "Some patch" \
|
||||||
--ii 123 \
|
--ii 123 \
|
||||||
--exclude "Some other patch" \
|
--exclude "Some other patch" \
|
||||||
--device-serial <device-serial> \
|
-d \
|
||||||
--mount \
|
--mount \
|
||||||
app.apk
|
app.apk
|
||||||
```
|
```
|
||||||
|
|
||||||
|
> **💡 Tip**
|
||||||
|
> You can use the option `--ii` to include or `--ie` to exclude
|
||||||
|
> patches by their index in relation to supplied patch bundles,
|
||||||
|
> similarly to the option `--include` and `--exclude`.
|
||||||
|
>
|
||||||
|
> This is useful in case two patches have the same name, and you must include or exclude one.
|
||||||
|
> The patch index is calculated by the position of the patch in the list of patches
|
||||||
|
> from patch bundles supplied using the option `--patch-bundle`.
|
||||||
|
>
|
||||||
|
> You can list all patches with their indices using the command `list-patches`.
|
||||||
|
>
|
||||||
|
> Keep in mind that the indices can change based on the order of the patch bundles supplied,
|
||||||
|
> as well if the patch bundles are updated because patches can be added or removed.
|
||||||
|
|
||||||
- ### 🗑️ Uninstall an app
|
- ### 🗑️ Uninstall an app
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
@ -119,9 +112,9 @@ without any need for intervention when using the `patch` command.
|
|||||||
[<device-serial>]
|
[<device-serial>]
|
||||||
```
|
```
|
||||||
|
|
||||||
> [!NOTE]
|
> **💡 Tip**
|
||||||
> You can unmount an APK file
|
> You can unmount an APK file
|
||||||
by adding the option `--unmount`.
|
> by adding the option `--unmount`.
|
||||||
|
|
||||||
- ### ️ 📦 Install an app
|
- ### ️ 📦 Install an app
|
||||||
|
|
||||||
@ -131,6 +124,6 @@ by adding the option `--unmount`.
|
|||||||
[<device-serial>]
|
[<device-serial>]
|
||||||
```
|
```
|
||||||
|
|
||||||
> [!NOTE]
|
> **💡 Tip**
|
||||||
> You can mount an APK file
|
> You can mount an APK file
|
||||||
> by supplying the package name of the app to mount the supplied APK file over the option `--mount`.
|
> by supplying the app's package name to mount the supplied APK file over the option `-mount`.
|
||||||
|
@ -21,6 +21,6 @@ To build ReVanced CLI, follow these steps:
|
|||||||
|
|
||||||
```bash
|
```bash
|
||||||
./gradlew build
|
./gradlew build
|
||||||
```
|
```
|
||||||
|
|
||||||
After the build succeeds, the built JAR file will be located at `build/libs/revanced-cli-<version>-all.jar`.
|
After the build succeeds, the built JAR file will be located at `build/libs/revanced-cli-<version>-all.jar`.
|
||||||
|
@ -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 = 4.4.0
|
version = 4.4.1-dev.2
|
||||||
|
@ -1,13 +1,13 @@
|
|||||||
[versions]
|
[versions]
|
||||||
shadow = "8.1.1"
|
shadow = "8.1.1"
|
||||||
kotlin-test = "1.9.20"
|
kotlin = "1.9.22"
|
||||||
kotlinx-coroutines-core = "1.7.3"
|
kotlinx-coroutines-core = "1.7.3"
|
||||||
picocli = "4.7.3"
|
picocli = "4.7.5"
|
||||||
revanced-patcher = "19.1.0"
|
revanced-patcher = "19.3.1"
|
||||||
revanced-library = "1.4.0"
|
revanced-library = "2.1.0"
|
||||||
|
|
||||||
[libraries]
|
[libraries]
|
||||||
kotlin-test = { module = "org.jetbrains.kotlin:kotlin-test", version.ref = "kotlin-test" }
|
kotlin-test = { module = "org.jetbrains.kotlin:kotlin-test", version.ref = "kotlin" }
|
||||||
kotlinx-coroutines-core = { module = "org.jetbrains.kotlinx:kotlinx-coroutines-core", version.ref = "kotlinx-coroutines-core" }
|
kotlinx-coroutines-core = { module = "org.jetbrains.kotlinx:kotlinx-coroutines-core", version.ref = "kotlinx-coroutines-core" }
|
||||||
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" }
|
||||||
@ -15,3 +15,4 @@ revanced-library = { module = "app.revanced:revanced-library", version.ref = "re
|
|||||||
|
|
||||||
[plugins]
|
[plugins]
|
||||||
shadow = { id = "com.github.johnrengelman.shadow", version.ref = "shadow" }
|
shadow = { id = "com.github.johnrengelman.shadow", version.ref = "shadow" }
|
||||||
|
kotlin = { id = "org.jetbrains.kotlin.jvm", version.ref = "kotlin" }
|
4
gradle/wrapper/gradle-wrapper.properties
vendored
4
gradle/wrapper/gradle-wrapper.properties
vendored
@ -1,6 +1,6 @@
|
|||||||
distributionBase=GRADLE_USER_HOME
|
distributionBase=GRADLE_USER_HOME
|
||||||
distributionPath=wrapper/dists
|
distributionPath=wrapper/dists
|
||||||
distributionUrl=https\://services.gradle.org/distributions/gradle-8.4-bin.zip
|
distributionUrl=https\://services.gradle.org/distributions/gradle-8.6-bin.zip
|
||||||
distributionSha256Sum=3e1af3ae886920c3ac87f7a91f816c0c7c436f276a6eefdb3da152100fef72ae
|
distributionSha256Sum=9631d53cf3e74bfa726893aee1f8994fee4e060c401335946dba2156f440f24c
|
||||||
zipStoreBase=GRADLE_USER_HOME
|
zipStoreBase=GRADLE_USER_HOME
|
||||||
zipStorePath=wrapper/dist
|
zipStorePath=wrapper/dist
|
5433
package-lock.json
generated
5433
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
@ -1,9 +1,9 @@
|
|||||||
{
|
{
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@saithodev/semantic-release-backmerge": "^3.2.1",
|
"@saithodev/semantic-release-backmerge": "^4.0.1",
|
||||||
"@semantic-release/changelog": "^6.0.3",
|
"@semantic-release/changelog": "^6.0.3",
|
||||||
"@semantic-release/git": "^10.0.1",
|
"@semantic-release/git": "^10.0.1",
|
||||||
"gradle-semantic-release-plugin": "^1.8.0",
|
"gradle-semantic-release-plugin": "^1.9.1",
|
||||||
"semantic-release": "^22.0.8"
|
"semantic-release": "^23.0.2"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,13 +1,15 @@
|
|||||||
package app.revanced.cli.command
|
package app.revanced.cli.command
|
||||||
|
|
||||||
import app.revanced.library.ApkUtils
|
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
|
||||||
import app.revanced.library.Options.setOptions
|
import app.revanced.library.Options.setOptions
|
||||||
import app.revanced.library.adb.AdbManager
|
import app.revanced.library.adb.AdbManager
|
||||||
import app.revanced.patcher.PatchBundleLoader
|
import app.revanced.patcher.PatchBundleLoader
|
||||||
import app.revanced.patcher.PatchSet
|
import app.revanced.patcher.PatchSet
|
||||||
import app.revanced.patcher.Patcher
|
import app.revanced.patcher.Patcher
|
||||||
import app.revanced.patcher.PatcherOptions
|
import app.revanced.patcher.PatcherConfig
|
||||||
import kotlinx.coroutines.runBlocking
|
import kotlinx.coroutines.runBlocking
|
||||||
import picocli.CommandLine
|
import picocli.CommandLine
|
||||||
import picocli.CommandLine.Help.Visibility.ALWAYS
|
import picocli.CommandLine.Help.Visibility.ALWAYS
|
||||||
@ -30,9 +32,9 @@ internal object PatchCommand : Runnable {
|
|||||||
|
|
||||||
private lateinit var apk: File
|
private lateinit var apk: File
|
||||||
|
|
||||||
private var integrations = listOf<File>()
|
private var integrations = setOf<File>()
|
||||||
|
|
||||||
private var patchBundles = emptyList<File>()
|
private var patchBundles = emptySet<File>()
|
||||||
|
|
||||||
@CommandLine.Option(
|
@CommandLine.Option(
|
||||||
names = ["-i", "--include"],
|
names = ["-i", "--include"],
|
||||||
@ -91,7 +93,8 @@ internal object PatchCommand : Runnable {
|
|||||||
@CommandLine.Option(
|
@CommandLine.Option(
|
||||||
names = ["-d", "--device-serial"],
|
names = ["-d", "--device-serial"],
|
||||||
description = ["ADB device serial to install to. If not supplied, the first connected device will be used."],
|
description = ["ADB device serial to install to. If not supplied, the first connected device will be used."],
|
||||||
fallbackValue = "", // Empty string to indicate that the first connected device should be used.
|
// Empty string to indicate that the first connected device should be used.
|
||||||
|
fallbackValue = "",
|
||||||
arity = "0..1",
|
arity = "0..1",
|
||||||
)
|
)
|
||||||
private var deviceSerial: String? = null
|
private var deviceSerial: String? = null
|
||||||
@ -144,6 +147,17 @@ internal object PatchCommand : Runnable {
|
|||||||
description = ["Path to temporary resource cache directory."],
|
description = ["Path to temporary resource cache directory."],
|
||||||
)
|
)
|
||||||
private var resourceCachePath: File? = null
|
private var resourceCachePath: File? = null
|
||||||
|
set(value) {
|
||||||
|
logger.warning("The --resource-cache option is deprecated. Use --temporary-files-patch instead.")
|
||||||
|
field = value
|
||||||
|
temporaryFilesPath = value
|
||||||
|
}
|
||||||
|
|
||||||
|
@CommandLine.Option(
|
||||||
|
names = ["-t", "--temporary-files-path"],
|
||||||
|
description = ["Path to temporary files directory."],
|
||||||
|
)
|
||||||
|
private var temporaryFilesPath: File? = null
|
||||||
|
|
||||||
private var aaptBinaryPath: File? = null
|
private var aaptBinaryPath: File? = null
|
||||||
|
|
||||||
@ -194,11 +208,11 @@ internal object PatchCommand : Runnable {
|
|||||||
required = true,
|
required = true,
|
||||||
)
|
)
|
||||||
@Suppress("unused")
|
@Suppress("unused")
|
||||||
private fun setPatchBundles(patchBundles: Array<File>) {
|
private fun setPatchBundles(patchBundles: Set<File>) {
|
||||||
patchBundles.firstOrNull { !it.exists() }?.let {
|
patchBundles.firstOrNull { !it.exists() }?.let {
|
||||||
throw CommandLine.ParameterException(spec.commandLine(), "Patch bundle ${it.name} does not exist")
|
throw CommandLine.ParameterException(spec.commandLine(), "Patch bundle ${it.name} does not exist")
|
||||||
}
|
}
|
||||||
this.patchBundles = patchBundles.toList()
|
this.patchBundles = patchBundles
|
||||||
}
|
}
|
||||||
|
|
||||||
@CommandLine.Option(
|
@CommandLine.Option(
|
||||||
@ -224,9 +238,9 @@ internal object PatchCommand : Runnable {
|
|||||||
"${apk.nameWithoutExtension}-patched.${apk.extension}",
|
"${apk.nameWithoutExtension}-patched.${apk.extension}",
|
||||||
)
|
)
|
||||||
|
|
||||||
val resourceCachePath =
|
val temporaryFilesPath =
|
||||||
resourceCachePath ?: outputFilePath.parentFile.resolve(
|
temporaryFilesPath ?: outputFilePath.parentFile.resolve(
|
||||||
"${outputFilePath.nameWithoutExtension}-resource-cache",
|
"${outputFilePath.nameWithoutExtension}-temporary-files",
|
||||||
)
|
)
|
||||||
|
|
||||||
val optionsFile =
|
val optionsFile =
|
||||||
@ -259,13 +273,12 @@ internal object PatchCommand : Runnable {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// endregion
|
// endregion
|
||||||
|
val (packageName, patcherResult) = Patcher(
|
||||||
Patcher(
|
PatcherConfig(
|
||||||
PatcherOptions(
|
|
||||||
apk,
|
apk,
|
||||||
resourceCachePath,
|
temporaryFilesPath,
|
||||||
aaptBinaryPath?.path,
|
aaptBinaryPath?.path,
|
||||||
resourceCachePath.absolutePath,
|
temporaryFilesPath.absolutePath,
|
||||||
true,
|
true,
|
||||||
),
|
),
|
||||||
).use { patcher ->
|
).use { patcher ->
|
||||||
@ -282,65 +295,58 @@ internal object PatchCommand : Runnable {
|
|||||||
|
|
||||||
// region Patch
|
// region Patch
|
||||||
|
|
||||||
val patcherResult =
|
patcher.context.packageMetadata.packageName to patcher.apply {
|
||||||
patcher.apply {
|
acceptIntegrations(integrations)
|
||||||
acceptIntegrations(integrations)
|
acceptPatches(filteredPatches)
|
||||||
acceptPatches(filteredPatches.toList())
|
|
||||||
|
|
||||||
// Execute patches.
|
// Execute patches.
|
||||||
runBlocking {
|
runBlocking {
|
||||||
apply(false).collect { patchResult ->
|
apply(false).collect { patchResult ->
|
||||||
patchResult.exception?.let {
|
patchResult.exception?.let {
|
||||||
StringWriter().use { writer ->
|
StringWriter().use { writer ->
|
||||||
it.printStackTrace(PrintWriter(writer))
|
it.printStackTrace(PrintWriter(writer))
|
||||||
logger.severe("${patchResult.patch.name} failed:\n$writer")
|
logger.severe("${patchResult.patch.name} failed:\n$writer")
|
||||||
}
|
}
|
||||||
} ?: logger.info("${patchResult.patch.name} succeeded")
|
} ?: logger.info("${patchResult.patch.name} succeeded")
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}.get()
|
|
||||||
|
|
||||||
// endregion
|
|
||||||
|
|
||||||
// region Save
|
|
||||||
|
|
||||||
val alignedFile =
|
|
||||||
resourceCachePath.resolve(apk.name).apply {
|
|
||||||
ApkUtils.copyAligned(apk, this, patcherResult)
|
|
||||||
}
|
}
|
||||||
|
}.get()
|
||||||
if (!mount) {
|
|
||||||
ApkUtils.sign(
|
|
||||||
alignedFile,
|
|
||||||
outputFilePath,
|
|
||||||
ApkUtils.SigningOptions(
|
|
||||||
keystoreFilePath,
|
|
||||||
keyStorePassword,
|
|
||||||
alias,
|
|
||||||
password,
|
|
||||||
signer,
|
|
||||||
),
|
|
||||||
)
|
|
||||||
} else {
|
|
||||||
alignedFile.renameTo(outputFilePath)
|
|
||||||
}
|
|
||||||
|
|
||||||
logger.info("Saved to $outputFilePath")
|
|
||||||
|
|
||||||
// endregion
|
|
||||||
|
|
||||||
// region Install
|
|
||||||
|
|
||||||
deviceSerial?.let { serial ->
|
|
||||||
AdbManager.getAdbManager(deviceSerial = serial.ifEmpty { null }, mount)
|
|
||||||
}?.install(AdbManager.Apk(outputFilePath, patcher.context.packageMetadata.packageName))
|
|
||||||
|
|
||||||
// endregion
|
// endregion
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// region Save
|
||||||
|
|
||||||
|
apk.copyTo(outputFilePath, overwrite = true)
|
||||||
|
|
||||||
|
patcherResult.applyTo(outputFilePath)
|
||||||
|
|
||||||
|
if (!mount) {
|
||||||
|
outputFilePath.sign(
|
||||||
|
ApkUtils.SigningOptions(
|
||||||
|
keystoreFilePath,
|
||||||
|
keyStorePassword,
|
||||||
|
alias,
|
||||||
|
password,
|
||||||
|
signer,
|
||||||
|
),
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
logger.info("Saved to $outputFilePath")
|
||||||
|
|
||||||
|
// endregion
|
||||||
|
|
||||||
|
// region Install
|
||||||
|
|
||||||
|
deviceSerial?.let { serial ->
|
||||||
|
AdbManager.getAdbManager(deviceSerial = serial.ifEmpty { null }, mount)
|
||||||
|
}?.install(AdbManager.Apk(outputFilePath, packageName))
|
||||||
|
|
||||||
|
// endregion
|
||||||
|
|
||||||
if (purge) {
|
if (purge) {
|
||||||
logger.info("Purging temporary files")
|
logger.info("Purging temporary files")
|
||||||
purge(resourceCachePath)
|
purge(temporaryFilesPath)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user