Skip to content

Commit

Permalink
feat: use separate command to patch
Browse files Browse the repository at this point in the history
  • Loading branch information
oSumAtrIX committed Aug 23, 2023
1 parent 8a5daab commit 32da961
Show file tree
Hide file tree
Showing 12 changed files with 547 additions and 112 deletions.
2 changes: 1 addition & 1 deletion docs/0_prerequisites.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ To use ReVanced CLI, you will need to fulfil 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 deploy 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)
- ReVanced Patches
- ReVanced Integrations, if the patches require it
Expand Down
32 changes: 15 additions & 17 deletions docs/1_usage.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ Learn how to ReVanced CLI.
adb shell exit
```

If you want to deploy the patched APK file on your device by mounting it on top of the original APK file, you will need root access. This is optional.
If you want to install the patched APK file on your device by mounting it on top of the original APK file, you will need root access. This is optional.

```bash
adb shell su -c exit
Expand All @@ -33,8 +33,7 @@ Learn how to ReVanced CLI.
- ### 📃 List patches from supplied patch bundles

```bash
java -jar revanced-cli.jar \
list-patches \
java -jar revanced-cli.jar list-patches \
--with-packages \
--with-versions \
--with-options \
Expand All @@ -49,40 +48,39 @@ Learn how to ReVanced CLI.

> **Note**: The `options.json` file will be generated at the first time you use ReVanced CLI to patch an APK file for now. This will be changed in the future.

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

This will deploy the patched APK file on your device by installing it.
This will install the patched APK file regularly on your device.

```bash
java -jar revanced-cli.jar \
-a input.apk \
-o patched-output.apk \
java -jar revanced-cli.jar patch \
-b revanced-patches.jar \
-d device-serial
-o patched-output.apk \
-d device-serial \
input-apk
```

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

This will deploy the patched APK file on your device by mounting it on top of the original APK file.
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 \
-a input.apk \
java -jar revanced-cli.jar patch \
-o patched-output.apk \
-b revanced-patches.jar \
-e vanced-microg-support \
-e some-patch \
-d device-serial \
--mount
--mount \
input-apk
```

> **Note**: Some patches from [ReVanced Patches](https://github.com/revanced/revanced-patches) also require [ReVanced Integrations](https://github.com/revanced/revanced-integrations). Supply them with the option `-m`. ReVanced Patcher will merge ReVanced Integrations automatically, depending on if the supplied patches require them.
package

- ### 🗑️ Uninstall a patched
```bash
java -jar revanced-cli.jar \
uninstall \
java -jar revanced-cli.jar uninstall \
-p package-name \
device-serial
```
37 changes: 0 additions & 37 deletions src/main/kotlin/app/revanced/cli/aligning/Aligning.kt

This file was deleted.

39 changes: 39 additions & 0 deletions src/main/kotlin/app/revanced/cli/command/Main.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
package app.revanced.cli.command

import app.revanced.cli.logging.impl.DefaultCliLogger
import app.revanced.patcher.patch.PatchClass
import picocli.CommandLine
import picocli.CommandLine.Command
import picocli.CommandLine.IVersionProvider
import java.util.*

fun main(args: Array<String>) {
CommandLine(Main).execute(*args)
}

internal typealias PatchList = List<PatchClass>

internal val logger = DefaultCliLogger()

object CLIVersionProvider : IVersionProvider {
override fun getVersion(): Array<String> {
Properties().apply {
load(Main::class.java.getResourceAsStream("/app/revanced/cli/version.properties"))
}.let {
return arrayOf("ReVanced CLI v${it.getProperty("version")}")
}
}
}

@Command(
name = "revanced-cli",
description = ["Command line application to use ReVanced"],
mixinStandardHelpOptions = true,
versionProvider = CLIVersionProvider::class,
subcommands = [
ListPatchesCommand::class,
PatchCommand::class,
UninstallCommand::class
]
)
internal object Main
Loading

0 comments on commit 32da961

Please sign in to comment.