1
mirror of https://github.com/revanced/revanced-cli synced 2025-11-19 15:33:27 +01:00

Compare commits

...

141 Commits

Author SHA1 Message Date
semantic-release-bot
1201f9edc5 chore(release): 2.21.3-dev.1 [skip ci]
## [2.21.3-dev.1](https://github.com/revanced/revanced-cli/compare/v2.21.2...v2.21.3-dev.1) (2023-06-07)
2023-06-07 01:48:39 +00:00
oSumAtrIX
9c8f9608b2 build(revanced-patcher): bump version 2023-06-07 03:46:32 +02:00
semantic-release-bot
be90d2e360 chore(release): 2.21.2 [skip ci]
## [2.21.2](https://github.com/revanced/revanced-cli/compare/v2.21.1...v2.21.2) (2023-05-24)
2023-05-24 19:19:03 +00:00
oSumAtrIX
79dc99aa9b chore: merge branch dev to main (#225) 2023-05-24 21:17:06 +02:00
semantic-release-bot
260ff00951 chore(release): 2.21.2-dev.2 [skip ci]
## [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)
2023-05-24 01:57:56 +02:00
LisoUseInAIKyrios
cfe4c5ed0e build(revanced-patcher): bump version (#226) 2023-05-24 01:57:56 +02:00
oSumAtrIX
7133242691 build: use Java SDK 17 for building 2023-05-09 07:13:17 +02:00
semantic-release-bot
55750ce16a chore(release): 2.21.2-dev.1 [skip ci]
## [2.21.2-dev.1](https://github.com/revanced/revanced-cli/compare/v2.21.1...v2.21.2-dev.1) (2023-05-07)
2023-05-07 23:24:29 +00:00
oSumAtrIX
6003e68d47 docs: remove "the" in front of ReVanced names 2023-05-08 01:20:20 +02:00
oSumAtrIX
9f8c2aeedf build: downgrade to JDK version 11 2023-05-08 01:15:27 +02:00
oSumAtrIX
0a16bc849b build(revanced-patcher): bump version 2023-05-08 01:15:07 +02:00
semantic-release-bot
ecd5147590 chore(release): 2.21.1 [skip ci]
## [2.21.1](https://github.com/revanced/revanced-cli/compare/v2.21.0...v2.21.1) (2023-05-06)
2023-05-06 22:21:27 +00:00
oSumAtrIX
ca255c9e1b chore: merge branch dev to main (#224) 2023-05-07 00:19:48 +02:00
semantic-release-bot
e9aa490355 chore(release): 2.21.1-dev.1 [skip ci]
## [2.21.1-dev.1](https://github.com/revanced/revanced-cli/compare/v2.21.0...v2.21.1-dev.1) (2023-05-06)
2023-05-06 21:23:52 +00:00
oSumAtrIX
69fe59f97b ci: release when bumping ReVanced Patcher
This is required when two projects bump ReVanced Patcher, but one does not release a new version, resulting them to get out of sync. For that reason, commits of type `build` and scope `revanced-patcher` are treated as releasing commits.
2023-05-06 23:22:53 +02:00
oSumAtrIX
995e1712bc build(revanced-patcher): bump version 2023-05-06 23:22:52 +02:00
semantic-release-bot
a236f10bb0 chore(release): 2.21.0 [skip ci]
# [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](2ef48af1b3))
* use working JADB dependency version ([#222](https://github.com/revanced/revanced-cli/issues/222)) ([da2c918](da2c91874d))

### Features

* add appreciation message for new contributors ([6962fc2](6962fc2f4c))
2023-05-04 00:33:50 +00:00
oSumAtrIX
4a6134ea60 chore: merge branch dev to main (#219) 2023-05-04 02:32:03 +02:00
semantic-release-bot
b084024742 chore(release): 2.21.0-dev.1 [skip ci]
# [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](2ef48af1b3))
* use working JADB dependency version ([#222](https://github.com/revanced/revanced-cli/issues/222)) ([da2c918](da2c91874d))

### Features

* add appreciation message for new contributors ([6962fc2](6962fc2f4c))
2023-05-04 00:31:04 +00:00
oSumAtrIX
2ef48af1b3 fix(tests): set order of tests 2023-05-04 02:30:11 +02:00
bogadana
da2c91874d fix: use working JADB dependency version (#222)
This fixes a current issue with CI/CD failing
2023-05-04 02:30:10 +02:00
oSumAtrIX
379687c814 fix!: support null as option value (#221)
BREAKING-CHANGE: serialize options as JSON instead of TOML
2023-05-04 02:30:10 +02:00
oSumAtrIX
2f5577e464 chore: update gradle and dependencies 2023-05-04 02:30:10 +02:00
oSumAtrIX
6962fc2f4c feat: add appreciation message for new contributors 2023-05-04 02:30:09 +02:00
semantic-release-bot
a6cef26210 chore(release): 2.20.2 [skip ci]
## [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](31fb3166d9))
2023-04-30 01:00:27 +00:00
oSumAtrIX
b4892c4413 chore: merge branch dev to main (#210) 2023-04-30 02:58:45 +02:00
bitingsock
90368405ad docs: update name of example patch (#218) 2023-04-30 02:55:27 +02:00
oSumAtrIX
26967959e2 ci: only dispatch documentation update event if on branch main 2023-04-30 02:53:24 +02:00
oSumAtrIX
eac6f6fbe3 docs: fix spelling (#213) 2023-04-21 17:14:09 +02:00
EvadeMaster
af4ec43352 docs: fix misspelling word 2023-04-21 21:23:41 +07:00
semantic-release-bot
4f5644b62c chore(release): 2.20.2-dev.1 [skip ci]
## [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](31fb3166d9))
2023-04-03 03:08:42 +00:00
oSumAtrIX
31fb3166d9 fix: correct spelling mistake 2023-04-03 05:07:45 +02:00
oSumAtrIX
a76bd0ad35 chore: bump dependencies 2023-04-03 03:04:07 +02:00
oSumAtrIX
ba07ab1ac2 build: update Kotlin to 1.8.10 2023-03-31 17:20:15 +02:00
oSumAtrIX
92bf57f279 docs: remove unnecessary option 2023-03-19 22:48:37 +01:00
semantic-release-bot
886d501026 chore(release): 2.20.1 [skip ci]
## [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](ac3a8f66f7))
2023-03-14 15:00:44 +00:00
oSumAtrIX
4b04cc4b59 chore: merge branch dev to main (#205) 2023-03-14 15:59:14 +01:00
semantic-release-bot
75d237058f chore(release): 2.20.1-dev.1 [skip ci]
## [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](ac3a8f66f7))
2023-03-05 01:06:31 +00:00
oSumAtrIX
40026fe300 docs: fix output file name 2023-03-05 02:05:40 +01:00
semantic-release-bot
dbec559ed7 chore(release): 2.20.1-dev.1 [skip ci]
## [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](ac3a8f66f7))
2023-03-03 13:09:06 +00:00
Professsional
00e49719ca docs: fix invalid grammar (#206)
Co-authored-by: oSumAtrIX <johan.melkonyan1@web.de>
2023-03-03 14:08:13 +01:00
semantic-release-bot
df276846e1 chore(release): 2.20.1-dev.1 [skip ci]
## [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](ac3a8f66f7))
2023-03-02 19:39:20 +00:00
oSumAtrIX
ac3a8f66f7 fix: correctly word option descriptions
Signed-off-by: oSumAtrIX <johan.melkonyan1@web.de>
2023-03-02 20:38:02 +01:00
oSumAtrIX
e900ce8486 chore: remove project files 2023-03-02 20:37:57 +01:00
oSumAtrIX
ee6dd5a57c docs: update options usage
Signed-off-by: oSumAtrIX <johan.melkonyan1@web.de>
2023-02-27 01:07:57 +01:00
oSumAtrIX
23d9e1e841 ci: fix usage of backmergeBranches option
Signed-off-by: oSumAtrIX <johan.melkonyan1@web.de>
2023-02-27 00:57:46 +01:00
oSumAtrIX
3718b7992c build: update dependencies
Signed-off-by: oSumAtrIX <johan.melkonyan1@web.de>
2023-02-27 00:53:27 +01:00
oSumAtrIX
bce5e86874 ci: fix backmerge direction
Signed-off-by: oSumAtrIX <johan.melkonyan1@web.de>
2023-02-22 16:39:51 +01:00
oSumAtrIX
cda6df6238 ci: add backmerge target branch
Signed-off-by: oSumAtrIX <johan.melkonyan1@web.de>
2023-02-22 06:46:23 +01:00
oSumAtrIX
0dc230292a ci: use new semantic-release-backmerge option
Signed-off-by: oSumAtrIX <johan.melkonyan1@web.de>
2023-02-18 21:55:41 +01:00
oSumAtrIX
695cd1ba41 docs: correct note on excluding patches 2023-02-14 23:27:28 +01:00
Palm
d08bbf8664 ci: update actions (#204) 2023-02-13 22:35:05 +01:00
oSumAtrIX
d55dd0a1fc chore: merge branch dev to main (#201) 2023-02-10 05:36:19 +01:00
oSumAtrIX
a53d3482de build: bump patcher dependency version
Signed-off-by: oSumAtrIX <johan.melkonyan1@web.de>
2023-02-10 05:28:35 +01:00
semantic-release-bot
7a3d0420f7 chore(release): 2.20.0 [skip ci]
# [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](51c04b7b16))
* do not list compatible packages if patches do not define them ([31e4a41](31e4a41dd2))

### Features

* connect to first device if given device was not found ([6485e47](6485e477a1))
* remove option `--with-descriptions` ([07a423b](07a423b19e))
2023-01-18 20:36:39 +00:00
semantic-release-bot
5cddf5004e chore(release): 2.20.0 [skip ci]
# [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](51c04b7b16))
* do not list compatible packages if patches do not define them ([31e4a41](31e4a41dd2))

### Features

* connect to first device if given device was not found ([6485e47](6485e477a1))
* remove option `--with-descriptions` ([07a423b](07a423b19e))
2023-01-17 23:48:27 +00:00
oSumAtrIX
6393a5016a chore: merge branch dev to main (#196) 2023-01-18 00:47:01 +01:00
oSumAtrIX
cad38ca3bd ci: use PAT in step Release 2023-01-18 00:44:39 +01:00
oSumAtrIX
6c1169b433 chore: merge branch dev to main (#195) 2023-01-18 00:39:15 +01:00
oSumAtrIX
bf2bb72ce0 build: update dependencies
Signed-off-by: oSumAtrIX <johan.melkonyan1@web.de>
2023-01-18 00:33:00 +01:00
oSumAtrIX
567bdee887 chore: merge branch dev to main (#194) 2023-01-15 06:16:46 +01:00
semantic-release-bot
9888b0e08e chore(release): 2.20.0-dev.3 [skip ci]
# [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](51c04b7b16))
2023-01-15 04:36:31 +00:00
oSumAtrIX
51c04b7b16 fix: bump patcher dependency version
This commit addresses https://github.com/revanced/multidexlib2/issues/2.
2023-01-15 05:34:52 +01:00
semantic-release-bot
a39cf893d6 chore(release): 2.20.0-dev.2 [skip ci]
# [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](6485e477a1))
2023-01-15 04:25:04 +00:00
oSumAtrIX
6485e477a1 feat: connect to first device if given device was not found 2023-01-15 05:17:38 +01:00
oSumAtrIX
f99d340534 chore: merge branch dev to main (#193) 2023-01-13 22:33:19 +01:00
oSumAtrIX
4edc325978 ci: use PAT in step Release 2023-01-13 22:31:11 +01:00
oSumAtrIX
cffa1ea3a4 chore: merge branch dev to main (#192) 2023-01-13 16:04:32 +01:00
oSumAtrIX
d15505adaa ci: downgrade semantic release and plugins to v19 2023-01-13 15:50:39 +01:00
oSumAtrIX
aaf452a103 refactor: fix formatting 2023-01-13 14:41:38 +01:00
oSumAtrIX
1753a1aa3e ci: give jobs names 2023-01-13 14:41:18 +01:00
oSumAtrIX
f4e74cb4f2 docs: improve CLI usage commands 2023-01-13 00:13:45 +01:00
oSumAtrIX
50df4e117e docs: improve wording and accuracy 2023-01-09 10:11:15 +01:00
oSumAtrIX
9fcd2b4cd1 Merge branch 'main' into dev 2023-01-08 16:43:59 +01:00
oSumAtrIX
e6bb05c0b9 docs: init (#191) 2023-01-08 16:43:19 +01:00
oSumAtrIX
6bd7d42e32 ci: dispatch event to revanced/revanced-documentation on push to /docs 2023-01-08 14:46:13 +01:00
oSumAtrIX
19200eacc1 docs: init 2023-01-08 14:37:41 +01:00
semantic-release-bot
666738ee57 chore(release): 2.20.0 [skip ci]
# [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](31e4a41dd2))

### Features

* remove option `--with-descriptions` ([07a423b](07a423b19e))
2023-01-02 08:15:31 +00:00
oSumAtrIX
961267b8cd chore: merge branch dev to main (#190) 2023-01-02 09:13:55 +01:00
oSumAtrIX
6b7314a399 build: bump patcher dependency version (#189) 2023-01-02 09:11:19 +01:00
semantic-release-bot
c8a47c51df chore(release): 2.20.0 [skip ci]
# [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](31e4a41dd2))

### Features

* remove option `--with-descriptions` ([07a423b](07a423b19e))
2023-01-01 17:15:28 +00:00
oSumAtrIX
72d8f73d7f chore: merge branch dev to main (#188) 2023-01-01 18:14:36 +01:00
semantic-release-bot
1957a2c4ff chore(release): 2.20.0-dev.1 [skip ci]
# [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](31e4a41dd2))

### Features

* remove option `--with-descriptions` ([07a423b](07a423b19e))
2023-01-01 17:12:07 +00:00
oSumAtrIX
07a423b19e feat: remove option --with-descriptions 2023-01-01 18:11:10 +01:00
oSumAtrIX
31e4a41dd2 fix: do not list compatible packages if patches do not define them 2023-01-01 18:11:10 +01:00
semantic-release-bot
8284c1048f chore(release): 2.19.0 [skip ci]
# [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](b69e784785))
2022-12-31 18:22:25 +00:00
oSumAtrIX
9c64f5ec3e chore: merge branch dev to main (#184) 2022-12-31 19:20:26 +01:00
semantic-release-bot
f4c447e71b chore(release): 2.19.0-dev.1 [skip ci]
# [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](b69e784785))
2022-12-31 18:19:03 +00:00
oSumAtrIX
b69e784785 feat: improve description of options (#185) 2022-12-31 19:17:57 +01:00
oSumAtrIX
ccce9c926d ci: do not escape in environment variable MESSAGE 2022-12-29 19:07:33 +01:00
oSumAtrIX
dc4ab22f41 chore: bump patcher dependency version 2022-12-18 22:20:20 +01:00
semantic-release-bot
25d8ad4aaf chore(release): 2.18.2 [skip ci]
## [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](d5794b94ca))
2022-12-16 16:10:17 +00:00
oSumAtrIX
3d9436e691 chore: merge branch dev to main (#180) 2022-12-16 17:08:38 +01:00
semantic-release-bot
ee70423527 chore(release): 2.18.2-dev.1 [skip ci]
## [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](d5794b94ca))
2022-12-16 15:54:28 +00:00
oSumAtrIX
d5794b94ca fix: exclude patcher dependency from minimizing 2022-12-16 16:53:01 +01:00
oSumAtrIX
3160d894da chore: merge branch dev to main (#179) 2022-12-16 01:25:15 +01:00
oSumAtrIX
545597959a refactor: remove unused class ZipFileUtils 2022-12-16 01:23:37 +01:00
semantic-release-bot
a6db0edc70 chore(release): 2.18.1 [skip ci]
## [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](ad81a1b656))
2022-12-15 23:50:16 +00:00
oSumAtrIX
ff0d3dd224 chore: merge branch dev to main (#178) 2022-12-15 23:43:46 +01:00
semantic-release-bot
d9a1fd33ed chore(release): 2.18.1-dev.1 [skip ci]
## [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](ad81a1b656))
2022-12-15 22:43:16 +00:00
oSumAtrIX
ad81a1b656 fix: don't log when package is incompatible and exclusive option is used 2022-12-15 23:41:42 +01:00
oSumAtrIX
8c2aeff2cf build: exclude Bouncy Castle dependency from minimizing 2022-12-15 23:41:42 +01:00
semantic-release-bot
eb6c659f5b chore(release): 2.18.0 [skip ci]
# [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](ae91b0d597))
* use correct prefix in log message ([1a67cd8](1a67cd81da))

### Features

* simplify log message ([74d73ca](74d73ca3a7))
2022-12-15 21:11:11 +00:00
semantic-release-bot
bac4f839c9 chore(release): 2.18.0 [skip ci]
# [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](ae91b0d597))
* use correct prefix in log message ([1a67cd8](1a67cd81da))

### Features

* simplify log message ([74d73ca](74d73ca3a7))
2022-12-15 21:06:50 +00:00
oSumAtrIX
c1e7215d31 chore: merge branch dev to main (#176) 2022-12-15 22:05:59 +01:00
semantic-release-bot
18d132123f chore(release): 2.18.0-dev.1 [skip ci]
# [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)

### Bug Fixes

* start with uppercase in log message ([ae91b0d](ae91b0d597))
* use correct prefix in log message ([1a67cd8](1a67cd81da))

### Features

* simplify log message ([74d73ca](74d73ca3a7))
2022-12-15 21:04:58 +00:00
oSumAtrIX
74d73ca3a7 feat: simplify log message 2022-12-15 22:03:47 +01:00
oSumAtrIX
ae91b0d597 fix: start with uppercase in log message 2022-12-15 22:03:29 +01:00
oSumAtrIX
1a67cd81da fix: use correct prefix in log message 2022-12-15 22:00:08 +01:00
oSumAtrIX
9b9fad7cc0 chore: merge branch dev to main (#174) 2022-12-15 21:46:55 +01:00
oSumAtrIX
1620305b4a ci: do not release on build commit type 2022-12-15 19:47:48 +01:00
semantic-release-bot
d906edbe78 chore(release): 2.17.1-dev.2 [skip ci]
## [2.17.1-dev.2](https://github.com/revanced/revanced-cli/compare/v2.17.1-dev.1...v2.17.1-dev.2) (2022-12-15)
2022-12-15 18:34:01 +00:00
oSumAtrIX
4e53638cb9 build: exclude Kotlin standard library dependencies from minimizing 2022-12-15 19:32:08 +01:00
semantic-release-bot
7d1f200621 chore(release): 2.17.1-dev.1 [skip ci]
## [2.17.1-dev.1](https://github.com/revanced/revanced-cli/compare/v2.17.0...v2.17.1-dev.1) (2022-12-15)
2022-12-15 00:01:17 +00:00
oSumAtrIX
a7db6cb8f1 build: do not comment on successful releases 2022-12-15 01:00:22 +01:00
semantic-release-bot
d61ab058da chore(release): 2.17.0 [skip ci]
# [2.17.0](https://github.com/revanced/revanced-cli/compare/v2.16.1...v2.17.0) (2022-12-14)

### Bug Fixes

* invalid header when writing a `ZipFile` ([#169](https://github.com/revanced/revanced-cli/issues/169)) ([6e703eb](6e703eb8e8))

### Features

* improve missing compatibility annotation tracing log ([2c7eb72](2c7eb7274c))
* trace logs when compatibility annotation is missing ([#166](https://github.com/revanced/revanced-cli/issues/166)) ([c590bf5](c590bf559c))
2022-12-14 23:48:26 +00:00
oSumAtrIX
235c2742ec chore: merge branch dev to main (#173) 2022-12-15 00:39:03 +01:00
semantic-release-bot
8a964efd00 chore(release): 2.17.0-dev.3 [skip ci]
# [2.17.0-dev.3](https://github.com/revanced/revanced-cli/compare/v2.17.0-dev.2...v2.17.0-dev.3) (2022-12-14)

### Features

* improve missing compatibility annotation tracing log ([2c7eb72](2c7eb7274c))
2022-12-14 23:37:35 +00:00
oSumAtrIX
8114d1dca0 build: remove unnecessary step 2022-12-15 00:32:48 +01:00
oSumAtrIX
5a7cadd96d build: remove manifest attributes 2022-12-15 00:32:47 +01:00
oSumAtrIX
1c5983b803 build: minimize shadow jar 2022-12-15 00:32:47 +01:00
oSumAtrIX
2c7eb7274c feat: improve missing compatibility annotation tracing log 2022-12-15 00:32:47 +01:00
oSumAtrIX
512152fb66 ci: stash before rebasing 2022-12-15 00:32:47 +01:00
oSumAtrIX
8793b5fc65 chore: merge branch dev to main (#167) 2022-12-14 01:18:05 +01:00
semantic-release-bot
39c490d6b7 chore(release): 2.17.0-dev.2 [skip ci]
# [2.17.0-dev.2](https://github.com/revanced/revanced-cli/compare/v2.17.0-dev.1...v2.17.0-dev.2) (2022-12-14)

### Bug Fixes

* invalid header when writing a `ZipFile` ([#169](https://github.com/revanced/revanced-cli/issues/169)) ([6e703eb](6e703eb8e8))
2022-12-14 00:16:38 +00:00
oSumAtrIX
6e703eb8e8 fix: invalid header when writing a ZipFile (#169) 2022-12-14 01:14:00 +01:00
oSumAtrIX
c677eb9792 ci: back-merge releases back into dev branch 2022-12-14 01:13:45 +01:00
oSumAtrIX
75c8ea4639 chore: bump patcher dependency version 2022-12-14 01:13:00 +01:00
semantic-release-bot
b69dd52ca9 chore(release): 2.17.0-dev.1 [skip ci]
# [2.17.0-dev.1](https://github.com/revanced/revanced-cli/compare/v2.16.1...v2.17.0-dev.1) (2022-12-11)

### Features

* trace logs when compatibility annotation is missing ([#166](https://github.com/revanced/revanced-cli/issues/166)) ([c590bf5](c590bf559c))
2022-12-11 19:10:19 +00:00
oSumAtrIX
c590bf559c feat: trace logs when compatibility annotation is missing (#166) 2022-12-11 20:08:52 +01:00
oSumAtrIX
ec0b847419 chore: merge branch dev to main (#165) 2022-12-11 05:19:08 +01:00
oSumAtrIX
b3cf32e89d ci: open pull requests to merge dev to main (#164) 2022-12-11 05:16:51 +01:00
oSumAtrIX
8a1199ba9a ci: refactor release workflow 2022-12-11 05:14:23 +01:00
oSumAtrIX
25b45800a1 chore: bump patcher dependency version 2022-12-02 04:04:25 +01:00
oSumAtrIX
2fe3303a27 chore: bump patcher dependency version 2022-12-02 02:35:35 +01:00
semantic-release-bot
04339f0654 chore(release): 2.16.1 [skip ci]
## [2.16.1](https://github.com/revanced/revanced-cli/compare/v2.16.0...v2.16.1) (2022-11-22)
2022-11-22 23:37:24 +00:00
oSumAtrIX
456428a836 build: bump dependencies 2022-11-23 00:33:45 +01:00
oSumAtrIX
c9ae379c77 feat!: apply changes from ReVanced Patcher 2022-11-23 00:20:48 +01:00
semantic-release-bot
81d702949c chore(release): 2.16.0 [skip ci]
# [2.16.0](https://github.com/revanced/revanced-cli/compare/v2.15.1...v2.16.0) (2022-11-20)

### Features

* do not warn on incompatible packages ([39e377b](39e377bc48))
2022-11-20 01:50:38 +00:00
oSumAtrIX
39e377bc48 feat: do not warn on incompatible packages 2022-11-20 00:34:00 +01:00
oSumAtrIX
fce40421e9 chore: ignore file vcs.xml from version control [skip ci] 2022-11-19 19:56:46 +01:00
32 changed files with 7428 additions and 366 deletions

2
.github/config.yml vendored Normal file
View 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.

25
.github/workflows/pull_request.yml vendored Normal file
View File

@@ -0,0 +1,25 @@
name: PR to main
on:
push:
branches:
- dev
workflow_dispatch:
env:
MESSAGE: merge branch `${{ github.head_ref || github.ref_name }}` to `main`
jobs:
pull-request:
name: Open pull request
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Open pull request
uses: repo-sync/pull-request@v2
with:
destination_branch: 'main'
pr_title: 'chore: ${{ env.MESSAGE }}'
pr_body: 'This pull request will ${{ env.MESSAGE }}.'
pr_draft: true

View File

@@ -1,4 +1,5 @@
name: Release
on:
workflow_dispatch:
push:
@@ -9,6 +10,7 @@ on:
branches:
- main
- dev
jobs:
release:
name: Release
@@ -17,24 +19,24 @@ 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
with:
java-version: '17'
distribution: 'temurin'
distribution: 'zulu'
cache: gradle
- name: Setup Node.js
uses: actions/setup-node@v3
with:
node-version: "lts/*"
- name: Build with Gradle
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: ./gradlew build clean
node-version: "18"
cache: 'npm'
- name: Setup semantic-release
run: npm install -g semantic-release @semantic-release/git @semantic-release/changelog gradle-semantic-release-plugin -D
run: npm install
- name: Release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: npx semantic-release
GITHUB_TOKEN: ${{ secrets.REPOSITORY_PUSH_ACCESS }}
run: npm exec semantic-release

View 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 }}"}'

8
.gitignore vendored
View File

@@ -74,6 +74,7 @@ cmake-build-*/
# IntelliJ
out/
.idea
# mpeltonen/sbt-idea plugin
.idea_modules/
@@ -112,5 +113,10 @@ gradle-app.setting
# # Work around https://youtrack.jetbrains.com/issue/IDEA-116898
# gradle/wrapper/gradle-wrapper.properties
# Dependency directories
node_modules/
# ReVanced CLI
revanced-cache/
options.toml
options.toml

9
.idea/.gitignore generated vendored
View File

@@ -1,9 +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

7
.idea/discord.xml generated
View File

@@ -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>

View File

@@ -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
View File

@@ -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
View File

@@ -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>

View File

@@ -7,11 +7,13 @@
}
],
"plugins": [
["@semantic-release/commit-analyzer", {
"releaseRules": [
{"type": "build", "release": "patch"}
]
}],
[
"@semantic-release/commit-analyzer", {
"releaseRules": [
{ "type": "build", "scope": "revanced-patcher", "release": "patch" }
]
}
],
"@semantic-release/release-notes-generator",
"@semantic-release/changelog",
"gradle-semantic-release-plugin",
@@ -31,7 +33,15 @@
{
"path": "build/libs/*all.jar"
}
]
],
successComment: false
}
],
[
"@saithodev/semantic-release-backmerge",
{
backmergeBranches: [{"from": "main", "to": "dev"}],
clearWorkspace: true
}
]
]

File diff suppressed because it is too large Load Diff

View File

@@ -1,5 +1,5 @@
plugins {
kotlin("jvm") version "1.7.0"
kotlin("jvm") version "1.8.10"
id("com.github.johnrengelman.shadow") version "7.1.2"
}
@@ -23,25 +23,39 @@ repositories {
}
dependencies {
implementation(kotlin("reflect"))
implementation("org.jetbrains.kotlin:kotlin-reflect:1.8.20-RC")
implementation("app.revanced:revanced-patcher:6.0.2")
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("app.revanced:revanced-patcher:11.0.0")
implementation("info.picocli:picocli:4.7.1")
implementation("com.github.revanced:jadb:2531a28109") // updated fork
implementation("com.android.tools.build:apksig:8.1.0-alpha09")
implementation("org.bouncycastle:bcpkix-jdk15on:1.70")
implementation("cc.ekblad:4koma:1.1.0")
implementation("com.fasterxml.jackson.module:jackson-module-kotlin:2.14.+")
testImplementation("org.jetbrains.kotlin:kotlin-test:1.8.20-RC")
}
kotlin {
jvmToolchain(11)
}
tasks {
test {
useJUnitPlatform()
testLogging {
events("PASSED", "SKIPPED", "FAILED")
}
}
build {
dependsOn(shadowJar)
}
shadowJar {
manifest {
attributes("Main-Class" to "app.revanced.cli.main.MainKt")
attributes("Implementation-Title" to project.name)
attributes("Implementation-Version" to project.version)
}
minimize {
exclude(dependency("org.jetbrains.kotlin:.*"))
exclude(dependency("org.bouncycastle:.*"))
exclude(dependency("app.revanced:.*"))
}
}
// Dummy task to fix the Gradle semantic-release plugin.

15
docs/0_prerequisites.md Normal file
View File

@@ -0,0 +1,15 @@
# 💼 Prerequisites
To use ReVanced CLI, you will need to fulfill certain requirements.
## 🤝 Requirements
- [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)
- Java SDK 17 or higher (Azul JDK or OpenJDK)
## ⏭️ 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)

74
docs/1_usage.md Normal file
View File

@@ -0,0 +1,74 @@
# 🛠️ Using ReVanced CLI
Learn how to 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 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 ReVanced CLI without root permissions
```bash
java -jar revanced-cli.jar \
-a input.apk \
-o patched-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 \
-d device-name \
-o patched-output.apk \
-b revanced-patches.jar \
-e vanced-microg-support \
--mount
```
> **Note**:
>
> - If you want to exclude patches, you can use the option `-e`. In the case of YouTube, you can exclude
the `vanced-microg-support` patch from [ReVanced Patches](https://github.com/revanced/revanced-patches) with the
option `-e vanced-microg-support` when mounting for example.
>
> - 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`.
> The integrations will be merged, if necessary automatically, if supplied.
>
> - 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
View 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)

View File

@@ -1,2 +1,2 @@
kotlin.code.style = official
version = 2.15.1
version = 2.21.3-dev.1

View File

@@ -1,5 +1,5 @@
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.1.1-all.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists

6580
package-lock.json generated Normal file

File diff suppressed because it is too large Load Diff

9
package.json Normal file
View File

@@ -0,0 +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.6",
"semantic-release": "^20.1.0"
}
}

View File

@@ -1,12 +1,37 @@
package app.revanced.cli.aligning
import app.revanced.cli.command.MainCommand.logger
import app.revanced.patcher.PatcherResult
import app.revanced.utils.signing.align.ZipAligner
import app.revanced.utils.signing.align.zip.ZipFile
import app.revanced.utils.signing.align.zip.structures.ZipEntry
import java.io.File
object Aligning {
fun align(inputFile: File, outputFile: File) {
fun align(result: PatcherResult, inputFile: File, outputFile: File) {
logger.info("Aligning ${inputFile.name} to ${outputFile.name}")
ZipAligner.align(inputFile, outputFile)
if (outputFile.exists()) outputFile.delete()
ZipFile(outputFile).use { file ->
result.dexFiles.forEach {
file.addEntryCompressData(
ZipEntry.createWithName(it.name),
it.stream.readBytes()
)
}
result.resourceFile?.let {
file.copyEntriesFromFileAligned(
ZipFile(it),
ZipAligner::getEntryAlignment
)
}
file.copyEntriesFromFileAligned(
ZipFile(inputFile),
ZipAligner::getEntryAlignment
)
}
}
}

View File

@@ -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"
@@ -35,13 +43,16 @@ internal object MainCommand : Runnable {
lateinit var args: Args
class Args {
@Option(names = ["-a", "--apk"], description = ["Input file to be patched"], required = true)
@Option(names = ["-a", "--apk"], description = ["Input 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 = ["-d", "--deploy-on"], description = ["If specified, deploy to adb device with given name"])
@Option(
names = ["-d", "--deploy-on"],
description = ["If specified, deploy to device over ADB with given name"]
)
var deploy: String? = null
@ArgGroup(exclusive = false)
@@ -49,11 +60,11 @@ internal object MainCommand : Runnable {
}
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>()
@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
@@ -63,7 +74,7 @@ internal object MainCommand : Runnable {
}
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
@Option(names = ["--with-versions"], description = ["List patches with compatible versions"])
@@ -71,9 +82,6 @@ internal object MainCommand : Runnable {
@Option(names = ["--with-packages"], description = ["List patches with compatible packages"])
var withPackages: Boolean = false
@Option(names = ["--with-descriptions"], description = ["List patches with their descriptions"])
var withDescriptions: Boolean = true
}
class PatchingArgs {
@@ -87,7 +95,7 @@ internal object MainCommand : Runnable {
names = ["--exclusive"],
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"])
var includedPatches = arrayOf<String>()
@@ -134,7 +142,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(
@@ -151,16 +162,14 @@ internal object MainCommand : Runnable {
Adb(outputFile, patcher.context.packageMetadata.packageName, args.deploy!!, !pArgs.mount)
}
val patchedFile = File(pArgs.cacheDirectory).resolve("${outputFile.nameWithoutExtension}_raw.apk")
// start the patcher
Patcher.start(patcher, patchedFile, allPatches)
val result = Patcher.start(patcher, allPatches)
val cacheDirectory = File(pArgs.cacheDirectory)
// align the file
val alignedFile = cacheDirectory.resolve("${outputFile.nameWithoutExtension}_aligned.apk")
Aligning.align(patchedFile, alignedFile)
Aligning.align(result, args.inputFile, alignedFile)
// sign the file
val finalFile = if (!pArgs.mount) {
@@ -222,7 +231,7 @@ internal object MainCommand : Runnable {
for (patchBundlePath in args.patchArgs?.patchBundles!!) for (patch in PatchBundle.Jar(patchBundlePath)
.loadPatches()) {
if (patch.patchName in logged) continue
for (compatiblePackage in patch.compatiblePackages!!) {
for (compatiblePackage in patch.compatiblePackages ?: continue) {
val packageEntryStr = buildString {
// Add package if flag is set
if (args.patchArgs?.listingArgs?.withPackages == true) {
@@ -230,14 +239,15 @@ internal object MainCommand : Runnable {
append(packageName)
append("\t")
}
// Add patch name
val patchName = patch.patchName.padStart(25)
append(patchName)
// Add description if flag is set.
if (args.patchArgs?.listingArgs?.withDescriptions == true) {
append("\t")
append(patch.description)
}
append("\t")
append(patch.description)
// Add compatible versions, if flag is set
if (args.patchArgs?.listingArgs?.withVersions == true) {
val compatibleVersions = compatiblePackage.versions.joinToString(separator = ", ")

View File

@@ -1,24 +1,16 @@
package app.revanced.cli.patcher
import app.revanced.cli.command.MainCommand.args
import app.revanced.cli.command.MainCommand.logger
import app.revanced.patcher.data.Context
import app.revanced.patcher.patch.Patch
import app.revanced.utils.filesystem.ZipFileSystemUtils
import app.revanced.cli.command.PatchList
import app.revanced.patcher.PatcherResult
import app.revanced.utils.patcher.addPatchesFiltered
import app.revanced.utils.patcher.applyPatchesVerbose
import app.revanced.utils.patcher.mergeFiles
import java.io.File
import java.nio.file.Files
internal object Patcher {
internal fun start(
patcher: app.revanced.patcher.Patcher,
output: File,
allPatches: List<Class<out Patch<Context>>>
) {
val inputFile = args.inputFile
allPatches: PatchList
): PatcherResult {
// merge files like necessary integrations
patcher.mergeFiles()
// add patches, but filter incompatible or excluded patches
@@ -26,28 +18,6 @@ internal object Patcher {
// apply patches
patcher.applyPatchesVerbose()
// write output file
if (output.exists()) Files.delete(output.toPath())
inputFile.copyTo(output)
val result = patcher.save()
ZipFileSystemUtils(output).use { outputFileSystem ->
// replace all dex files
result.dexFiles.forEach {
logger.info("Writing dex file ${it.name}")
outputFileSystem.write(it.name, it.stream.readAllBytes())
}
result.resourceFile?.let {
logger.info("Writing resources...")
ZipFileSystemUtils(it).use { resourceFileSystem ->
val resourceFiles = resourceFileSystem.getFile(File.separator)
outputFileSystem.writePathRecursively(resourceFiles)
}
}
result.doNotCompress?.let { outputFileSystem.uncompress(*it.toTypedArray()) }
}
return patcher.save()
}
}

View File

@@ -0,0 +1,103 @@
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 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 -> PatchOption.Option(option.key, option.value) }
)
}.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?)
}
}

View File

@@ -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
}

View File

@@ -17,7 +17,7 @@ internal class Adb(
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)

View File

@@ -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()
}

View File

@@ -3,15 +3,15 @@ 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
import app.revanced.patcher.extensions.PatchExtensions.deprecated
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
@@ -19,29 +19,14 @@ fun Patcher.addPatchesFiltered(allPatches: List<Class<out Patch<Context>>>) {
allPatches.forEach patchLoop@{ patch ->
val compatiblePackages = patch.compatiblePackages
val patchName = patch.patchName
val prefix = "Skipping $patchName, reason"
val args = MainCommand.args.patchArgs?.patchingArgs!!
if (args.excludedPatches.contains(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
}
val prefix = "Skipping $patchName"
patch.deprecated?.let { (reason, replacement) ->
logger.warn("$prefix: deprecated: $reason")
if (replacement != null) logger.warn("Either use ${replacement.java.patchName} instead or include it manually")
return@patchLoop
}
if (compatiblePackages == null) logger.warn("$prefix: Missing compatibility annotation. Continuing.")
if (compatiblePackages == null) logger.trace("$patchName: No constraint on packages.")
else {
if (!compatiblePackages.any { it.name == packageName }) {
logger.warn("$prefix: incompatible with $packageName. This patch is only compatible with ${
logger.trace("$prefix: Incompatible with $packageName. This patch is only compatible with ${
compatiblePackages.joinToString(
", "
) { it.name }
@@ -53,11 +38,19 @@ 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)) {
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")
includedPatches.add(patch)
}
@@ -77,7 +70,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")
}
}

View File

@@ -1,28 +1,11 @@
package app.revanced.utils.signing.align
import app.revanced.utils.signing.align.zip.ZipFile
import java.io.File
import app.revanced.utils.signing.align.zip.structures.ZipEntry
internal object ZipAligner {
private const val DEFAULT_ALIGNMENT = 4
private const val LIBRARY_ALIGNMENT = 4096
fun align(input: File, output: File) {
val inputZip = ZipFile(input)
val outputZip = ZipFile(output)
for (entry in inputZip.entries) {
val data = inputZip.getDataForEntry(entry)
if (entry.compression == 0.toUShort()) {
val alignment = if (entry.fileName.endsWith(".so")) LIBRARY_ALIGNMENT else DEFAULT_ALIGNMENT
outputZip.addEntryAligned(entry, data, alignment)
} else {
outputZip.addEntry(entry, data)
}
}
outputZip.finish()
}
fun getEntryAlignment(entry: ZipEntry): Int? =
if (entry.compression.toUInt() != 0u) null else if (entry.fileName.endsWith(".so")) LIBRARY_ALIGNMENT else DEFAULT_ALIGNMENT
}

View File

@@ -2,15 +2,21 @@ package app.revanced.utils.signing.align.zip
import app.revanced.utils.signing.align.zip.structures.ZipEndRecord
import app.revanced.utils.signing.align.zip.structures.ZipEntry
import java.io.Closeable
import java.io.File
import java.io.RandomAccessFile
import java.nio.ByteBuffer
import java.nio.channels.FileChannel
import java.util.zip.CRC32
import java.util.zip.Deflater
class ZipFile(val file: File) {
class ZipFile(file: File) : Closeable {
var entries: MutableList<ZipEntry> = mutableListOf()
private val filePointer: RandomAccessFile = RandomAccessFile(file, "rw")
private var CDNeedsRewrite = false
private val compressionLevel = 5
init {
//if file isn't empty try to load entries
@@ -53,23 +59,24 @@ class ZipFile(val file: File) {
return buildList(numberOfEntries) {
for (i in 1..numberOfEntries) {
add(ZipEntry.fromCDE(filePointer).also
{
//for some reason the local extra field can be different from the central one
it.readLocalExtra(
filePointer.channel.map(
FileChannel.MapMode.READ_ONLY,
it.localHeaderOffset.toLong() + 28,
2
add(
ZipEntry.fromCDE(filePointer).also
{
//for some reason the local extra field can be different from the central one
it.readLocalExtra(
filePointer.channel.map(
FileChannel.MapMode.READ_ONLY,
it.localHeaderOffset.toLong() + 28,
2
)
)
)
})
})
}
}
}
private fun writeCDE() {
val CDEStart = filePointer.channel.position().toUInt()
private fun writeCD() {
val CDStart = filePointer.channel.position().toUInt()
entries.forEach {
filePointer.channel.write(it.toCDE())
@@ -82,15 +89,17 @@ class ZipFile(val file: File) {
0u,
entriesCount,
entriesCount,
filePointer.channel.position().toUInt() - CDEStart,
CDEStart,
filePointer.channel.position().toUInt() - CDStart,
CDStart,
""
)
filePointer.channel.write(endRecord.toECD())
}
fun addEntry(entry: ZipEntry, data: ByteBuffer) {
private fun addEntry(entry: ZipEntry, data: ByteBuffer) {
CDNeedsRewrite = true
entry.localHeaderOffset = filePointer.channel.position().toUInt()
filePointer.channel.write(entry.toLFH())
@@ -99,17 +108,45 @@ class ZipFile(val file: File) {
entries.add(entry)
}
fun addEntryAligned(entry: ZipEntry, data: ByteBuffer, alignment: Int) {
//calculate where data would end up
val dataOffset = filePointer.filePointer + entry.LFHSize
fun addEntryCompressData(entry: ZipEntry, data: ByteArray) {
val compressor = Deflater(compressionLevel, true)
compressor.setInput(data)
compressor.finish()
val mod = dataOffset % alignment
val uncompressedSize = data.size
val compressedData =
ByteArray(uncompressedSize) //i'm guessing compression won't make the data bigger
//wrong alignment
if (mod != 0L) {
//add padding at end of extra field
entry.localExtraField =
entry.localExtraField.copyOf((entry.localExtraField.size + (alignment - mod)).toInt())
val compressedDataLength = compressor.deflate(compressedData)
val compressedBuffer =
ByteBuffer.wrap(compressedData.take(compressedDataLength).toByteArray())
compressor.end()
val crc = CRC32()
crc.update(data)
entry.compression = 8u //deflate compression
entry.uncompressedSize = uncompressedSize.toUInt()
entry.compressedSize = compressedDataLength.toUInt()
entry.crc32 = crc.value.toUInt()
addEntry(entry, compressedBuffer)
}
private fun addEntryCopyData(entry: ZipEntry, data: ByteBuffer, alignment: Int? = null) {
alignment?.let {
//calculate where data would end up
val dataOffset = filePointer.filePointer + entry.LFHSize
val mod = dataOffset % alignment
//wrong alignment
if (mod != 0L) {
//add padding at end of extra field
entry.localExtraField =
entry.localExtraField.copyOf((entry.localExtraField.size + (alignment - mod)).toInt())
}
}
addEntry(entry, data)
@@ -123,8 +160,17 @@ class ZipFile(val file: File) {
)
}
fun finish() {
writeCDE()
fun copyEntriesFromFileAligned(file: ZipFile, entryAlignment: (entry: ZipEntry) -> Int?) {
for (entry in file.entries) {
if (entries.any { it.fileName == entry.fileName }) continue //don't add duplicates
val data = file.getDataForEntry(entry)
addEntryCopyData(entry, data, entryAlignment(entry))
}
}
override fun close() {
if (CDNeedsRewrite) writeCD()
filePointer.close()
}
}
}

View File

@@ -9,12 +9,12 @@ data class ZipEntry(
val version: UShort,
val versionNeeded: UShort,
val flags: UShort,
val compression: UShort,
var compression: UShort,
val modificationTime: UShort,
val modificationDate: UShort,
val crc32: UInt,
val compressedSize: UInt,
val uncompressedSize: UInt,
var crc32: UInt,
var compressedSize: UInt,
var uncompressedSize: UInt,
val diskNumber: UShort,
val internalAttributes: UShort,
val externalAttributes: UInt,
@@ -22,7 +22,7 @@ data class ZipEntry(
val fileName: String,
val extraField: ByteArray,
val fileComment: String,
var localExtraField: ByteArray = ByteArray(0), //seperate for alignment
var localExtraField: ByteArray = ByteArray(0), //separate for alignment
) {
val LFHSize: Int
get() = LFH_HEADER_SIZE + fileName.toByteArray(Charsets.UTF_8).size + localExtraField.size
@@ -37,6 +37,27 @@ data class ZipEntry(
const val LFH_HEADER_SIZE = 30
const val LFH_SIGNATURE = 0x04034b50u
fun createWithName(fileName: String): ZipEntry {
return ZipEntry(
0x1403u, //made by unix, version 20
0u,
0u,
0u,
0x0821u, //seems to be static time google uses, no idea
0x0221u, //same as above
0u,
0u,
0u,
0u,
0u,
0u,
0u,
fileName,
ByteArray(0),
""
)
}
fun fromCDE(input: DataInput): ZipEntry {
val signature = input.readUIntLE()
@@ -55,7 +76,7 @@ data class ZipEntry(
val fileNameLength = input.readUShortLE()
var fileName = ""
val extraFieldLength = input.readUShortLE()
var extraField = ByteArray(extraFieldLength.toInt())
val extraField = ByteArray(extraFieldLength.toInt())
val fileCommentLength = input.readUShortLE()
var fileComment = ""
val diskNumber = input.readUShortLE()
@@ -63,7 +84,8 @@ data class ZipEntry(
val externalAttributes = input.readUIntLE()
val localHeaderOffset = input.readUIntLE()
val variableFieldsLength = fileNameLength.toInt() + extraFieldLength.toInt() + fileCommentLength.toInt()
val variableFieldsLength =
fileNameLength.toInt() + extraFieldLength.toInt() + fileCommentLength.toInt()
if (variableFieldsLength > 0) {
val fileNameBytes = ByteArray(fileNameLength.toInt())
@@ -77,7 +99,8 @@ data class ZipEntry(
fileComment = fileCommentBytes.toString(Charsets.UTF_8)
}
flags = (flags and 0b1000u.inv().toUShort()) //disable data descriptor flag as they are not used
flags = (flags and 0b1000u.inv()
.toUShort()) //disable data descriptor flag as they are not used
return ZipEntry(
version,
@@ -134,8 +157,9 @@ data class ZipEntry(
val nameBytes = fileName.toByteArray(Charsets.UTF_8)
val commentBytes = fileComment.toByteArray(Charsets.UTF_8)
val buffer = ByteBuffer.allocate(CDE_HEADER_SIZE + nameBytes.size + extraField.size + commentBytes.size)
.also { it.order(ByteOrder.LITTLE_ENDIAN) }
val buffer =
ByteBuffer.allocate(CDE_HEADER_SIZE + nameBytes.size + extraField.size + commentBytes.size)
.also { it.order(ByteOrder.LITTLE_ENDIAN) }
buffer.putUInt(CDE_SIGNATURE)
buffer.putUShort(version)
@@ -162,5 +186,4 @@ data class ZipEntry(
buffer.flip()
return buffer
}
}
}

View 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}]}]"
}