mirror of
https://github.com/ReVanced/revanced-cli.git
synced 2026-01-18 08:53:58 +00:00
Compare commits
43 Commits
v2.18.0-de
...
v2.20.0-de
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
9888b0e08e | ||
|
|
51c04b7b16 | ||
|
|
a39cf893d6 | ||
|
|
6485e477a1 | ||
|
|
4edc325978 | ||
|
|
d15505adaa | ||
|
|
aaf452a103 | ||
|
|
1753a1aa3e | ||
|
|
f4e74cb4f2 | ||
|
|
50df4e117e | ||
|
|
9fcd2b4cd1 | ||
|
|
e6bb05c0b9 | ||
|
|
6bd7d42e32 | ||
|
|
19200eacc1 | ||
|
|
666738ee57 | ||
|
|
961267b8cd | ||
|
|
6b7314a399 | ||
|
|
c8a47c51df | ||
|
|
72d8f73d7f | ||
|
|
1957a2c4ff | ||
|
|
07a423b19e | ||
|
|
31e4a41dd2 | ||
|
|
8284c1048f | ||
|
|
9c64f5ec3e | ||
|
|
f4c447e71b | ||
|
|
b69e784785 | ||
|
|
ccce9c926d | ||
|
|
dc4ab22f41 | ||
|
|
25d8ad4aaf | ||
|
|
3d9436e691 | ||
|
|
ee70423527 | ||
|
|
d5794b94ca | ||
|
|
3160d894da | ||
|
|
545597959a | ||
|
|
a6db0edc70 | ||
|
|
ff0d3dd224 | ||
|
|
d9a1fd33ed | ||
|
|
ad81a1b656 | ||
|
|
8c2aeff2cf | ||
|
|
eb6c659f5b | ||
|
|
bac4f839c9 | ||
|
|
c1e7215d31 | ||
|
|
9b9fad7cc0 |
3
.github/workflows/pull_request.yml
vendored
3
.github/workflows/pull_request.yml
vendored
@@ -7,10 +7,11 @@ on:
|
|||||||
workflow_dispatch:
|
workflow_dispatch:
|
||||||
|
|
||||||
env:
|
env:
|
||||||
MESSAGE: merge branch \`${{ github.head_ref || github.ref_name }}\` to \`main\`
|
MESSAGE: merge branch `${{ github.head_ref || github.ref_name }}` to `main`
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
pull-request:
|
pull-request:
|
||||||
|
name: Open pull request
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout
|
- name: Checkout
|
||||||
|
|||||||
7
.github/workflows/release.yml
vendored
7
.github/workflows/release.yml
vendored
@@ -1,4 +1,5 @@
|
|||||||
name: Release
|
name: Release
|
||||||
|
|
||||||
on:
|
on:
|
||||||
workflow_dispatch:
|
workflow_dispatch:
|
||||||
push:
|
push:
|
||||||
@@ -9,6 +10,7 @@ on:
|
|||||||
branches:
|
branches:
|
||||||
- main
|
- main
|
||||||
- dev
|
- dev
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
release:
|
release:
|
||||||
name: Release
|
name: Release
|
||||||
@@ -17,6 +19,9 @@ jobs:
|
|||||||
- name: Checkout
|
- name: Checkout
|
||||||
uses: actions/checkout@v3
|
uses: actions/checkout@v3
|
||||||
with:
|
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
|
fetch-depth: 0
|
||||||
- name: Setup JDK
|
- name: Setup JDK
|
||||||
uses: actions/setup-java@v3
|
uses: actions/setup-java@v3
|
||||||
@@ -30,7 +35,7 @@ jobs:
|
|||||||
node-version: "latest"
|
node-version: "latest"
|
||||||
cache: 'npm'
|
cache: 'npm'
|
||||||
- name: Setup semantic-release
|
- name: Setup semantic-release
|
||||||
run: npm install semantic-release @saithodev/semantic-release-backmerge @semantic-release/git @semantic-release/changelog gradle-semantic-release-plugin -D
|
run: npm install semantic-release@19.0.5 @saithodev/semantic-release-backmerge @semantic-release/git @semantic-release/changelog gradle-semantic-release-plugin@1.7.4 -D
|
||||||
- name: Create release
|
- name: Create release
|
||||||
env:
|
env:
|
||||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
|||||||
18
.github/workflows/update-documentation.yml
vendored
Normal file
18
.github/workflows/update-documentation.yml
vendored
Normal file
@@ -0,0 +1,18 @@
|
|||||||
|
name: Update documentation
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
paths:
|
||||||
|
- docs/**
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
trigger:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
name: Dispatch event to documentation repository
|
||||||
|
steps:
|
||||||
|
- uses: peter-evans/repository-dispatch@v2
|
||||||
|
with:
|
||||||
|
token: ${{ secrets.DOCUMENTATION_REPO_ACCESS_TOKEN }}
|
||||||
|
repository: revanced/revanced-documentation
|
||||||
|
event-type: update-documentation
|
||||||
|
client-payload: '{"repo": "${{ github.event.repository.name }}", "ref": "${{ github.ref }}"}'
|
||||||
118
CHANGELOG.md
118
CHANGELOG.md
@@ -1,3 +1,121 @@
|
|||||||
|
# [2.20.0-dev.3](https://github.com/revanced/revanced-cli/compare/v2.20.0-dev.2...v2.20.0-dev.3) (2023-01-15)
|
||||||
|
|
||||||
|
|
||||||
|
### Bug Fixes
|
||||||
|
|
||||||
|
* bump patcher dependency version ([51c04b7](https://github.com/revanced/revanced-cli/commit/51c04b7b162ad2876bbeb248b7ccddd105b5076d))
|
||||||
|
|
||||||
|
# [2.20.0-dev.2](https://github.com/revanced/revanced-cli/compare/v2.20.0-dev.1...v2.20.0-dev.2) (2023-01-15)
|
||||||
|
|
||||||
|
|
||||||
|
### Features
|
||||||
|
|
||||||
|
* connect to first device if given device was not found ([6485e47](https://github.com/revanced/revanced-cli/commit/6485e477a10bb89dfb2e40f3596d72b20bf23cc8))
|
||||||
|
|
||||||
|
# [2.20.0](https://github.com/revanced/revanced-cli/compare/v2.19.0...v2.20.0) (2023-01-02)
|
||||||
|
|
||||||
|
|
||||||
|
### Bug Fixes
|
||||||
|
|
||||||
|
* do not list compatible packages if patches do not define them ([31e4a41](https://github.com/revanced/revanced-cli/commit/31e4a41dd20f5fa62f840cd8e3b92fe0814eda87))
|
||||||
|
|
||||||
|
|
||||||
|
### Features
|
||||||
|
|
||||||
|
* remove option `--with-descriptions` ([07a423b](https://github.com/revanced/revanced-cli/commit/07a423b19ec72e9f020aeb0222f4ced571036dbe))
|
||||||
|
|
||||||
|
# [2.20.0](https://github.com/revanced/revanced-cli/compare/v2.19.0...v2.20.0) (2023-01-01)
|
||||||
|
|
||||||
|
|
||||||
|
### Bug Fixes
|
||||||
|
|
||||||
|
* do not list compatible packages if patches do not define them ([31e4a41](https://github.com/revanced/revanced-cli/commit/31e4a41dd20f5fa62f840cd8e3b92fe0814eda87))
|
||||||
|
|
||||||
|
|
||||||
|
### Features
|
||||||
|
|
||||||
|
* remove option `--with-descriptions` ([07a423b](https://github.com/revanced/revanced-cli/commit/07a423b19ec72e9f020aeb0222f4ced571036dbe))
|
||||||
|
|
||||||
|
# [2.20.0-dev.1](https://github.com/revanced/revanced-cli/compare/v2.19.0...v2.20.0-dev.1) (2023-01-01)
|
||||||
|
|
||||||
|
|
||||||
|
### Bug Fixes
|
||||||
|
|
||||||
|
* do not list compatible packages if patches do not define them ([31e4a41](https://github.com/revanced/revanced-cli/commit/31e4a41dd20f5fa62f840cd8e3b92fe0814eda87))
|
||||||
|
|
||||||
|
|
||||||
|
### Features
|
||||||
|
|
||||||
|
* remove option `--with-descriptions` ([07a423b](https://github.com/revanced/revanced-cli/commit/07a423b19ec72e9f020aeb0222f4ced571036dbe))
|
||||||
|
|
||||||
|
# [2.19.0](https://github.com/revanced/revanced-cli/compare/v2.18.2...v2.19.0) (2022-12-31)
|
||||||
|
|
||||||
|
|
||||||
|
### Features
|
||||||
|
|
||||||
|
* improve description of options ([#185](https://github.com/revanced/revanced-cli/issues/185)) ([b69e784](https://github.com/revanced/revanced-cli/commit/b69e784785f7f262f83b35c4f241c90036169fc7))
|
||||||
|
|
||||||
|
# [2.19.0-dev.1](https://github.com/revanced/revanced-cli/compare/v2.18.2...v2.19.0-dev.1) (2022-12-31)
|
||||||
|
|
||||||
|
|
||||||
|
### Features
|
||||||
|
|
||||||
|
* improve description of options ([#185](https://github.com/revanced/revanced-cli/issues/185)) ([b69e784](https://github.com/revanced/revanced-cli/commit/b69e784785f7f262f83b35c4f241c90036169fc7))
|
||||||
|
|
||||||
|
## [2.18.2](https://github.com/revanced/revanced-cli/compare/v2.18.1...v2.18.2) (2022-12-16)
|
||||||
|
|
||||||
|
|
||||||
|
### Bug Fixes
|
||||||
|
|
||||||
|
* exclude patcher dependency from minimizing ([d5794b9](https://github.com/revanced/revanced-cli/commit/d5794b94ca19c9287190a3b863c97a089893cc07))
|
||||||
|
|
||||||
|
## [2.18.2-dev.1](https://github.com/revanced/revanced-cli/compare/v2.18.1...v2.18.2-dev.1) (2022-12-16)
|
||||||
|
|
||||||
|
|
||||||
|
### Bug Fixes
|
||||||
|
|
||||||
|
* exclude patcher dependency from minimizing ([d5794b9](https://github.com/revanced/revanced-cli/commit/d5794b94ca19c9287190a3b863c97a089893cc07))
|
||||||
|
|
||||||
|
## [2.18.1](https://github.com/revanced/revanced-cli/compare/v2.18.0...v2.18.1) (2022-12-15)
|
||||||
|
|
||||||
|
|
||||||
|
### Bug Fixes
|
||||||
|
|
||||||
|
* don't log when package is incompatible and `exclusive` option is used ([ad81a1b](https://github.com/revanced/revanced-cli/commit/ad81a1b656586226f8b7b8d1123c52b0f3f2e6f7))
|
||||||
|
|
||||||
|
## [2.18.1-dev.1](https://github.com/revanced/revanced-cli/compare/v2.18.0...v2.18.1-dev.1) (2022-12-15)
|
||||||
|
|
||||||
|
|
||||||
|
### Bug Fixes
|
||||||
|
|
||||||
|
* don't log when package is incompatible and `exclusive` option is used ([ad81a1b](https://github.com/revanced/revanced-cli/commit/ad81a1b656586226f8b7b8d1123c52b0f3f2e6f7))
|
||||||
|
|
||||||
|
# [2.18.0](https://github.com/revanced/revanced-cli/compare/v2.17.0...v2.18.0) (2022-12-15)
|
||||||
|
|
||||||
|
|
||||||
|
### Bug Fixes
|
||||||
|
|
||||||
|
* start with uppercase in log message ([ae91b0d](https://github.com/revanced/revanced-cli/commit/ae91b0d597b107a152e1b630b8c16a795a7ca3b3))
|
||||||
|
* use correct prefix in log message ([1a67cd8](https://github.com/revanced/revanced-cli/commit/1a67cd81da5ed7f259b6dbaeb66a7eef4a113034))
|
||||||
|
|
||||||
|
|
||||||
|
### Features
|
||||||
|
|
||||||
|
* simplify log message ([74d73ca](https://github.com/revanced/revanced-cli/commit/74d73ca3a7ba2f5da872fe9a241629e1c143cd4e))
|
||||||
|
|
||||||
|
# [2.18.0](https://github.com/revanced/revanced-cli/compare/v2.17.0...v2.18.0) (2022-12-15)
|
||||||
|
|
||||||
|
|
||||||
|
### Bug Fixes
|
||||||
|
|
||||||
|
* start with uppercase in log message ([ae91b0d](https://github.com/revanced/revanced-cli/commit/ae91b0d597b107a152e1b630b8c16a795a7ca3b3))
|
||||||
|
* use correct prefix in log message ([1a67cd8](https://github.com/revanced/revanced-cli/commit/1a67cd81da5ed7f259b6dbaeb66a7eef4a113034))
|
||||||
|
|
||||||
|
|
||||||
|
### Features
|
||||||
|
|
||||||
|
* simplify log message ([74d73ca](https://github.com/revanced/revanced-cli/commit/74d73ca3a7ba2f5da872fe9a241629e1c143cd4e))
|
||||||
|
|
||||||
# [2.18.0-dev.1](https://github.com/revanced/revanced-cli/compare/v2.17.1-dev.2...v2.18.0-dev.1) (2022-12-15)
|
# [2.18.0-dev.1](https://github.com/revanced/revanced-cli/compare/v2.17.1-dev.2...v2.18.0-dev.1) (2022-12-15)
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -25,10 +25,10 @@ repositories {
|
|||||||
dependencies {
|
dependencies {
|
||||||
implementation(kotlin("reflect"))
|
implementation(kotlin("reflect"))
|
||||||
|
|
||||||
implementation("app.revanced:revanced-patcher:6.3.1")
|
implementation("app.revanced:revanced-patcher:6.4.1")
|
||||||
implementation("info.picocli:picocli:4.7.0")
|
implementation("info.picocli:picocli:4.7.0")
|
||||||
implementation("com.android.tools.build:apksig:7.2.1")
|
|
||||||
implementation("com.github.revanced:jadb:master-SNAPSHOT") // updated fork
|
implementation("com.github.revanced:jadb:master-SNAPSHOT") // updated fork
|
||||||
|
implementation("com.android.tools.build:apksig:7.2.1")
|
||||||
implementation("org.bouncycastle:bcpkix-jdk15on:1.70")
|
implementation("org.bouncycastle:bcpkix-jdk15on:1.70")
|
||||||
implementation("cc.ekblad:4koma:1.1.0")
|
implementation("cc.ekblad:4koma:1.1.0")
|
||||||
}
|
}
|
||||||
@@ -43,6 +43,8 @@ tasks {
|
|||||||
}
|
}
|
||||||
minimize {
|
minimize {
|
||||||
exclude(dependency("org.jetbrains.kotlin:.*"))
|
exclude(dependency("org.jetbrains.kotlin:.*"))
|
||||||
|
exclude(dependency("org.bouncycastle:.*"))
|
||||||
|
exclude(dependency("app.revanced:.*"))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// Dummy task to fix the Gradle semantic-release plugin.
|
// Dummy task to fix the Gradle semantic-release plugin.
|
||||||
|
|||||||
17
docs/0_prerequisites.md
Normal file
17
docs/0_prerequisites.md
Normal file
@@ -0,0 +1,17 @@
|
|||||||
|
# 💼 Prerequisites
|
||||||
|
|
||||||
|
To use the ReVanced CLI, you will need to fulfill certain requirements.
|
||||||
|
|
||||||
|
## 🤝 Requirements
|
||||||
|
|
||||||
|
- [Android Debug Bridge (adb)](https://developer.android.com/studio/command-line/adb), the command-line tool that lets
|
||||||
|
you communicate with a device (optional).
|
||||||
|
- A x86/x86_64 host (or a custom AAPT binary for your architecture)
|
||||||
|
- Zulu OpenJDK 17
|
||||||
|
- An APK file (e.g. YouTube v17.49.37 or YouTube Music v5.36.51)
|
||||||
|
|
||||||
|
## ⏭️ Whats next
|
||||||
|
|
||||||
|
The next section will show, how to use the [ReVanced CLI](https://github.com/revanced/revanced-cli).
|
||||||
|
|
||||||
|
Continue: [🛠️ Using the ReVanced CLI](1_usage.md)
|
||||||
75
docs/1_usage.md
Normal file
75
docs/1_usage.md
Normal file
@@ -0,0 +1,75 @@
|
|||||||
|
# 🛠️ Using the ReVanced CLI
|
||||||
|
|
||||||
|
Lean how to use the ReVanced CLI.
|
||||||
|
|
||||||
|
## ⚡ Setup (optional)
|
||||||
|
|
||||||
|
1. Make sure your device is connected
|
||||||
|
|
||||||
|
```bash
|
||||||
|
adb shell exit
|
||||||
|
```
|
||||||
|
|
||||||
|
If you plan to use the root variant, check if you have root access
|
||||||
|
|
||||||
|
```bash
|
||||||
|
adb shell su -c exit
|
||||||
|
```
|
||||||
|
|
||||||
|
2. Copy the ADB device name
|
||||||
|
|
||||||
|
```bash
|
||||||
|
adb devices
|
||||||
|
```
|
||||||
|
|
||||||
|
## 🔨 ReVanced CLI Usage
|
||||||
|
|
||||||
|
- ### Show all available options for the ReVanced CLI
|
||||||
|
|
||||||
|
```bash
|
||||||
|
java -jar revanced-cli.jar -h
|
||||||
|
```
|
||||||
|
|
||||||
|
- ### List all available patches from supplied patch bundles
|
||||||
|
|
||||||
|
```bash
|
||||||
|
java -jar revanced-cli.jar \
|
||||||
|
-b revanced-patches.jar \
|
||||||
|
-l
|
||||||
|
```
|
||||||
|
|
||||||
|
- ### Use the ReVanced CLI without root permissions
|
||||||
|
|
||||||
|
```bash
|
||||||
|
java -jar revanced-cli.jar \
|
||||||
|
-a input.apk \
|
||||||
|
-c \
|
||||||
|
-o unpatched-output.apk \
|
||||||
|
-b revanced-patches.jar
|
||||||
|
```
|
||||||
|
|
||||||
|
- ### Mount the patched application with root permissions over the installed application
|
||||||
|
|
||||||
|
```bash
|
||||||
|
adb install input.apk # make sure the same version is installed
|
||||||
|
java -jar revanced-cli.jar \
|
||||||
|
-a input.apk \
|
||||||
|
-c \
|
||||||
|
-d device-name \
|
||||||
|
-o patched-output.apk \
|
||||||
|
-b revanced-patches.jar \
|
||||||
|
-e microg-support \
|
||||||
|
--mount
|
||||||
|
```
|
||||||
|
|
||||||
|
> **Note**:
|
||||||
|
>
|
||||||
|
> - If you want to exclude patches, you can use the option `-e`. In the case of YouTube, you have to exclude
|
||||||
|
the `microg-support` patch from [ReVanced Patches](https://github.com/revanced/revanced-patches) with the
|
||||||
|
option `-e microg-support`.
|
||||||
|
>
|
||||||
|
> - Some patches from [ReVanced Patches](https://github.com/revanced/revanced-patches) also might require
|
||||||
|
[ReVanced Integrations](https://github.com/revanced/revanced-integrations). Supply them with the option `-m`.
|
||||||
|
>
|
||||||
|
> - If you supplied a device with the option `-d`, the patched application will be automatically installed on the
|
||||||
|
device.
|
||||||
8
docs/README.md
Normal file
8
docs/README.md
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
# 💻 Documentation and guides of ReVanced CLI
|
||||||
|
|
||||||
|
This documentation explain, how to use the [ReVanced CLI](https://github.com/revanced/revanced-cli).
|
||||||
|
|
||||||
|
## 📖 Table of contents
|
||||||
|
|
||||||
|
1. [💼 Prerequisites](0_prerequisites.md)
|
||||||
|
2. [🛠️ Using the ReVanced CLI](1_usage.md)
|
||||||
@@ -1,2 +1,2 @@
|
|||||||
kotlin.code.style = official
|
kotlin.code.style = official
|
||||||
version = 2.18.0-dev.1
|
version = 2.20.0-dev.3
|
||||||
|
|||||||
@@ -49,7 +49,7 @@ internal object MainCommand : Runnable {
|
|||||||
}
|
}
|
||||||
|
|
||||||
class PatchArgs {
|
class PatchArgs {
|
||||||
@Option(names = ["-b", "--bundles"], description = ["One or more bundles of patches"], required = true)
|
@Option(names = ["-b", "--bundle"], description = ["One or more bundles of patches"], required = true)
|
||||||
var patchBundles = arrayOf<String>()
|
var patchBundles = arrayOf<String>()
|
||||||
|
|
||||||
@Option(names = ["--options"], description = ["Configuration file for all patch options"])
|
@Option(names = ["--options"], description = ["Configuration file for all patch options"])
|
||||||
@@ -63,7 +63,7 @@ internal object MainCommand : Runnable {
|
|||||||
}
|
}
|
||||||
|
|
||||||
class ListingArgs {
|
class ListingArgs {
|
||||||
@Option(names = ["-l", "--list"], description = ["List patches only"], required = true)
|
@Option(names = ["-l", "--list"], description = ["List patches"], required = true)
|
||||||
var listOnly: Boolean = false
|
var listOnly: Boolean = false
|
||||||
|
|
||||||
@Option(names = ["--with-versions"], description = ["List patches with compatible versions"])
|
@Option(names = ["--with-versions"], description = ["List patches with compatible versions"])
|
||||||
@@ -71,9 +71,6 @@ internal object MainCommand : Runnable {
|
|||||||
|
|
||||||
@Option(names = ["--with-packages"], description = ["List patches with compatible packages"])
|
@Option(names = ["--with-packages"], description = ["List patches with compatible packages"])
|
||||||
var withPackages: Boolean = false
|
var withPackages: Boolean = false
|
||||||
|
|
||||||
@Option(names = ["--with-descriptions"], description = ["List patches with their descriptions"])
|
|
||||||
var withDescriptions: Boolean = true
|
|
||||||
}
|
}
|
||||||
|
|
||||||
class PatchingArgs {
|
class PatchingArgs {
|
||||||
@@ -87,7 +84,7 @@ internal object MainCommand : Runnable {
|
|||||||
names = ["--exclusive"],
|
names = ["--exclusive"],
|
||||||
description = ["Only installs the patches you include, not including any patch by default"]
|
description = ["Only installs the patches you include, not including any patch by default"]
|
||||||
)
|
)
|
||||||
var defaultExclude = false
|
var exclusive = false
|
||||||
|
|
||||||
@Option(names = ["-i", "--include"], description = ["Include patches"])
|
@Option(names = ["-i", "--include"], description = ["Include patches"])
|
||||||
var includedPatches = arrayOf<String>()
|
var includedPatches = arrayOf<String>()
|
||||||
@@ -220,7 +217,7 @@ internal object MainCommand : Runnable {
|
|||||||
for (patchBundlePath in args.patchArgs?.patchBundles!!) for (patch in PatchBundle.Jar(patchBundlePath)
|
for (patchBundlePath in args.patchArgs?.patchBundles!!) for (patch in PatchBundle.Jar(patchBundlePath)
|
||||||
.loadPatches()) {
|
.loadPatches()) {
|
||||||
if (patch.patchName in logged) continue
|
if (patch.patchName in logged) continue
|
||||||
for (compatiblePackage in patch.compatiblePackages!!) {
|
for (compatiblePackage in patch.compatiblePackages ?: continue) {
|
||||||
val packageEntryStr = buildString {
|
val packageEntryStr = buildString {
|
||||||
// Add package if flag is set
|
// Add package if flag is set
|
||||||
if (args.patchArgs?.listingArgs?.withPackages == true) {
|
if (args.patchArgs?.listingArgs?.withPackages == true) {
|
||||||
@@ -228,14 +225,15 @@ internal object MainCommand : Runnable {
|
|||||||
append(packageName)
|
append(packageName)
|
||||||
append("\t")
|
append("\t")
|
||||||
}
|
}
|
||||||
|
|
||||||
// Add patch name
|
// Add patch name
|
||||||
val patchName = patch.patchName.padStart(25)
|
val patchName = patch.patchName.padStart(25)
|
||||||
append(patchName)
|
append(patchName)
|
||||||
|
|
||||||
// Add description if flag is set.
|
// Add description if flag is set.
|
||||||
if (args.patchArgs?.listingArgs?.withDescriptions == true) {
|
|
||||||
append("\t")
|
append("\t")
|
||||||
append(patch.description)
|
append(patch.description)
|
||||||
}
|
|
||||||
// Add compatible versions, if flag is set
|
// Add compatible versions, if flag is set
|
||||||
if (args.patchArgs?.listingArgs?.withVersions == true) {
|
if (args.patchArgs?.listingArgs?.withVersions == true) {
|
||||||
val compatibleVersions = compatiblePackage.versions.joinToString(separator = ", ")
|
val compatibleVersions = compatiblePackage.versions.joinToString(separator = ", ")
|
||||||
|
|||||||
@@ -17,7 +17,7 @@ internal class Adb(
|
|||||||
private val device: JadbDevice
|
private val device: JadbDevice
|
||||||
|
|
||||||
init {
|
init {
|
||||||
device = JadbConnection().devices.find { it.serial == deviceName }
|
device = JadbConnection().devices.let { device -> device.find { it.serial == deviceName } ?: device.first() }
|
||||||
?: throw IllegalArgumentException("No such device with name $deviceName")
|
?: throw IllegalArgumentException("No such device with name $deviceName")
|
||||||
|
|
||||||
if (!modeInstall && device.run("su -h", false) != 0)
|
if (!modeInstall && device.run("su -h", false) != 0)
|
||||||
|
|||||||
@@ -1,64 +0,0 @@
|
|||||||
package app.revanced.utils.filesystem
|
|
||||||
|
|
||||||
import java.io.Closeable
|
|
||||||
import java.io.File
|
|
||||||
import java.nio.file.FileSystems
|
|
||||||
import java.nio.file.Files
|
|
||||||
import java.nio.file.Path
|
|
||||||
import java.util.zip.ZipEntry
|
|
||||||
|
|
||||||
internal class ZipFileSystemUtils(
|
|
||||||
file: File
|
|
||||||
) : Closeable {
|
|
||||||
private var zipFileSystem = FileSystems.newFileSystem(file.toPath(), mapOf("noCompression" to true))
|
|
||||||
|
|
||||||
private fun Path.deleteRecursively() {
|
|
||||||
if (!Files.exists(this)) {
|
|
||||||
throw IllegalStateException("File exists in real folder but not in zip file system")
|
|
||||||
}
|
|
||||||
|
|
||||||
if (Files.isDirectory(this)) {
|
|
||||||
Files.list(this).forEach { path ->
|
|
||||||
path.deleteRecursively()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
Files.delete(this)
|
|
||||||
}
|
|
||||||
|
|
||||||
internal fun getFile(path: String) = zipFileSystem.getPath(path)
|
|
||||||
|
|
||||||
internal fun writePathRecursively(path: Path) {
|
|
||||||
Files.list(path).use { fileStream ->
|
|
||||||
fileStream.forEach { filePath ->
|
|
||||||
val fileSystemPath = filePath.getRelativePath(path)
|
|
||||||
fileSystemPath.deleteRecursively()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
Files.walk(path).use { fileStream ->
|
|
||||||
// don't include build directory
|
|
||||||
// by skipping the root node.
|
|
||||||
fileStream.skip(1).forEach { filePath ->
|
|
||||||
val relativePath = filePath.getRelativePath(path)
|
|
||||||
|
|
||||||
if (Files.isDirectory(filePath)) {
|
|
||||||
Files.createDirectory(relativePath)
|
|
||||||
return@forEach
|
|
||||||
}
|
|
||||||
|
|
||||||
Files.copy(filePath, relativePath)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
internal fun write(path: String, content: ByteArray) = Files.write(zipFileSystem.getPath(path), content)
|
|
||||||
|
|
||||||
private fun Path.getRelativePath(path: Path): Path = zipFileSystem.getPath(path.relativize(this).toString())
|
|
||||||
|
|
||||||
// TODO: figure out why the file system is uncompressed by default and how to fix it
|
|
||||||
internal fun uncompress(vararg paths: String) =
|
|
||||||
paths.forEach { Files.setAttribute(zipFileSystem.getPath(it), "zip:method", ZipEntry.STORED) }
|
|
||||||
|
|
||||||
override fun close() = zipFileSystem.close()
|
|
||||||
}
|
|
||||||
@@ -18,18 +18,9 @@ fun Patcher.addPatchesFiltered(allPatches: List<Class<out Patch<Context>>>) {
|
|||||||
allPatches.forEach patchLoop@{ patch ->
|
allPatches.forEach patchLoop@{ patch ->
|
||||||
val compatiblePackages = patch.compatiblePackages
|
val compatiblePackages = patch.compatiblePackages
|
||||||
val patchName = patch.patchName
|
val patchName = patch.patchName
|
||||||
|
|
||||||
val prefix = "Skipping $patchName"
|
|
||||||
|
|
||||||
val args = MainCommand.args.patchArgs?.patchingArgs!!
|
val args = MainCommand.args.patchArgs?.patchingArgs!!
|
||||||
|
|
||||||
if (args.excludedPatches.contains(patchName)) {
|
val prefix = "Skipping $patchName"
|
||||||
logger.info("$prefix: Manually excluded")
|
|
||||||
return@patchLoop
|
|
||||||
} else if ((!patch.include || args.defaultExclude) && !args.includedPatches.contains(patchName)) {
|
|
||||||
logger.info("$prefix: Excluded by default")
|
|
||||||
return@patchLoop
|
|
||||||
}
|
|
||||||
|
|
||||||
if (compatiblePackages == null) logger.trace("$patchName: No constraint on packages.")
|
if (compatiblePackages == null) logger.trace("$patchName: No constraint on packages.")
|
||||||
else {
|
else {
|
||||||
@@ -51,6 +42,14 @@ fun Patcher.addPatchesFiltered(allPatches: List<Class<out Patch<Context>>>) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (args.excludedPatches.contains(patchName)) {
|
||||||
|
logger.info("$prefix: Manually excluded")
|
||||||
|
return@patchLoop
|
||||||
|
} else if ((!patch.include || args.exclusive) && !args.includedPatches.contains(patchName)) {
|
||||||
|
logger.info("$prefix: Excluded by default")
|
||||||
|
return@patchLoop
|
||||||
|
}
|
||||||
|
|
||||||
logger.trace("Adding $patchName")
|
logger.trace("Adding $patchName")
|
||||||
includedPatches.add(patch)
|
includedPatches.add(patch)
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user