Skip to content

Commit

Permalink
chore: Merge branch dev to main (#281)
Browse files Browse the repository at this point in the history
  • Loading branch information
oSumAtrIX authored Oct 12, 2023
2 parents df2c137 + 8b04b67 commit a86919e
Show file tree
Hide file tree
Showing 11 changed files with 148 additions and 130 deletions.
21 changes: 21 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,24 @@
## [4.0.2-dev.3](https://github.com/ReVanced/revanced-cli/compare/v4.0.2-dev.2...v4.0.2-dev.3) (2023-10-10)


### Bug Fixes

* Move file to output even when mounting ([59dfc98](https://github.com/ReVanced/revanced-cli/commit/59dfc988e351374eb718923d19bd9bdd94e8d3c0))

## [4.0.2-dev.2](https://github.com/ReVanced/revanced-cli/compare/v4.0.2-dev.1...v4.0.2-dev.2) (2023-10-10)


### Performance Improvements

* Use multiple threads for writing dex files ([28648a1](https://github.com/ReVanced/revanced-cli/commit/28648a1c53520eef8c799504ff61a35947f878b8))

## [4.0.2-dev.1](https://github.com/ReVanced/revanced-cli/compare/v4.0.1...v4.0.2-dev.1) (2023-10-08)


### Bug Fixes

* Use punctuation in option descriptions ([da4469f](https://github.com/ReVanced/revanced-cli/commit/da4469f402c26ad95898404236b0acf0202907e2))

## [4.0.1](https://github.com/ReVanced/revanced-cli/compare/v4.0.0...v4.0.1) (2023-10-08)


Expand Down
7 changes: 7 additions & 0 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,13 @@ plugins {

group = "app.revanced"

repositories {
mavenCentral()
mavenLocal()
google()
maven { url = uri("https://jitpack.io") }
}

dependencies {
implementation(libs.revanced.patcher)
implementation(libs.revanced.library)
Expand Down
4 changes: 1 addition & 3 deletions docs/0_prerequisites.md
Original file line number Diff line number Diff line change
@@ -1,14 +1,12 @@
# 💼 Prerequisites

To use ReVanced CLI, you will need to fulfil specific requirements.
To use ReVanced CLI, you will need to fulfill specific requirements.

## 🤝 Requirements

- Java SDK 11 (Azul Zulu JDK or OpenJDK)
- [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)
- ReVanced Patches
- ReVanced Integrations, if the patches require it

## ⏭️ Whats next

Expand Down
138 changes: 75 additions & 63 deletions docs/1_usage.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,36 +2,17 @@

Learn how to ReVanced CLI.

## ⚡ Setup ADB
## 🔨 Usage

1. Ensure that ADB is working
ReVanced CLI is divided into the following fundamental commands:

```bash
adb shell exit
```

Optionally, you can install the patched APK file on your device by mounting it on top of the original APK file.
You will need root permissions for this. Check if you have root permissions by running the following command:

```bash
adb shell su -c exit
```

2. Get your device's serial

```bash
adb devices
```

## 🔨 Using ReVanced CLI

- ### ⚙️ Show all available options for ReVanced CLI
- ### 🚀 Show all available options for ReVanced CLI

```bash
java -jar revanced-cli.jar -h
```

- ### 📃 List patches from supplied patch bundles
- ### 📃 List patches

```bash
java -jar revanced-cli.jar list-patches \
Expand All @@ -41,7 +22,7 @@ Learn how to ReVanced CLI.
revanced-patches.jar [<patch-bundle> ...]
```

- ### ⚙️ Generate options from patches using ReVanced CLI
- ### ⚙️ Generate options

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.
Expand All @@ -53,59 +34,90 @@ Learn how to ReVanced CLI.
revanced-patches.jar [<patch-bundle> ...]
```

> **Note**: A default `options.json` file will be automatically generated, if it does not exist
> [!NOTE]
> A default `options.json` file will be automatically created, if it does not exist
without any need for intervention when using the `patch` command.

- ### 💉 Use ReVanced CLI to patch an APK file but install without root permissions

This will install the patched APK file regularly on your device.

```bash
java -jar revanced-cli.jar patch \
--patch-bundle revanced-patches.jar \
--out output.apk \
--device-serial <device-serial> \
input.apk
```

- ### 👾 Use ReVanced CLI to patch an APK file but install with root permissions

This will install the patched APK file on your device by mounting it on top of the original APK file.

```bash
adb install input.apk
java -jar revanced-cli.jar patch \
--patch-bundle revanced-patches.jar \
--include some-other-patch \
--exclude some-patch \
--out patched-output.apk \
--device-serial <device-serial> \
--mount \
input.apk
```

> **Note**: Some patches may require integrations
such as [ReVanced Integrations](https://github.com/revanced/revanced-integrations).
Supply them with the option `--merge`. If any patches accepted by ReVanced Patcher require ReVanced Integrations,
they will be merged into the APK file automatically.
- ### 💉 Patch an app

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:

> [!NOTE]
> For ReVanced CLI to be able to install the patched app on your device, make sure ADB is working:
>
> ```bash
> adb shell exit
> ```
>
> To get your device's serial, run the following command:
>
> ```bash
> adb devices
> ```
>
> 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]
> Some patches may require 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.
- #### 👾 Patch an app and install it on your device regularly
```bash
java -jar revanced-cli.jar patch \
--patch-bundle revanced-patches.jar \
--out patched-app.apk \
--device-serial <device-serial> \
input.apk
```
- #### 👾 Patch an app and mount it on top of the un-patched app with root permissions
> [!IMPORTANT]
> Ensure sure the same app you are patching and mounting over is installed on your device:
>
> ```bash
> adb install app.apk
> ```
```bash
java -jar revanced-cli.jar patch \
--patch-bundle revanced-patches.jar \
--include "Some patch" \
--exclude "Some other patch" \
--out patched-app.apk \
--device-serial <device-serial> \
--mount \
app.apk
```
- ### 🗑️ Uninstall an app
- ### 🗑️ Uninstall a patched APK file
```bash
java -jar revanced-cli.jar utility uninstall \
--package-name <package-name> \
<device-serial>
```
> **Note**: You can unmount an APK file
with the option `--unmount`.
> [!NOTE]
> You can unmount an APK file
by adding the option `--unmount`.
- ### ⚙️ Manually install an APK file
- ### ️ 📦 Install an app
```bash
java -jar revanced-cli.jar utility install \
-a input.apk \
<device-serial>
```
> **Note**: You can mount an APK file
by supplying the package name of the app to mount the supplied APK file to over the option `--mount`.
> [!NOTE]
> You can mount an APK file
> by supplying the package name of the app to mount the supplied APK file to over the option `--mount`.
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
org.gradle.parallel = true
org.gradle.caching = true
kotlin.code.style = official
version = 4.0.1
version = 4.0.2-dev.3
6 changes: 3 additions & 3 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,14 @@ shadow = "8.1.1"
kotlin-test = "1.8.20-RC"
kotlinx-coroutines-core = "1.7.3"
picocli = "4.7.3"
revanced-patcher = "16.0.2"
revanced-library = "1.1.2"
revanced-patcher = "17.0.0"
revanced-library = "1.1.3"

[libraries]
kotlin-test = { module = "org.jetbrains.kotlin:kotlin-test", version.ref = "kotlin-test" }
kotlinx-coroutines-core = { module = "org.jetbrains.kotlinx:kotlinx-coroutines-core", version.ref = "kotlinx-coroutines-core" }
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:revanced-patcher", version.ref = "revanced-patcher" }
revanced-library = { module = "app.revanced:revanced-library", version.ref = "revanced-library" }

[plugins]
Expand Down
22 changes: 0 additions & 22 deletions settings.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,23 +1 @@
val githubUsername: String = providers.gradleProperty("gpr.user").orNull ?: System.getenv("GITHUB_ACTOR")
val githubPassword: String = providers.gradleProperty("gpr.key").orNull ?: System.getenv("GITHUB_TOKEN")

dependencyResolutionManagement {
repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
repositories {
mavenCentral()
mavenLocal()
google()
maven { url = uri("https://jitpack.io") }
listOf("revanced-patcher", "jadb").forEach { repo ->
maven {
url = uri("https://maven.pkg.github.com/revanced/$repo")
credentials {
username = githubUsername
password = githubPassword
}
}
}
}
}

rootProject.name = "revanced-cli"
14 changes: 7 additions & 7 deletions src/main/kotlin/app/revanced/cli/command/ListPatchesCommand.kt
Original file line number Diff line number Diff line change
Expand Up @@ -9,41 +9,41 @@ import java.io.File
import java.util.logging.Logger


@Command(name = "list-patches", description = ["List patches from supplied patch bundles"])
@Command(name = "list-patches", description = ["List patches from supplied patch bundles."])
internal object ListPatchesCommand : Runnable {
private val logger = Logger.getLogger(ListPatchesCommand::class.java.name)

@Parameters(
description = ["Paths to patch bundles"], arity = "1..*"
description = ["Paths to patch bundles."], arity = "1..*"
)
private lateinit var patchBundles: Array<File>

@Option(
names = ["-d", "--with-descriptions"], description = ["List their descriptions"], showDefaultValue = ALWAYS
names = ["-d", "--with-descriptions"], description = ["List their descriptions."], showDefaultValue = ALWAYS
)
private var withDescriptions: Boolean = true

@Option(
names = ["-p", "--with-packages"],
description = ["List the packages the patches are compatible with"],
description = ["List the packages the patches are compatible with."],
showDefaultValue = ALWAYS
)
private var withPackages: Boolean = false

@Option(
names = ["-v", "--with-versions"],
description = ["List the versions of the apps the patches are compatible with"],
description = ["List the versions of the apps the patches are compatible with."],
showDefaultValue = ALWAYS
)
private var withVersions: Boolean = false

@Option(
names = ["-o", "--with-options"], description = ["List the options of the patches"], showDefaultValue = ALWAYS
names = ["-o", "--with-options"], description = ["List the options of the patches."], showDefaultValue = ALWAYS
)
private var withOptions: Boolean = false

@Option(
names = ["-f", "--filter-package-name"], description = ["Filter patches by package name"]
names = ["-f", "--filter-package-name"], description = ["Filter patches by package name."]
)
private var packageName: String? = null

Expand Down
2 changes: 1 addition & 1 deletion src/main/kotlin/app/revanced/cli/command/MainCommand.kt
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ private object CLIVersionProvider : IVersionProvider {

@Command(
name = "revanced-cli",
description = ["Command line application to use ReVanced"],
description = ["Command line application to use ReVanced."],
mixinStandardHelpOptions = true,
versionProvider = CLIVersionProvider::class,
subcommands = [
Expand Down
10 changes: 5 additions & 5 deletions src/main/kotlin/app/revanced/cli/command/OptionsCommand.kt
Original file line number Diff line number Diff line change
Expand Up @@ -10,29 +10,29 @@ import java.util.logging.Logger

@CommandLine.Command(
name = "options",
description = ["Generate options file from patches"],
description = ["Generate options file from patches."],
)
internal object OptionsCommand : Runnable {
private val logger = Logger.getLogger(OptionsCommand::class.java.name)

@CommandLine.Parameters(
description = ["Paths to patch bundles"], arity = "1..*"
description = ["Paths to patch bundles."], arity = "1..*"
)
private lateinit var patchBundles: Array<File>

@CommandLine.Option(
names = ["-p", "--path"], description = ["Path to patch options JSON file"], showDefaultValue = ALWAYS
names = ["-p", "--path"], description = ["Path to patch options JSON file."], showDefaultValue = ALWAYS
)
private var filePath: File = File("options.json")

@CommandLine.Option(
names = ["-o", "--overwrite"], description = ["Overwrite existing options file"], showDefaultValue = ALWAYS
names = ["-o", "--overwrite"], description = ["Overwrite existing options file."], showDefaultValue = ALWAYS
)
private var overwrite: Boolean = false

@CommandLine.Option(
names = ["-u", "--update"],
description = ["Update existing options by adding missing and removing non-existent options"],
description = ["Update existing options by adding missing and removing non-existent options."],
showDefaultValue = ALWAYS
)
private var update: Boolean = false
Expand Down
Loading

0 comments on commit a86919e

Please sign in to comment.