You've already forked revanced-cli
mirror of
https://github.com/revanced/revanced-cli
synced 2025-11-19 15:33:27 +01:00
Compare commits
111 Commits
v2.20.0-de
...
v2.23.0-de
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
4105b638c0 | ||
|
|
f9cf7d21b7 | ||
|
|
0a758d86df | ||
|
|
83f99e29ec | ||
|
|
00410d54c0 | ||
|
|
5eaad33dc1 | ||
|
|
fa85482c4a | ||
|
|
caed39af7f | ||
|
|
20e1fdc18d | ||
|
|
19cd541e9a | ||
|
|
f6c221d72d | ||
|
|
9c148c96bf | ||
|
|
2c5b53c7e9 | ||
|
|
77d9cb98d1 | ||
|
|
38677e2319 | ||
|
|
e5e768fa34 | ||
|
|
9082181ce5 | ||
|
|
542580ecff | ||
|
|
26112a4fd2 | ||
|
|
553fbdbb8f | ||
|
|
be429a4770 | ||
|
|
8c391cecce | ||
|
|
bd14bdb5ea | ||
|
|
d0fc886428 | ||
|
|
1ccbed8d17 | ||
|
|
3b89fb7bc2 | ||
|
|
16bb1a60fc | ||
|
|
5f1843771e | ||
|
|
9de90703c8 | ||
|
|
1201f9edc5 | ||
|
|
9c8f9608b2 | ||
|
|
be90d2e360 | ||
|
|
79dc99aa9b | ||
|
|
260ff00951 | ||
|
|
cfe4c5ed0e | ||
|
|
7133242691 | ||
|
|
55750ce16a | ||
|
|
6003e68d47 | ||
|
|
9f8c2aeedf | ||
|
|
0a16bc849b | ||
|
|
ecd5147590 | ||
|
|
ca255c9e1b | ||
|
|
e9aa490355 | ||
|
|
69fe59f97b | ||
|
|
995e1712bc | ||
|
|
a236f10bb0 | ||
|
|
4a6134ea60 | ||
|
|
b084024742 | ||
|
|
2ef48af1b3 | ||
|
|
da2c91874d | ||
|
|
379687c814 | ||
|
|
2f5577e464 | ||
|
|
6962fc2f4c | ||
|
|
a6cef26210 | ||
|
|
b4892c4413 | ||
|
|
90368405ad | ||
|
|
26967959e2 | ||
|
|
eac6f6fbe3 | ||
|
|
af4ec43352 | ||
|
|
4f5644b62c | ||
|
|
31fb3166d9 | ||
|
|
a76bd0ad35 | ||
|
|
ba07ab1ac2 | ||
|
|
92bf57f279 | ||
|
|
886d501026 | ||
|
|
4b04cc4b59 | ||
|
|
75d237058f | ||
|
|
40026fe300 | ||
|
|
dbec559ed7 | ||
|
|
00e49719ca | ||
|
|
df276846e1 | ||
|
|
ac3a8f66f7 | ||
|
|
e900ce8486 | ||
|
|
ee6dd5a57c | ||
|
|
23d9e1e841 | ||
|
|
3718b7992c | ||
|
|
bce5e86874 | ||
|
|
cda6df6238 | ||
|
|
0dc230292a | ||
|
|
695cd1ba41 | ||
|
|
d08bbf8664 | ||
|
|
d55dd0a1fc | ||
|
|
a53d3482de | ||
|
|
7a3d0420f7 | ||
|
|
5cddf5004e | ||
|
|
6393a5016a | ||
|
|
cad38ca3bd | ||
|
|
6c1169b433 | ||
|
|
bf2bb72ce0 | ||
|
|
567bdee887 | ||
|
|
9888b0e08e | ||
|
|
51c04b7b16 | ||
|
|
a39cf893d6 | ||
|
|
6485e477a1 | ||
|
|
f99d340534 | ||
|
|
4edc325978 | ||
|
|
cffa1ea3a4 | ||
|
|
d15505adaa | ||
|
|
aaf452a103 | ||
|
|
1753a1aa3e | ||
|
|
f4e74cb4f2 | ||
|
|
50df4e117e | ||
|
|
9fcd2b4cd1 | ||
|
|
e6bb05c0b9 | ||
|
|
6bd7d42e32 | ||
|
|
19200eacc1 | ||
|
|
666738ee57 | ||
|
|
961267b8cd | ||
|
|
6b7314a399 | ||
|
|
c8a47c51df | ||
|
|
72d8f73d7f |
9
.gitattributes
vendored
Normal file
9
.gitattributes
vendored
Normal file
@@ -0,0 +1,9 @@
|
||||
#
|
||||
# https://help.github.com/articles/dealing-with-line-endings/
|
||||
#
|
||||
# Linux start script should use lf
|
||||
/gradlew text eol=lf
|
||||
|
||||
# These are Windows script files and should use crlf
|
||||
*.bat text eol=crlf
|
||||
|
||||
2
.github/config.yml
vendored
Normal file
2
.github/config.yml
vendored
Normal file
@@ -0,0 +1,2 @@
|
||||
firstPRMergeComment: >
|
||||
Thank you for contributing to ReVanced. Join us on [Discord](https://revanced.app/discord) if you want to receive a contributor role.
|
||||
1
.github/workflows/pull_request.yml
vendored
1
.github/workflows/pull_request.yml
vendored
@@ -11,6 +11,7 @@ env:
|
||||
|
||||
jobs:
|
||||
pull-request:
|
||||
name: Open pull request
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout
|
||||
|
||||
36
.github/workflows/release.yml
vendored
36
.github/workflows/release.yml
vendored
@@ -1,4 +1,5 @@
|
||||
name: Release
|
||||
|
||||
on:
|
||||
workflow_dispatch:
|
||||
push:
|
||||
@@ -9,6 +10,7 @@ on:
|
||||
branches:
|
||||
- main
|
||||
- dev
|
||||
|
||||
jobs:
|
||||
release:
|
||||
name: Release
|
||||
@@ -17,21 +19,27 @@ jobs:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v3
|
||||
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: Setup JDK
|
||||
uses: actions/setup-java@v3
|
||||
- name: Cache
|
||||
uses: actions/cache@v3
|
||||
with:
|
||||
java-version: '17'
|
||||
distribution: 'zulu'
|
||||
cache: gradle
|
||||
- name: Setup Node.js
|
||||
uses: actions/setup-node@v3
|
||||
with:
|
||||
node-version: "latest"
|
||||
cache: 'npm'
|
||||
- name: Setup semantic-release
|
||||
run: npm install semantic-release @saithodev/semantic-release-backmerge @semantic-release/git @semantic-release/changelog gradle-semantic-release-plugin -D
|
||||
- name: Create release
|
||||
path: |
|
||||
${{ runner.home }}/.gradle/caches
|
||||
${{ runner.home }}/.gradle/wrapper
|
||||
.gradle
|
||||
build
|
||||
node_modules
|
||||
key: ${{ runner.os }}-gradle-npm-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties', 'package-lock.json') }}
|
||||
- name: Build with Gradle
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
run: npx semantic-release
|
||||
run: ./gradlew clean --no-daemon
|
||||
- name: Setup semantic-release
|
||||
run: npm install
|
||||
- name: Release
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.REPOSITORY_PUSH_ACCESS }}
|
||||
run: npm exec semantic-release
|
||||
|
||||
19
.github/workflows/update-documentation.yml
vendored
Normal file
19
.github/workflows/update-documentation.yml
vendored
Normal file
@@ -0,0 +1,19 @@
|
||||
name: Update documentation
|
||||
|
||||
on:
|
||||
push:
|
||||
paths:
|
||||
- docs/**
|
||||
|
||||
jobs:
|
||||
trigger:
|
||||
runs-on: ubuntu-latest
|
||||
name: Dispatch event to documentation repository
|
||||
if: github.ref == 'refs/heads/main'
|
||||
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 }}"}'
|
||||
1
.gitignore
vendored
1
.gitignore
vendored
@@ -74,6 +74,7 @@ cmake-build-*/
|
||||
|
||||
# IntelliJ
|
||||
out/
|
||||
.idea
|
||||
|
||||
# mpeltonen/sbt-idea plugin
|
||||
.idea_modules/
|
||||
|
||||
11
.idea/.gitignore
generated
vendored
11
.idea/.gitignore
generated
vendored
@@ -1,11 +0,0 @@
|
||||
# Default ignored files
|
||||
/shelf/
|
||||
/workspace.xml
|
||||
# Editor-based HTTP Client requests
|
||||
/httpRequests/
|
||||
# Datasource local storage ignored files
|
||||
/dataSources/
|
||||
/dataSources.local.xml
|
||||
/kotlinc.xml
|
||||
/vcs.xml
|
||||
/codeStyles
|
||||
7
.idea/discord.xml
generated
7
.idea/discord.xml
generated
@@ -1,7 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="DiscordProjectSettings">
|
||||
<option name="show" value="PROJECT_FILES" />
|
||||
<option name="description" value="" />
|
||||
</component>
|
||||
</project>
|
||||
15
.idea/git_toolbox_prj.xml
generated
15
.idea/git_toolbox_prj.xml
generated
@@ -1,15 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="GitToolBoxProjectSettings">
|
||||
<option name="commitMessageIssueKeyValidationOverride">
|
||||
<BoolValueOverride>
|
||||
<option name="enabled" value="true" />
|
||||
</BoolValueOverride>
|
||||
</option>
|
||||
<option name="commitMessageValidationEnabledOverride">
|
||||
<BoolValueOverride>
|
||||
<option name="enabled" value="true" />
|
||||
</BoolValueOverride>
|
||||
</option>
|
||||
</component>
|
||||
</project>
|
||||
14
.idea/misc.xml
generated
14
.idea/misc.xml
generated
@@ -1,14 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="ExternalStorageConfigurationManager" enabled="true" />
|
||||
<component name="FrameworkDetectionExcludesConfiguration">
|
||||
<file type="web" url="file://$PROJECT_DIR$" />
|
||||
</component>
|
||||
<component name="PWA">
|
||||
<option name="enabled" value="true" />
|
||||
<option name="wasEnabledAtLeastOnce" value="true" />
|
||||
</component>
|
||||
<component name="ProjectRootManager" version="2" languageLevel="JDK_17" default="true" project-jdk-name="azul-17" project-jdk-type="JavaSDK">
|
||||
<output url="file://$PROJECT_DIR$/out" />
|
||||
</component>
|
||||
</project>
|
||||
12
.idea/vcs.xml
generated
12
.idea/vcs.xml
generated
@@ -1,12 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="CommitMessageInspectionProfile">
|
||||
<profile version="1.0">
|
||||
<inspection_tool class="CommitFormat" enabled="true" level="WARNING" enabled_by_default="true" />
|
||||
<inspection_tool class="CommitNamingConvention" enabled="true" level="WARNING" enabled_by_default="true" />
|
||||
</profile>
|
||||
</component>
|
||||
<component name="VcsDirectoryMappings">
|
||||
<mapping directory="$PROJECT_DIR$" vcs="Git" />
|
||||
</component>
|
||||
</project>
|
||||
10
.releaserc
10
.releaserc
@@ -7,7 +7,13 @@
|
||||
}
|
||||
],
|
||||
"plugins": [
|
||||
"@semantic-release/commit-analyzer",
|
||||
[
|
||||
"@semantic-release/commit-analyzer", {
|
||||
"releaseRules": [
|
||||
{ "type": "build", "scope": "Needs bump", "release": "patch" }
|
||||
]
|
||||
}
|
||||
],
|
||||
"@semantic-release/release-notes-generator",
|
||||
"@semantic-release/changelog",
|
||||
"gradle-semantic-release-plugin",
|
||||
@@ -34,7 +40,7 @@
|
||||
[
|
||||
"@saithodev/semantic-release-backmerge",
|
||||
{
|
||||
branches: [{from: "main", to: "dev"}],
|
||||
backmergeBranches: [{"from": "main", "to": "dev"}],
|
||||
clearWorkspace: true
|
||||
}
|
||||
]
|
||||
|
||||
196
CHANGELOG.md
196
CHANGELOG.md
@@ -1,3 +1,199 @@
|
||||
# [2.23.0-dev.1](https://github.com/ReVanced/revanced-cli/compare/v2.22.1-dev.1...v2.23.0-dev.1) (2023-07-30)
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* Improve command line argument descriptions ([f9cf7d2](https://github.com/ReVanced/revanced-cli/commit/f9cf7d21b7f1c2f11234d604a1047b9d2b165f83))
|
||||
|
||||
## [2.22.1-dev.1](https://github.com/ReVanced/revanced-cli/compare/v2.22.0...v2.22.1-dev.1) (2023-07-24)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* print original instead of kebab cased names ([5eaad33](https://github.com/ReVanced/revanced-cli/commit/5eaad33dc1fbd24c36e1498f04e21d068e85f53e))
|
||||
|
||||
# [2.22.0](https://github.com/revanced/revanced-cli/compare/v2.21.5...v2.22.0) (2023-07-11)
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* use new patch naming convention ([f6c221d](https://github.com/revanced/revanced-cli/commit/f6c221d72dc43ebea00e5eba6bfa02751ae8ad77))
|
||||
|
||||
# [2.22.0-dev.1](https://github.com/revanced/revanced-cli/compare/v2.21.5...v2.22.0-dev.1) (2023-07-10)
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* use new patch naming convention ([e4908c7](https://github.com/revanced/revanced-cli/commit/e4908c71051a535f8ce3406427cebbb0941464df))
|
||||
|
||||
## [2.21.5](https://github.com/revanced/revanced-cli/compare/v2.21.4...v2.21.5) (2023-07-01)
|
||||
|
||||
## [2.21.5-dev.2](https://github.com/revanced/revanced-cli/compare/v2.21.5-dev.1...v2.21.5-dev.2) (2023-07-01)
|
||||
|
||||
## [2.21.5-dev.1](https://github.com/revanced/revanced-cli/compare/v2.21.4...v2.21.5-dev.1) (2023-06-27)
|
||||
|
||||
## [2.21.4](https://github.com/revanced/revanced-cli/compare/v2.21.3...v2.21.4) (2023-06-21)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* remove duplicate options entries. ([d0fc886](https://github.com/revanced/revanced-cli/commit/d0fc8864286adc2677f91a319a11a90272c1001d))
|
||||
|
||||
## [2.21.4-dev.1](https://github.com/revanced/revanced-cli/compare/v2.21.3...v2.21.4-dev.1) (2023-06-18)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* remove duplicate options entries. ([d0fc886](https://github.com/revanced/revanced-cli/commit/d0fc8864286adc2677f91a319a11a90272c1001d))
|
||||
|
||||
## [2.21.3](https://github.com/revanced/revanced-cli/compare/v2.21.2...v2.21.3) (2023-06-12)
|
||||
|
||||
## [2.21.3-dev.1](https://github.com/revanced/revanced-cli/compare/v2.21.2...v2.21.3-dev.1) (2023-06-07)
|
||||
|
||||
## [2.21.2](https://github.com/revanced/revanced-cli/compare/v2.21.1...v2.21.2) (2023-05-24)
|
||||
|
||||
## [2.21.2-dev.2](https://github.com/revanced/revanced-cli/compare/v2.21.2-dev.1...v2.21.2-dev.2) (2023-05-15)
|
||||
|
||||
## [2.21.2-dev.1](https://github.com/revanced/revanced-cli/compare/v2.21.1...v2.21.2-dev.1) (2023-05-07)
|
||||
|
||||
## [2.21.1](https://github.com/revanced/revanced-cli/compare/v2.21.0...v2.21.1) (2023-05-06)
|
||||
|
||||
## [2.21.1-dev.1](https://github.com/revanced/revanced-cli/compare/v2.21.0...v2.21.1-dev.1) (2023-05-06)
|
||||
|
||||
# [2.21.0](https://github.com/revanced/revanced-cli/compare/v2.20.2...v2.21.0) (2023-05-04)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* **tests:** set order of tests ([2ef48af](https://github.com/revanced/revanced-cli/commit/2ef48af1b339ab729a05d69cb0c8c1ee1e3ab486))
|
||||
* use working JADB dependency version ([#222](https://github.com/revanced/revanced-cli/issues/222)) ([da2c918](https://github.com/revanced/revanced-cli/commit/da2c91874d5623402febfcc0677ada3d648565e1))
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* add appreciation message for new contributors ([6962fc2](https://github.com/revanced/revanced-cli/commit/6962fc2f4c0f0c96e88a823be64f8ebd1312ee17))
|
||||
|
||||
# [2.21.0-dev.1](https://github.com/revanced/revanced-cli/compare/v2.20.2...v2.21.0-dev.1) (2023-05-04)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* **tests:** set order of tests ([2ef48af](https://github.com/revanced/revanced-cli/commit/2ef48af1b339ab729a05d69cb0c8c1ee1e3ab486))
|
||||
* use working JADB dependency version ([#222](https://github.com/revanced/revanced-cli/issues/222)) ([da2c918](https://github.com/revanced/revanced-cli/commit/da2c91874d5623402febfcc0677ada3d648565e1))
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* add appreciation message for new contributors ([6962fc2](https://github.com/revanced/revanced-cli/commit/6962fc2f4c0f0c96e88a823be64f8ebd1312ee17))
|
||||
|
||||
## [2.20.2](https://github.com/revanced/revanced-cli/compare/v2.20.1...v2.20.2) (2023-04-30)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* correct spelling mistake ([31fb316](https://github.com/revanced/revanced-cli/commit/31fb3166d922ae1f568f52e44cbe726dd1c891a4))
|
||||
|
||||
## [2.20.2-dev.1](https://github.com/revanced/revanced-cli/compare/v2.20.1...v2.20.2-dev.1) (2023-04-03)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* correct spelling mistake ([31fb316](https://github.com/revanced/revanced-cli/commit/31fb3166d922ae1f568f52e44cbe726dd1c891a4))
|
||||
|
||||
## [2.20.1](https://github.com/revanced/revanced-cli/compare/v2.20.0...v2.20.1) (2023-03-14)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* correctly word option descriptions ([ac3a8f6](https://github.com/revanced/revanced-cli/commit/ac3a8f66f77a7218974465eebbfc78a536b76d51))
|
||||
|
||||
## [2.20.1-dev.1](https://github.com/revanced/revanced-cli/compare/v2.20.0...v2.20.1-dev.1) (2023-03-05)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* correctly word option descriptions ([ac3a8f6](https://github.com/revanced/revanced-cli/commit/ac3a8f66f77a7218974465eebbfc78a536b76d51))
|
||||
|
||||
## [2.20.1-dev.1](https://github.com/revanced/revanced-cli/compare/v2.20.0...v2.20.1-dev.1) (2023-03-03)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* correctly word option descriptions ([ac3a8f6](https://github.com/revanced/revanced-cli/commit/ac3a8f66f77a7218974465eebbfc78a536b76d51))
|
||||
|
||||
## [2.20.1-dev.1](https://github.com/revanced/revanced-cli/compare/v2.20.0...v2.20.1-dev.1) (2023-03-02)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* correctly word option descriptions ([ac3a8f6](https://github.com/revanced/revanced-cli/commit/ac3a8f66f77a7218974465eebbfc78a536b76d51))
|
||||
|
||||
# [2.20.0](https://github.com/revanced/revanced-cli/compare/v2.19.0...v2.20.0) (2023-01-18)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* bump patcher dependency version ([51c04b7](https://github.com/revanced/revanced-cli/commit/51c04b7b162ad2876bbeb248b7ccddd105b5076d))
|
||||
* do not list compatible packages if patches do not define them ([31e4a41](https://github.com/revanced/revanced-cli/commit/31e4a41dd20f5fa62f840cd8e3b92fe0814eda87))
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* connect to first device if given device was not found ([6485e47](https://github.com/revanced/revanced-cli/commit/6485e477a10bb89dfb2e40f3596d72b20bf23cc8))
|
||||
* 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-17)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* bump patcher dependency version ([51c04b7](https://github.com/revanced/revanced-cli/commit/51c04b7b162ad2876bbeb248b7ccddd105b5076d))
|
||||
* do not list compatible packages if patches do not define them ([31e4a41](https://github.com/revanced/revanced-cli/commit/31e4a41dd20f5fa62f840cd8e3b92fe0814eda87))
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* connect to first device if given device was not found ([6485e47](https://github.com/revanced/revanced-cli/commit/6485e477a10bb89dfb2e40f3596d72b20bf23cc8))
|
||||
* remove option `--with-descriptions` ([07a423b](https://github.com/revanced/revanced-cli/commit/07a423b19ec72e9f020aeb0222f4ced571036dbe))
|
||||
|
||||
# [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)
|
||||
|
||||
|
||||
|
||||
3
README.md
Normal file
3
README.md
Normal file
@@ -0,0 +1,3 @@
|
||||
# 💻 ReVanced CLI
|
||||
|
||||
Command line application as an alternative to the ReVanced Manager.
|
||||
@@ -1,5 +1,5 @@
|
||||
plugins {
|
||||
kotlin("jvm") version "1.7.0"
|
||||
kotlin("jvm") version "1.8.20"
|
||||
id("com.github.johnrengelman.shadow") version "7.1.2"
|
||||
}
|
||||
|
||||
@@ -23,17 +23,28 @@ repositories {
|
||||
}
|
||||
|
||||
dependencies {
|
||||
implementation(kotlin("reflect"))
|
||||
implementation("org.jetbrains.kotlin:kotlin-reflect:1.8.20")
|
||||
|
||||
implementation("app.revanced:revanced-patcher:6.3.2")
|
||||
implementation("info.picocli:picocli:4.7.0")
|
||||
implementation("com.github.revanced:jadb:master-SNAPSHOT") // updated fork
|
||||
implementation("com.android.tools.build:apksig:7.2.1")
|
||||
implementation("app.revanced:revanced-patcher:12.0.0")
|
||||
implementation("info.picocli:picocli:4.7.3")
|
||||
implementation("com.github.revanced:jadb:2531a28109") // updated fork
|
||||
implementation("com.android.tools.build:apksig:8.1.0")
|
||||
implementation("org.bouncycastle:bcpkix-jdk15on:1.70")
|
||||
implementation("cc.ekblad:4koma:1.1.0")
|
||||
implementation("com.fasterxml.jackson.module:jackson-module-kotlin:2.14.3")
|
||||
testImplementation("org.jetbrains.kotlin:kotlin-test:1.8.20-RC")
|
||||
}
|
||||
|
||||
kotlin {
|
||||
jvmToolchain(11)
|
||||
}
|
||||
|
||||
tasks {
|
||||
test {
|
||||
useJUnitPlatform()
|
||||
testLogging {
|
||||
events("PASSED", "SKIPPED", "FAILED")
|
||||
}
|
||||
}
|
||||
build {
|
||||
dependsOn(shadowJar)
|
||||
}
|
||||
|
||||
15
docs/0_prerequisites.md
Normal file
15
docs/0_prerequisites.md
Normal file
@@ -0,0 +1,15 @@
|
||||
# 💼 Prerequisites
|
||||
|
||||
To use ReVanced CLI, you will need to fulfill certain requirements.
|
||||
|
||||
## 🤝 Requirements
|
||||
|
||||
- Java SDK 11 (Azul 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
|
||||
- An ABI other than ARMv7 such as x86 or x86-64 (or a custom AAPT binary that supports ARMv7)
|
||||
|
||||
## ⏭️ Whats next
|
||||
|
||||
The next section will show, how to use [ReVanced CLI](https://github.com/revanced/revanced-cli).
|
||||
|
||||
Continue: [🛠️ Using ReVanced CLI](1_usage.md)
|
||||
76
docs/1_usage.md
Normal file
76
docs/1_usage.md
Normal file
@@ -0,0 +1,76 @@
|
||||
# 🛠️ Using ReVanced CLI
|
||||
|
||||
Learn how to ReVanced CLI.
|
||||
|
||||
## ⚡ Setup ADB
|
||||
|
||||
1. Ensure that ADB is working
|
||||
|
||||
```bash
|
||||
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.
|
||||
|
||||
```bash
|
||||
adb shell su -c exit
|
||||
```
|
||||
|
||||
2. Get the name of your device
|
||||
|
||||
```bash
|
||||
adb devices
|
||||
```
|
||||
|
||||
## 🔨 Using ReVanced CLI
|
||||
|
||||
- ### ⚙️ Show all available options for 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 # Names of all patches will be in kebab-case
|
||||
```
|
||||
|
||||
- ### 💉 Use ReVanced CLI to patch an APK file but deploy without root permissions
|
||||
|
||||
This will deploy the patched APK file on your device by installing it.
|
||||
|
||||
```bash
|
||||
java -jar revanced-cli.jar \
|
||||
-a input.apk \
|
||||
-o patched-output.apk \
|
||||
-b revanced-patches.jar \
|
||||
-d device-name
|
||||
```
|
||||
|
||||
- ### 👾 Use ReVanced CLI to patch an APK file but deploy with root permissions
|
||||
|
||||
This will deploy 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 \
|
||||
-o patched-output.apk \
|
||||
-b revanced-patches.jar \
|
||||
-e vanced-microg-support \
|
||||
-d device-name \
|
||||
--mount
|
||||
```
|
||||
|
||||
> **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.
|
||||
|
||||
- ### ⚙️ Supply options to patches using ReVanced CLI
|
||||
|
||||
Some patches provide options. Currently, ReVanced CLI will generate and consume an `options.json` file at the location that is specified in `-o`. If the option is not specified, the options file will be generated in the current working directory.
|
||||
|
||||
The options file contains all options from supplied patch bundles.
|
||||
|
||||
> **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.
|
||||
8
docs/README.md
Normal file
8
docs/README.md
Normal file
@@ -0,0 +1,8 @@
|
||||
# 💻 Documentation and guides of ReVanced CLI
|
||||
|
||||
This documentation explains how to use [ReVanced CLI](https://github.com/revanced/revanced-cli).
|
||||
|
||||
## 📖 Table of contents
|
||||
|
||||
1. [💼 Prerequisites](0_prerequisites.md)
|
||||
2. [🛠️ Using ReVanced CLI](1_usage.md)
|
||||
@@ -1,2 +1,4 @@
|
||||
org.gradle.parallel = true
|
||||
org.gradle.caching = true
|
||||
kotlin.code.style = official
|
||||
version = 2.20.0-dev.1
|
||||
version = 2.23.0-dev.1
|
||||
|
||||
BIN
gradle/wrapper/gradle-wrapper.jar
vendored
BIN
gradle/wrapper/gradle-wrapper.jar
vendored
Binary file not shown.
4
gradle/wrapper/gradle-wrapper.properties
vendored
4
gradle/wrapper/gradle-wrapper.properties
vendored
@@ -1,5 +1,7 @@
|
||||
distributionBase=GRADLE_USER_HOME
|
||||
distributionPath=wrapper/dists
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-7.4.2-all.zip
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-8.2-bin.zip
|
||||
networkTimeout=10000
|
||||
validateDistributionUrl=true
|
||||
zipStoreBase=GRADLE_USER_HOME
|
||||
zipStorePath=wrapper/dists
|
||||
|
||||
15
gradlew.bat
vendored
15
gradlew.bat
vendored
@@ -14,7 +14,7 @@
|
||||
@rem limitations under the License.
|
||||
@rem
|
||||
|
||||
@if "%DEBUG%" == "" @echo off
|
||||
@if "%DEBUG%"=="" @echo off
|
||||
@rem ##########################################################################
|
||||
@rem
|
||||
@rem Gradle startup script for Windows
|
||||
@@ -25,7 +25,8 @@
|
||||
if "%OS%"=="Windows_NT" setlocal
|
||||
|
||||
set DIRNAME=%~dp0
|
||||
if "%DIRNAME%" == "" set DIRNAME=.
|
||||
if "%DIRNAME%"=="" set DIRNAME=.
|
||||
@rem This is normally unused
|
||||
set APP_BASE_NAME=%~n0
|
||||
set APP_HOME=%DIRNAME%
|
||||
|
||||
@@ -40,7 +41,7 @@ if defined JAVA_HOME goto findJavaFromJavaHome
|
||||
|
||||
set JAVA_EXE=java.exe
|
||||
%JAVA_EXE% -version >NUL 2>&1
|
||||
if "%ERRORLEVEL%" == "0" goto execute
|
||||
if %ERRORLEVEL% equ 0 goto execute
|
||||
|
||||
echo.
|
||||
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
|
||||
@@ -75,13 +76,15 @@ set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
|
||||
|
||||
:end
|
||||
@rem End local scope for the variables with windows NT shell
|
||||
if "%ERRORLEVEL%"=="0" goto mainEnd
|
||||
if %ERRORLEVEL% equ 0 goto mainEnd
|
||||
|
||||
:fail
|
||||
rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
|
||||
rem the _cmd.exe /c_ return code!
|
||||
if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
|
||||
exit /b 1
|
||||
set EXIT_CODE=%ERRORLEVEL%
|
||||
if %EXIT_CODE% equ 0 set EXIT_CODE=1
|
||||
if not ""=="%GRADLE_EXIT_CONSOLE%" exit %EXIT_CODE%
|
||||
exit /b %EXIT_CODE%
|
||||
|
||||
:mainEnd
|
||||
if "%OS%"=="Windows_NT" endlocal
|
||||
|
||||
727
package-lock.json
generated
727
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
@@ -1,8 +1,9 @@
|
||||
{
|
||||
"devDependencies": {
|
||||
"@saithodev/semantic-release-backmerge": "^3.1.0",
|
||||
"@semantic-release/changelog": "^6.0.2",
|
||||
"@semantic-release/git": "^10.0.1",
|
||||
"gradle-semantic-release-plugin": "^1.7.4",
|
||||
"semantic-release": "^19.0.5"
|
||||
"gradle-semantic-release-plugin": "^1.7.6",
|
||||
"semantic-release": "^20.1.0"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -7,16 +7,24 @@ import app.revanced.cli.patcher.logging.impl.PatcherLogger
|
||||
import app.revanced.cli.signing.Signing
|
||||
import app.revanced.cli.signing.SigningOptions
|
||||
import app.revanced.patcher.PatcherOptions
|
||||
import app.revanced.patcher.data.Context
|
||||
import app.revanced.patcher.extensions.PatchExtensions.compatiblePackages
|
||||
import app.revanced.patcher.extensions.PatchExtensions.description
|
||||
import app.revanced.patcher.extensions.PatchExtensions.patchName
|
||||
import app.revanced.patcher.patch.Patch
|
||||
import app.revanced.patcher.util.patch.PatchBundle
|
||||
import app.revanced.utils.OptionsLoader
|
||||
import app.revanced.utils.Options
|
||||
import app.revanced.utils.Options.setOptions
|
||||
import app.revanced.utils.adb.Adb
|
||||
import picocli.CommandLine.*
|
||||
import java.io.File
|
||||
import java.nio.file.Files
|
||||
|
||||
/**
|
||||
* Alias for return type of [PatchBundle.loadPatches].
|
||||
*/
|
||||
internal typealias PatchList = List<Class<out Patch<Context>>>
|
||||
|
||||
private class CLIVersionProvider : IVersionProvider {
|
||||
override fun getVersion() = arrayOf(
|
||||
MainCommand::class.java.`package`.implementationVersion ?: "unknown"
|
||||
@@ -24,7 +32,7 @@ private class CLIVersionProvider : IVersionProvider {
|
||||
}
|
||||
|
||||
@Command(
|
||||
name = "ReVanced-CLI",
|
||||
name = "ReVanced CLI",
|
||||
mixinStandardHelpOptions = true,
|
||||
versionProvider = CLIVersionProvider::class
|
||||
)
|
||||
@@ -35,13 +43,17 @@ internal object MainCommand : Runnable {
|
||||
lateinit var args: Args
|
||||
|
||||
class Args {
|
||||
@Option(names = ["-a", "--apk"], description = ["Input file to be patched"], required = true)
|
||||
// TODO: Move this so it is not required when listing patches
|
||||
@Option(names = ["-a", "--apk"], description = ["APK file to be patched"], required = true)
|
||||
lateinit var inputFile: File
|
||||
|
||||
@Option(names = ["--uninstall"], description = ["Uninstall the mount variant"])
|
||||
var uninstall: Boolean = false
|
||||
@Option(names = ["--unmount"], description = ["Unmount a patched APK file"])
|
||||
var unmount: Boolean = false
|
||||
|
||||
@Option(names = ["-d", "--deploy-on"], description = ["If specified, deploy to adb device with given name"])
|
||||
@Option(
|
||||
names = ["-d", "--deploy"],
|
||||
description = ["Deploy to the specified device that is connected via ADB"]
|
||||
)
|
||||
var deploy: String? = null
|
||||
|
||||
@ArgGroup(exclusive = false)
|
||||
@@ -52,8 +64,8 @@ internal object MainCommand : Runnable {
|
||||
@Option(names = ["-b", "--bundle"], description = ["One or more bundles of patches"], required = true)
|
||||
var patchBundles = arrayOf<String>()
|
||||
|
||||
@Option(names = ["--options"], description = ["Configuration file for all patch options"])
|
||||
var options: File = File("options.toml")
|
||||
@Option(names = ["--options"], description = ["Path to patch options JSON file"])
|
||||
var optionsFile: File = File("options.json")
|
||||
|
||||
@ArgGroup(exclusive = false)
|
||||
var listingArgs: ListingArgs? = null
|
||||
@@ -66,63 +78,72 @@ internal object MainCommand : Runnable {
|
||||
@Option(names = ["-l", "--list"], description = ["List patches"], required = true)
|
||||
var listOnly: Boolean = false
|
||||
|
||||
@Option(names = ["--with-versions"], description = ["List patches with compatible versions"])
|
||||
@Option(names = ["--with-versions"], description = ["List patches with version compatibilities"])
|
||||
var withVersions: Boolean = false
|
||||
|
||||
@Option(names = ["--with-packages"], description = ["List patches with compatible packages"])
|
||||
@Option(names = ["--with-packages"], description = ["List patches with package compatibilities"])
|
||||
var withPackages: Boolean = false
|
||||
}
|
||||
|
||||
class PatchingArgs {
|
||||
@Option(names = ["-o", "--out"], description = ["Output file path"], required = true)
|
||||
@Option(names = ["-o", "--out"], description = ["Path to save the patched APK file to"], required = true)
|
||||
lateinit var outputPath: String
|
||||
|
||||
@Option(names = ["-e", "--exclude"], description = ["Explicitly exclude patches"])
|
||||
@Option(names = ["-e", "--exclude"], description = ["Exclude patches"])
|
||||
var excludedPatches = arrayOf<String>()
|
||||
|
||||
@Option(
|
||||
names = ["--exclusive"],
|
||||
description = ["Only installs the patches you include, not including any patch by default"]
|
||||
description = ["Only include patches that were explicitly specified to be included"]
|
||||
)
|
||||
var exclusive = false
|
||||
|
||||
@Option(names = ["-i", "--include"], description = ["Include patches"])
|
||||
var includedPatches = arrayOf<String>()
|
||||
|
||||
@Option(names = ["--experimental"], description = ["Disable patch version compatibility patch"])
|
||||
@Option(names = ["--experimental"], description = ["Ignore patches incompatibility to versions"])
|
||||
var experimental: Boolean = false
|
||||
|
||||
@Option(names = ["-m", "--merge"], description = ["One or more dex file containers to merge"])
|
||||
@Option(names = ["-m", "--merge"], description = ["One or more DEX files or containers to merge into the APK"])
|
||||
var mergeFiles = listOf<File>()
|
||||
|
||||
@Option(names = ["--mount"], description = ["If specified, instead of installing, mount"])
|
||||
@Option(
|
||||
names = ["--mount"],
|
||||
description = ["Mount the patched APK file over the original file instead of installing it"]
|
||||
)
|
||||
var mount: Boolean = false
|
||||
|
||||
@Option(names = ["--cn"], description = ["Overwrite the default CN for the signed file"])
|
||||
@Option(names = ["--cn"], description = ["The common name of the signer of the patched APK file"])
|
||||
var cn = "ReVanced"
|
||||
|
||||
@Option(names = ["--keystore"], description = ["File path to your keystore"])
|
||||
@Option(names = ["--keystore"], description = ["Path to the keystore to sign the patched APK file with"])
|
||||
var keystorePath: String? = null
|
||||
|
||||
@Option(names = ["-p", "--password"], description = ["Overwrite the default password for the signed file"])
|
||||
@Option(
|
||||
names = ["-p", "--password"],
|
||||
description = ["The password of the keystore to sign the patched APK file with"]
|
||||
)
|
||||
var password = "ReVanced"
|
||||
|
||||
@Option(names = ["-t", "--temp-dir"], description = ["Temporary resource cache directory"])
|
||||
@Option(names = ["-t", "--temp-dir"], description = ["Path to temporary resource cache directory"])
|
||||
var cacheDirectory = "revanced-cache"
|
||||
|
||||
@Option(
|
||||
names = ["-c", "--clean"],
|
||||
description = ["Clean the temporary resource cache directory. This will be done anyways when running the patcher"]
|
||||
description = ["Clean up the temporary resource cache directory after patching"]
|
||||
)
|
||||
var clean: Boolean = false
|
||||
|
||||
@Option(names = ["--custom-aapt2-binary"], description = ["Path to custom aapt2 binary"])
|
||||
@Option(
|
||||
names = ["--custom-aapt2-binary"],
|
||||
description = ["Path to custom AAPT binary to compile resources with"]
|
||||
)
|
||||
var aaptPath: String = ""
|
||||
}
|
||||
|
||||
override fun run() {
|
||||
if (args.patchArgs?.listingArgs?.listOnly == true) return printListOfPatches()
|
||||
if (args.uninstall) return uninstall()
|
||||
if (args.unmount) return unmount()
|
||||
|
||||
val pArgs = this.args.patchArgs?.patchingArgs ?: return
|
||||
val outputFile = File(pArgs.outputPath) // the file to write to
|
||||
@@ -131,7 +152,10 @@ internal object MainCommand : Runnable {
|
||||
PatchBundle.Jar(bundle).loadPatches()
|
||||
}
|
||||
|
||||
OptionsLoader.init(args.patchArgs!!.options, allPatches)
|
||||
args.patchArgs!!.optionsFile.let {
|
||||
if (it.exists()) allPatches.setOptions(it, logger)
|
||||
else Options.serialize(allPatches, prettyPrint = true).let(it::writeText)
|
||||
}
|
||||
|
||||
val patcher = app.revanced.patcher.Patcher(
|
||||
PatcherOptions(
|
||||
@@ -200,7 +224,7 @@ internal object MainCommand : Runnable {
|
||||
logger.info(result)
|
||||
}
|
||||
|
||||
private fun uninstall() {
|
||||
private fun unmount() {
|
||||
val adb: Adb? = args.deploy?.let {
|
||||
Adb(
|
||||
File("placeholder_file"),
|
||||
@@ -227,7 +251,7 @@ internal object MainCommand : Runnable {
|
||||
}
|
||||
|
||||
// Add patch name
|
||||
val patchName = patch.patchName.padStart(25)
|
||||
val patchName = patch.patchName.lowercase().replace(" ", "-").padStart(25)
|
||||
append(patchName)
|
||||
|
||||
// Add description if flag is set.
|
||||
|
||||
@@ -1,8 +1,7 @@
|
||||
package app.revanced.cli.patcher
|
||||
|
||||
import app.revanced.cli.command.PatchList
|
||||
import app.revanced.patcher.PatcherResult
|
||||
import app.revanced.patcher.data.Context
|
||||
import app.revanced.patcher.patch.Patch
|
||||
import app.revanced.utils.patcher.addPatchesFiltered
|
||||
import app.revanced.utils.patcher.applyPatchesVerbose
|
||||
import app.revanced.utils.patcher.mergeFiles
|
||||
@@ -10,7 +9,7 @@ import app.revanced.utils.patcher.mergeFiles
|
||||
internal object Patcher {
|
||||
internal fun start(
|
||||
patcher: app.revanced.patcher.Patcher,
|
||||
allPatches: List<Class<out Patch<Context>>>
|
||||
allPatches: PatchList
|
||||
): PatcherResult {
|
||||
// merge files like necessary integrations
|
||||
patcher.mergeFiles()
|
||||
|
||||
107
src/main/kotlin/app/revanced/utils/Options.kt
Normal file
107
src/main/kotlin/app/revanced/utils/Options.kt
Normal file
@@ -0,0 +1,107 @@
|
||||
package app.revanced.utils
|
||||
|
||||
import app.revanced.cli.command.PatchList
|
||||
import app.revanced.cli.logging.CliLogger
|
||||
import app.revanced.patcher.extensions.PatchExtensions.options
|
||||
import app.revanced.patcher.extensions.PatchExtensions.patchName
|
||||
import app.revanced.patcher.patch.NoSuchOptionException
|
||||
import app.revanced.utils.Options.PatchOption.Option
|
||||
import com.fasterxml.jackson.module.kotlin.jacksonObjectMapper
|
||||
import java.io.File
|
||||
|
||||
|
||||
internal object Options {
|
||||
private var mapper = jacksonObjectMapper()
|
||||
|
||||
/**
|
||||
* Serializes the options for the patches in the list.
|
||||
*
|
||||
* @param patches The list of patches to serialize.
|
||||
* @param prettyPrint Whether to pretty print the JSON.
|
||||
* @return The JSON string containing the options.
|
||||
* @see PatchList
|
||||
*/
|
||||
fun serialize(patches: PatchList, prettyPrint: Boolean = false): String = patches
|
||||
.filter { it.options?.any() == true }
|
||||
.map { patch ->
|
||||
PatchOption(
|
||||
patch.patchName,
|
||||
patch.options!!.map { option -> Option(option.key, option.value) }
|
||||
)
|
||||
}
|
||||
// See https://github.com/revanced/revanced-patches/pull/2434/commits/60e550550b7641705e81aa72acfc4faaebb225e7.
|
||||
.distinctBy { it.patchName }
|
||||
.let {
|
||||
if (prettyPrint)
|
||||
mapper.writerWithDefaultPrettyPrinter().writeValueAsString(it)
|
||||
else
|
||||
mapper.writeValueAsString(it)
|
||||
}
|
||||
|
||||
/**
|
||||
* Deserializes the options for the patches in the list.
|
||||
*
|
||||
* @param json The JSON string containing the options.
|
||||
* @return The list of [PatchOption]s.
|
||||
* @see PatchOption
|
||||
* @see PatchList
|
||||
*/
|
||||
@Suppress("MemberVisibilityCanBePrivate")
|
||||
fun deserialize(json: String): Array<PatchOption> = mapper.readValue(json, Array<PatchOption>::class.java)
|
||||
|
||||
/**
|
||||
* Sets the options for the patches in the list.
|
||||
*
|
||||
* @param json The JSON string containing the options.
|
||||
* @param logger The logger to use for logging.
|
||||
*/
|
||||
fun PatchList.setOptions(json: String, logger: CliLogger? = null) {
|
||||
filter { it.options?.any() == true }.let { patches ->
|
||||
if (patches.isEmpty()) return
|
||||
|
||||
val patchOptions = deserialize(json)
|
||||
|
||||
patches.forEach { patch ->
|
||||
patchOptions.find { option -> option.patchName == patch.patchName }?.let {
|
||||
it.options.forEach { option ->
|
||||
try {
|
||||
patch.options?.set(option.key, option.value)
|
||||
?: logger?.warn("${patch.patchName} has no options")
|
||||
} catch (e: NoSuchOptionException) {
|
||||
logger?.error(e.message ?: "Unknown error")
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the options for the patches in the list.
|
||||
*
|
||||
* @param file The file containing the JSON string containing the options.
|
||||
* @param logger The logger to use for logging.
|
||||
* @see setOptions
|
||||
*/
|
||||
fun PatchList.setOptions(file: File, logger: CliLogger? = null) = setOptions(file.readText(), logger)
|
||||
|
||||
/**
|
||||
* Data class for a patch and its [Option]s.
|
||||
*
|
||||
* @property patchName The name of the patch.
|
||||
* @property options The [Option]s for the patch.
|
||||
*/
|
||||
internal data class PatchOption(
|
||||
val patchName: String,
|
||||
val options: List<Option>
|
||||
) {
|
||||
|
||||
/**
|
||||
* Data class for patch option.
|
||||
*
|
||||
* @property key The name of the option.
|
||||
* @property value The value of the option.
|
||||
*/
|
||||
internal data class Option(val key: String, val value: Any?)
|
||||
}
|
||||
}
|
||||
@@ -1,77 +0,0 @@
|
||||
package app.revanced.utils
|
||||
|
||||
import app.revanced.cli.command.MainCommand.logger
|
||||
import app.revanced.patcher.Patcher
|
||||
import app.revanced.patcher.data.Context
|
||||
import app.revanced.patcher.extensions.PatchExtensions.options
|
||||
import app.revanced.patcher.extensions.PatchExtensions.patchName
|
||||
import app.revanced.patcher.patch.Patch
|
||||
import cc.ekblad.toml.encodeToString
|
||||
import cc.ekblad.toml.model.TomlValue
|
||||
import cc.ekblad.toml.serialization.from
|
||||
import cc.ekblad.toml.tomlMapper
|
||||
import java.io.File
|
||||
|
||||
private typealias PatchList = List<Class<out Patch<Context>>>
|
||||
private typealias OptionsMap = MutableMap<String, MutableMap<String, Any>>
|
||||
|
||||
object OptionsLoader {
|
||||
@JvmStatic
|
||||
private val mapper = tomlMapper {}
|
||||
|
||||
@JvmStatic
|
||||
fun init(file: File, patches: PatchList) {
|
||||
if (!file.exists()) file.createNewFile()
|
||||
val map = mapper.decodeWithDefaults(generateDefaults(patches), TomlValue.from(file.toPath()))
|
||||
readAndSet(map, patches)
|
||||
save(map, file)
|
||||
}
|
||||
|
||||
private fun readAndSet(map: OptionsMap, patches: PatchList) {
|
||||
for ((patchName, options) in map) {
|
||||
val patch = patches.find { it.patchName == patchName } ?: continue
|
||||
val patchOptions = patch.options ?: continue
|
||||
for ((key, value) in options) {
|
||||
if (value == "null") { // backwards compatibility, subject to removal
|
||||
options.remove(key)
|
||||
continue
|
||||
}
|
||||
try {
|
||||
patchOptions[key] = value
|
||||
} catch (e: Exception) {
|
||||
logger.error("Error while setting option $key for patch $patchName: ${e.message}")
|
||||
e.printStackTrace()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private fun save(map: OptionsMap, file: File) {
|
||||
val toml = mapper.encodeToString(map)
|
||||
file.writeText(
|
||||
"""
|
||||
# A list of options for each patch.
|
||||
# This file does not contain all options by default.
|
||||
# Run the CLI with the "--list --with-options" flags to see all available options.
|
||||
# You can also run the CLI with the aforementioned flags and a patch name to see all available options for that patch.
|
||||
# To set an option, add a line with the format "option = value" or set the value if the option already exists.
|
||||
# To reset an option to its default value, delete the line.
|
||||
# To reset all options to their default values, delete this file.
|
||||
#
|
||||
# This file was generated by ReVanced Patcher version ${Patcher.version}.
|
||||
""".trimIndent() + "\n\n$toml"
|
||||
)
|
||||
}
|
||||
|
||||
private fun generateDefaults(patches: PatchList) = buildMap {
|
||||
for (patch in patches) {
|
||||
val options = patch.options ?: continue
|
||||
if (!options.iterator().hasNext()) continue
|
||||
put(patch.patchName, buildMap {
|
||||
for (option in options) {
|
||||
put(option.key, option.value ?: continue)
|
||||
}
|
||||
} as MutableMap)
|
||||
}
|
||||
} as MutableMap
|
||||
}
|
||||
@@ -11,16 +11,16 @@ internal class Adb(
|
||||
private val file: File,
|
||||
private val packageName: String,
|
||||
deviceName: String,
|
||||
private val modeInstall: Boolean = false,
|
||||
private val install: Boolean = false,
|
||||
private val logging: Boolean = true
|
||||
) {
|
||||
private val device: JadbDevice
|
||||
|
||||
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")
|
||||
|
||||
if (!modeInstall && device.run("su -h", false) != 0)
|
||||
if (!install && device.run("su -h", false) != 0)
|
||||
throw IllegalArgumentException("Root required on $deviceName. Task failed")
|
||||
}
|
||||
|
||||
@@ -29,7 +29,7 @@ internal class Adb(
|
||||
}
|
||||
|
||||
internal fun deploy() {
|
||||
if (modeInstall) {
|
||||
if (install) {
|
||||
logger.info("Installing without mounting")
|
||||
|
||||
PackageManager(device).install(file)
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
package app.revanced.utils.patcher
|
||||
|
||||
import app.revanced.cli.command.MainCommand
|
||||
import app.revanced.cli.command.MainCommand.args
|
||||
import app.revanced.cli.command.MainCommand.logger
|
||||
import app.revanced.cli.command.PatchList
|
||||
import app.revanced.patcher.Patcher
|
||||
import app.revanced.patcher.data.Context
|
||||
import app.revanced.patcher.extensions.PatchExtensions.compatiblePackages
|
||||
@@ -10,19 +10,18 @@ import app.revanced.patcher.extensions.PatchExtensions.include
|
||||
import app.revanced.patcher.extensions.PatchExtensions.patchName
|
||||
import app.revanced.patcher.patch.Patch
|
||||
|
||||
fun Patcher.addPatchesFiltered(allPatches: List<Class<out Patch<Context>>>) {
|
||||
fun Patcher.addPatchesFiltered(allPatches: PatchList) {
|
||||
val packageName = this.context.packageMetadata.packageName
|
||||
val packageVersion = this.context.packageMetadata.packageVersion
|
||||
|
||||
val includedPatches = mutableListOf<Class<out Patch<Context>>>()
|
||||
allPatches.forEach patchLoop@{ patch ->
|
||||
val compatiblePackages = patch.compatiblePackages
|
||||
val patchName = patch.patchName
|
||||
val args = MainCommand.args.patchArgs?.patchingArgs!!
|
||||
val args = args.patchArgs?.patchingArgs!!
|
||||
|
||||
val prefix = "Skipping $patchName"
|
||||
val prefix = "Skipping ${patch.patchName}"
|
||||
|
||||
if (compatiblePackages == null) logger.trace("$patchName: No constraint on packages.")
|
||||
if (compatiblePackages == null) logger.trace("${patch.patchName}: No package constraints.")
|
||||
else {
|
||||
if (!compatiblePackages.any { it.name == packageName }) {
|
||||
logger.trace("$prefix: Incompatible with $packageName. This patch is only compatible with ${
|
||||
@@ -37,20 +36,21 @@ fun Patcher.addPatchesFiltered(allPatches: List<Class<out Patch<Context>>>) {
|
||||
val compatibleWith = compatiblePackages.joinToString(";") { _package ->
|
||||
"${_package.name}: ${_package.versions.joinToString(", ")}"
|
||||
}
|
||||
logger.warn("$prefix: Incompatible with version $packageVersion. This patch is only compatible with version $compatibleWith")
|
||||
logger.warn("$prefix: Incompatible with version $packageVersion. This patch is only compatible with $compatibleWith")
|
||||
return@patchLoop
|
||||
}
|
||||
}
|
||||
|
||||
if (args.excludedPatches.contains(patchName)) {
|
||||
val kebabCasedPatchName = patch.patchName.lowercase().replace(" ", "-")
|
||||
if (args.excludedPatches.contains(kebabCasedPatchName)) {
|
||||
logger.info("$prefix: Manually excluded")
|
||||
return@patchLoop
|
||||
} else if ((!patch.include || args.exclusive) && !args.includedPatches.contains(patchName)) {
|
||||
} else if ((!patch.include || args.exclusive) && !args.includedPatches.contains(kebabCasedPatchName)) {
|
||||
logger.info("$prefix: Excluded by default")
|
||||
return@patchLoop
|
||||
}
|
||||
|
||||
logger.trace("Adding $patchName")
|
||||
logger.trace("Adding ${patch.patchName}")
|
||||
includedPatches.add(patch)
|
||||
}
|
||||
|
||||
@@ -69,7 +69,7 @@ fun Patcher.applyPatchesVerbose() {
|
||||
}
|
||||
|
||||
fun Patcher.mergeFiles() {
|
||||
this.addFiles(args.patchArgs?.patchingArgs!!.mergeFiles) { file ->
|
||||
this.addIntegrations(args.patchArgs?.patchingArgs!!.mergeFiles) { file ->
|
||||
logger.info("Merging $file")
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,57 @@
|
||||
package app.revanced.patcher.options
|
||||
|
||||
import app.revanced.patcher.data.BytecodeContext
|
||||
import app.revanced.patcher.data.Context
|
||||
import app.revanced.patcher.patch.*
|
||||
import app.revanced.utils.Options
|
||||
import app.revanced.utils.Options.setOptions
|
||||
import org.junit.jupiter.api.MethodOrderer
|
||||
import org.junit.jupiter.api.Order
|
||||
import org.junit.jupiter.api.Test
|
||||
import org.junit.jupiter.api.TestMethodOrder
|
||||
|
||||
class PatchOptionsTestPatch : BytecodePatch() {
|
||||
override fun execute(context: BytecodeContext): PatchResult {
|
||||
return PatchResultSuccess()
|
||||
}
|
||||
|
||||
companion object : OptionsContainer() {
|
||||
var key1 by option(
|
||||
PatchOption.StringOption(
|
||||
"key1", null, "title1", "description1"
|
||||
)
|
||||
)
|
||||
|
||||
var key2 by option(
|
||||
PatchOption.BooleanOption(
|
||||
"key2", true, "title2", "description2"
|
||||
)
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
@TestMethodOrder(MethodOrderer.OrderAnnotation::class)
|
||||
internal object PatchOptionOptionsTest {
|
||||
private var patches = listOf(PatchOptionsTestPatch::class.java as Class<out Patch<Context>>)
|
||||
|
||||
@Test
|
||||
@Order(1)
|
||||
fun serializeTest() {
|
||||
assert(SERIALIZED_JSON == Options.serialize(patches))
|
||||
}
|
||||
|
||||
@Test
|
||||
@Order(2)
|
||||
fun loadOptionsTest() {
|
||||
patches.setOptions(CHANGED_JSON)
|
||||
|
||||
assert(PatchOptionsTestPatch.key1 == "test")
|
||||
assert(PatchOptionsTestPatch.key2 == false)
|
||||
}
|
||||
|
||||
private const val SERIALIZED_JSON =
|
||||
"[{\"patchName\":\"PatchOptionsTestPatch\",\"options\":[{\"key\":\"key1\",\"value\":null},{\"key\":\"key2\",\"value\":true}]}]"
|
||||
|
||||
private const val CHANGED_JSON =
|
||||
"[{\"patchName\":\"PatchOptionsTestPatch\",\"options\":[{\"key\":\"key1\",\"value\":\"test\"},{\"key\":\"key2\",\"value\":false}]}]"
|
||||
}
|
||||
Reference in New Issue
Block a user