1
mirror of https://github.com/revanced/revanced-patcher synced 2025-09-06 16:38:50 +02:00

Compare commits

...

389 Commits

Author SHA1 Message Date
semantic-release-bot
7761d5b85e chore(release): 4.1.5 [skip ci]
## [4.1.5](https://github.com/revanced/revanced-patcher/compare/v4.1.4...v4.1.5) (2022-09-08)

### Bug Fixes

* broken deprecation message ([62aa295](62aa295e73))
2022-09-08 11:43:39 +00:00
Sculas
62aa295e73 fix: broken deprecation message 2022-09-08 13:42:26 +02:00
Sculas
596ede1b12 refactor: make patchName work on any class 2022-09-08 13:42:15 +02:00
semantic-release-bot
7debe62738 chore(release): 4.1.4 [skip ci]
## [4.1.4](https://github.com/revanced/revanced-patcher/compare/v4.1.3...v4.1.4) (2022-09-08)

### Bug Fixes

* handle option types and nulls properly ([aff4968](aff4968e6f))
2022-09-08 09:30:49 +00:00
Sculas
002f84da1a Merge remote-tracking branch 'origin/main' into main 2022-09-08 11:29:14 +02:00
Sculas
aff4968e6f fix: handle option types and nulls properly 2022-09-08 11:29:06 +02:00
Sculas
1d989abd55 chore: ignore kotlinc 2022-09-08 11:07:34 +02:00
semantic-release-bot
f1775f83d0 chore(release): 4.1.3 [skip ci]
## [4.1.3](https://github.com/revanced/revanced-patcher/compare/v4.1.2...v4.1.3) (2022-09-07)

### Bug Fixes

* only run list option check if not null ([4055939](4055939c08))
2022-09-07 21:48:24 +00:00
Sculas
4055939c08 fix: only run list option check if not null 2022-09-07 23:46:46 +02:00
semantic-release-bot
85120374d6 chore(release): 4.1.2 [skip ci]
## [4.1.2](https://github.com/revanced/revanced-patcher/compare/v4.1.1...v4.1.2) (2022-09-07)

### Bug Fixes

* invalid types for example options ([79f91e0](79f91e0e5a))
2022-09-07 21:24:50 +00:00
Sculas
8b4819faa1 Merge remote-tracking branch 'origin/main' into main 2022-09-07 23:23:29 +02:00
semantic-release-bot
d219276298 chore(release): 4.1.1 [skip ci]
## [4.1.1](https://github.com/revanced/revanced-patcher/compare/v4.1.0...v4.1.1) (2022-09-07)

### Bug Fixes

* handle private companion objects ([ad3d332](ad3d332e27))
2022-09-07 21:23:12 +00:00
Sculas
79f91e0e5a fix: invalid types for example options 2022-09-07 23:22:34 +02:00
Sculas
fadf62f594 Merge remote-tracking branch 'origin/main' into main 2022-09-07 23:21:41 +02:00
Sculas
ad3d332e27 fix: handle private companion objects 2022-09-07 23:21:32 +02:00
semantic-release-bot
8f66df7666 chore(release): 4.1.0 [skip ci]
# [4.1.0](https://github.com/revanced/revanced-patcher/compare/v4.0.0...v4.1.0) (2022-09-07)

### Features

* deprecation for patches ([80c2e80](80c2e80925))
2022-09-07 20:32:51 +00:00
Sculas
80c2e80925 feat: deprecation for patches 2022-09-07 22:31:15 +02:00
semantic-release-bot
c3db23d3c7 chore(release): 4.0.0 [skip ci]
# [4.0.0](https://github.com/revanced/revanced-patcher/compare/v3.5.1...v4.0.0) (2022-09-07)

### Code Refactoring

* Improve Patch Options ([6b909c1](6b909c1ee6))

### BREAKING CHANGES

* Options has been moved from Patch to a new interface called OptionsContainer and are now handled entirely different. Make sure to check the examples to understand how it works.
2022-09-07 18:57:04 +00:00
Sculas
c28584736e Merge remote-tracking branch 'origin/main' into main 2022-09-07 20:55:45 +02:00
Sculas
6b909c1ee6 refactor: Improve Patch Options
It's so much better now. Really happy with the current system.

BREAKING CHANGE: Options has been moved from Patch to a new interface called OptionsContainer and are now handled entirely different. Make sure to check the examples to understand how it works.
2022-09-07 20:55:35 +02:00
Sculas
0e8446516e build: add Kotlin Reflect 2022-09-07 20:52:05 +02:00
semantic-release-bot
aa46b953db chore(release): 3.5.1 [skip ci]
## [3.5.1](https://github.com/revanced/revanced-patcher/compare/v3.5.0...v3.5.1) (2022-09-06)

### Bug Fixes

* add tests for PathOption ([d6308e1](d6308e126c))
* PathOption should be open, not sealed ([a562e47](a562e476c0))
* typo in ListOption ([3921648](392164862c))

### Performance Improvements

* make exception an object ([75d2be8](75d2be8803))
2022-09-06 20:38:24 +00:00
Sculas
a562e476c0 fix: PathOption should be open, not sealed 2022-09-06 22:36:20 +02:00
Sculas
75d2be8803 perf: make exception an object 2022-09-06 22:35:33 +02:00
Sculas
d6308e126c fix: add tests for PathOption 2022-09-06 22:35:00 +02:00
Sculas
bb97af4d86 refactor: add FileOption alias for PathOption 2022-09-06 22:34:46 +02:00
Sculas
392164862c fix: typo in ListOption 2022-09-06 21:44:05 +02:00
Sculas
53e807dec1 refactor: add PatchOption.PathOption 2022-09-06 21:43:45 +02:00
semantic-release-bot
288d50a8b4 chore(release): 3.5.0 [skip ci]
# [3.5.0](https://github.com/revanced/revanced-patcher/compare/v3.4.1...v3.5.0) (2022-09-05)

### Features

* default value for `Package.versions` annotation parameter ([131dedd](131dedd4b0))
2022-09-05 14:45:56 +00:00
oSumAtrIX
131dedd4b0 feat: default value for Package.versions annotation parameter
Reverts 4b81318710
2022-09-05 16:44:35 +02:00
semantic-release-bot
5a92d5c29d chore(release): 3.4.1 [skip ci]
## [3.4.1](https://github.com/revanced/revanced-patcher/compare/v3.4.0...v3.4.1) (2022-09-03)

### Bug Fixes

* remove default param from Package.versions ([4b81318](4b81318710))
2022-09-03 20:54:06 +00:00
Sculas
4b81318710 fix: remove default param from Package.versions
Kotlin compiler bug produces invalid bytecode, resulting in an IncompleteAnnotationException at runtime.
2022-09-03 22:52:49 +02:00
semantic-release-bot
44f6a3ebc5 chore(release): 3.4.0 [skip ci]
# [3.4.0](https://github.com/revanced/revanced-patcher/compare/v3.3.3...v3.4.0) (2022-08-31)

### Features

* nullable parameters ([7882a8d](7882a8d928))
2022-08-31 18:32:43 +00:00
oSumAtrIX
7882a8d928 feat: nullable parameters
Signed-off-by: oSumAtrIX <johan.melkonyan1@web.de>
2022-08-31 20:30:31 +02:00
semantic-release-bot
cc3d32748b chore(release): 3.3.3 [skip ci]
## [3.3.3](https://github.com/revanced/revanced-patcher/compare/v3.3.2...v3.3.3) (2022-08-14)

### Bug Fixes

* show error message if cause is null ([f9da2ad](f9da2ad531))
2022-08-14 15:25:16 +00:00
oSumAtrIX
f9da2ad531 fix: show error message if cause is null 2022-08-14 17:22:43 +02:00
semantic-release-bot
b19e1131e8 chore(release): 3.3.2 [skip ci]
## [3.3.2](https://github.com/revanced/revanced-patcher/compare/v3.3.1...v3.3.2) (2022-08-06)

### Bug Fixes

* close open files ([#75](https://github.com/revanced/revanced-patcher/issues/75)) ([123ad54](123ad54c15))
2022-08-06 22:17:39 +00:00
dan1st
123ad54c15 fix: close open files (#75) 2022-08-07 00:16:23 +02:00
Sculas
09f6ab4155 Merge remote-tracking branch 'origin/main' into main 2022-08-03 18:32:34 +02:00
Sculas
01cf3fb50f refactor: util package structure 2022-08-03 18:31:31 +02:00
semantic-release-bot
6c5f9d4198 chore(release): 3.3.1 [skip ci]
## [3.3.1](https://github.com/revanced/revanced-patcher/compare/v3.3.0...v3.3.1) (2022-08-03)

### Bug Fixes

* revert soft dependencies ([7b2d058](7b2d058144))
2022-08-03 01:48:56 +00:00
oSumAtrIX
7b2d058144 fix: revert soft dependencies 2022-08-03 03:45:34 +02:00
semantic-release-bot
db2804270e chore(release): 3.3.0 [skip ci]
# [3.3.0](https://github.com/revanced/revanced-patcher/compare/v3.2.1...v3.3.0) (2022-08-02)

### Features

* add getValue & setValue for PatchOption ([2572cd0](2572cd04b5))
2022-08-02 21:31:59 +00:00
Sculas
2572cd04b5 feat: add getValue & setValue for PatchOption 2022-08-02 23:30:38 +02:00
semantic-release-bot
5eb8b428b9 chore(release): 3.2.1 [skip ci]
## [3.2.1](https://github.com/revanced/revanced-patcher/compare/v3.2.0...v3.2.1) (2022-08-02)

### Bug Fixes

* check if patch option requirement is met ([14a73bf](14a73bfcaf))
2022-08-02 20:43:26 +00:00
Sculas
3a118d9b9d Merge remote-tracking branch 'origin/main' into main 2022-08-02 22:41:41 +02:00
Sculas
14a73bfcaf fix: check if patch option requirement is met 2022-08-02 22:41:34 +02:00
semantic-release-bot
567bf52e16 chore(release): 3.2.0 [skip ci]
# [3.2.0](https://github.com/revanced/revanced-patcher/compare/v3.1.0...v3.2.0) (2022-08-02)

### Features

* PatchOptions#nullify to nullify an option ([371f0c4](371f0c4d0b))
2022-08-02 20:36:21 +00:00
Sculas
35c6489dba Merge remote-tracking branch 'origin/main' into main 2022-08-02 22:34:44 +02:00
Sculas
371f0c4d0b feat: PatchOptions#nullify to nullify an option 2022-08-02 22:32:55 +02:00
Sculas
1b42f65d95 refactor: migrate to custom exceptions for patch options 2022-08-02 22:16:37 +02:00
semantic-release-bot
2aee0cbd0f chore(release): 3.1.0 [skip ci]
# [3.1.0](https://github.com/revanced/revanced-patcher/compare/v3.0.0...v3.1.0) (2022-08-02)

### Features

* validator for patch options ([4e2e772](4e2e772389))
2022-08-02 20:02:18 +00:00
Sculas
19256b5437 Merge remote-tracking branch 'origin/main' into main 2022-08-02 22:00:40 +02:00
Sculas
67a5237541 test: refactor & add more tests 2022-08-02 22:00:32 +02:00
Sculas
4e2e772389 feat: validator for patch options 2022-08-02 22:00:10 +02:00
semantic-release-bot
799bc9e163 chore(release): 3.0.0 [skip ci]
# [3.0.0](https://github.com/revanced/revanced-patcher/compare/v2.9.0...v3.0.0) (2022-08-02)

### Features

* registry for patch options ([2431785](2431785d0e))

### BREAKING CHANGES

* Patch options now use the PatchOptions registry class instead of an Iterable. This change requires modifications to existing patches using this API.
2022-08-02 19:11:43 +00:00
Sculas
2431785d0e feat: registry for patch options
BREAKING CHANGE: Patch options now use the PatchOptions registry class instead of an Iterable. This change requires modifications to existing patches using this API.
2022-08-02 21:10:14 +02:00
semantic-release-bot
fb3c0e87d4 chore(release): 2.9.0 [skip ci]
# [2.9.0](https://github.com/revanced/revanced-patcher/compare/v2.8.0...v2.9.0) (2022-08-02)

### Bug Fixes

* show error message instead of `null` ([8d95b14](8d95b14f35))

### Features

* exclusive mutable access to files ([814ce0b](814ce0b9ae))
2022-08-02 01:11:01 +00:00
oSumAtrIX
5f7ef2dbff Merge remote-tracking branch 'origin/main' 2022-08-02 03:09:02 +02:00
Sculas
ec1d8a8fba refactor: remove DependencyType.SOFT (#82)
BREAKING-CHANGE: DependencyType.SOFT has now been removed after it was deprecated. There is no direct replacement for this. Please look into Patch Options instead, which supersedes this.
2022-08-02 00:47:32 +02:00
oSumAtrIX
814ce0b9ae feat: exclusive mutable access to files 2022-08-02 00:42:38 +02:00
oSumAtrIX
8d95b14f35 fix: show error message instead of null 2022-08-02 00:42:38 +02:00
semantic-release-bot
711b8a25a7 chore(release): 2.8.0 [skip ci]
# [2.8.0](https://github.com/revanced/revanced-patcher/compare/v2.7.0...v2.8.0) (2022-08-01)

### Bug Fixes

* remove requirement for solution [skip ci] ([#80](https://github.com/revanced/revanced-patcher/issues/80)) ([9a4d30e](9a4d30e152))

### Features

* patch options ([#81](https://github.com/revanced/revanced-patcher/issues/81)) ([fbb09f3](fbb09f38dc))
2022-08-01 22:32:32 +00:00
Sculas
fbb09f38dc feat: patch options (#81)
* feat: Patch Options

* refactor: remove delegate property

* feat: List patch options

* refactor: add setter example to PatchOptionsUsage.kt

* docs: add docs for PatchOptions

* docs: tidy docs
2022-08-02 00:31:00 +02:00
Robert
9a4d30e152 fix: remove requirement for solution [skip ci] (#80) 2022-08-01 13:07:12 +02:00
semantic-release-bot
368c61c1bf chore(release): 2.7.0 [skip ci]
# [2.7.0](https://github.com/revanced/revanced-patcher/compare/v2.6.0...v2.7.0) (2022-08-01)

### Features

* `Closeable` patches ([bbd40bf](bbd40bf2f6))
2022-08-01 02:15:18 +00:00
oSumAtrIX
bbd40bf2f6 feat: Closeable patches 2022-08-01 04:12:33 +02:00
Sculas
3de999a2d3 refactor: remove ReplaceWith from DependencyType.SOFT 2022-07-31 18:35:02 +02:00
Sculas
83cbb2f110 Merge remote-tracking branch 'origin/main' into main 2022-07-31 18:31:50 +02:00
Sculas
fcc7fa75d0 refactor: deprecate DependencyType.SOFT
Soft dependencies will be removed when Patch Options is implemented.
2022-07-31 18:31:40 +02:00
semantic-release-bot
495ebface8 chore(release): 2.6.0 [skip ci]
# [2.6.0](https://github.com/revanced/revanced-patcher/compare/v2.5.2...v2.6.0) (2022-07-31)

### Features

* add Patch#dependsOn extension ([523f67b](523f67b238))
* Soft Dependencies for Patches ([8c12f8d](8c12f8d488))
2022-07-31 14:52:23 +00:00
Sculas
8c12f8d488 feat: Soft Dependencies for Patches 2022-07-31 16:50:59 +02:00
Sculas
523f67b238 feat: add Patch#dependsOn extension 2022-07-31 15:07:23 +02:00
Sculas
4813a8b48e chore: remove import 2022-07-31 15:01:38 +02:00
Sculas
d5c66022c9 refactor: get rid of package names in example 2022-07-31 15:01:13 +02:00
Lucaskyy
1d4034b36c chore: add description to readme 2022-07-31 14:41:41 +02:00
oSumAtrIX
dd2d696d00 docs: add missing . to feature-issue.yml description 2022-07-26 19:38:00 +02:00
oSumAtrIX
6326321b65 docs: add missing . to issue description 2022-07-26 19:34:39 +02:00
oSumAtrIX
f291a4ae3e docs: GitHub issue forms 2022-07-26 19:28:32 +02:00
semantic-release-bot
817b8db019 chore(release): 2.5.2 [skip ci]
## [2.5.2](https://github.com/revanced/revanced-patcher/compare/v2.5.1...v2.5.2) (2022-07-24)
2022-07-24 16:30:57 +00:00
Sculas
a321b8971b build: update Apktool to 2.7.0 2022-07-24 18:29:25 +02:00
semantic-release-bot
783b2de9db chore(release): 2.5.1 [skip ci]
## [2.5.1](https://github.com/revanced/revanced-patcher/compare/v2.5.0...v2.5.1) (2022-07-17)

### Bug Fixes

* close stream when closing `DomFileEditor` ([77604d4](77604d4078))
2022-07-17 23:30:04 +00:00
oSumAtrIX
77604d4078 fix: close stream when closing DomFileEditor 2022-07-18 01:28:16 +02:00
oSumAtrIX
21b5404180 docs: change size of headings [skip ci] 2022-07-12 01:12:45 +02:00
semantic-release-bot
9ac6d5c7da chore(release): 2.5.0 [skip ci]
# [2.5.0](https://github.com/revanced/revanced-patcher/compare/v2.4.0...v2.5.0) (2022-07-11)

### Bug Fixes

* missing additional items [skip ci] ([0ebab8b](0ebab8bf59))

### Features

* feature request issue template ([1b39278](1b39278b24))
* issue templates [skip ci] ([112bc99](112bc998f4))
2022-07-11 18:21:14 +00:00
oSumAtrIX
1b39278b24 feat: feature request issue template 2022-07-11 20:19:53 +02:00
oSumAtrIX
0ebab8bf59 fix: missing additional items [skip ci] 2022-07-10 00:34:55 +02:00
oSumAtrIX
112bc998f4 feat: issue templates [skip ci] 2022-07-10 00:32:05 +02:00
semantic-release-bot
12c96bf818 chore(release): 2.4.0 [skip ci]
# [2.4.0](https://github.com/revanced/revanced-patcher/compare/v2.3.1...v2.4.0) (2022-07-09)

### Features

* Improve Smali Compiler ([6bfe571](6bfe5716c3))
2022-07-09 13:04:21 +00:00
oSumAtrIX
91298a8790 Merge pull request #52 from revanced/feat/smali-branching
feat: improve Smali compiler
2022-07-09 15:03:01 +02:00
oSumAtrIX
f2a7cff41c style: fix casing of the first letter in comments 2022-07-09 06:27:49 +02:00
oSumAtrIX
dd941233ca refactor: improve the addInstructions extension method further more 2022-07-09 06:26:05 +02:00
semantic-release-bot
fc06dd1c29 chore(release): 2.3.1 [skip ci]
## [2.3.1](https://github.com/revanced/revanced-patcher/compare/v2.3.0...v2.3.1) (2022-07-07)

### Bug Fixes

* handle null properly ([#64](https://github.com/revanced/revanced-patcher/issues/64)) ([482af78](482af78f2b))
2022-07-07 06:35:28 +00:00
bogadana
482af78f2b fix: handle null properly (#64) 2022-07-07 08:33:40 +02:00
semantic-release-bot
89a27dfbe6 chore(release): 2.3.0 [skip ci]
# [2.3.0](https://github.com/revanced/revanced-patcher/compare/v2.2.2...v2.3.0) (2022-07-05)

### Features

* nullability for `BytecodePatch` constructor ([#59](https://github.com/revanced/revanced-patcher/issues/59)) ([4ea030d](4ea030d0a0))
2022-07-05 14:48:22 +00:00
bogadana
4ea030d0a0 feat: nullability for BytecodePatch constructor (#59) 2022-07-05 16:46:54 +02:00
semantic-release-bot
4cc2fa17f5 chore(release): 2.2.2 [skip ci]
## [2.2.2](https://github.com/revanced/revanced-patcher/compare/v2.2.1...v2.2.2) (2022-07-04)

### Bug Fixes

* `MethodWalker` not accounting for all reference instructions ([48068cb](48068cb3d7))
2022-07-04 19:36:34 +00:00
oSumAtrIX
48068cb3d7 fix: MethodWalker not accounting for all reference instructions 2022-07-03 22:51:04 +02:00
semantic-release-bot
d107c7245c chore(release): 2.2.1 [skip ci]
## [2.2.1](https://github.com/revanced/revanced-patcher/compare/v2.2.0...v2.2.1) (2022-07-03)

### Bug Fixes

* more useful error message ([4b2e323](4b2e3230ec))
2022-07-03 14:46:19 +00:00
oSumAtrIX
4b2e3230ec fix: more useful error message 2022-07-03 15:37:48 +02:00
semantic-release-bot
fb5b82da4e chore(release): 2.2.0 [skip ci]
# [2.2.0](https://github.com/revanced/revanced-patcher/compare/v2.1.2...v2.2.0) (2022-07-02)

### Bug Fixes

* DomFileEditor opening in- and output streams on the same file ([83187c9](83187c9edd))

### Features

* remove deprecated functions ([ada5a03](ada5a033de))
* streams overload for `XmlFileHolder` ([6f72c4c](6f72c4c4c0))
2022-07-02 22:59:27 +00:00
oSumAtrIX
5970e32aa5 Merge pull request #57 from revanced/dev
Merge `dev` to `main`
2022-07-03 00:30:37 +02:00
semantic-release-bot
0f00d33f4e chore(release): 2.2.0-dev.3 [skip ci]
# [2.2.0-dev.3](https://github.com/revanced/revanced-patcher/compare/v2.2.0-dev.2...v2.2.0-dev.3) (2022-07-02)

### Bug Fixes

* DomFileEditor opening in- and output streams on the same file ([83187c9](83187c9edd))
2022-07-02 22:21:19 +00:00
oSumAtrIX
83187c9edd fix: DomFileEditor opening in- and output streams on the same file 2022-07-03 00:19:39 +02:00
semantic-release-bot
79d70cff4b chore(release): 2.2.0-dev.2 [skip ci]
# [2.2.0-dev.2](https://github.com/revanced/revanced-patcher/compare/v2.2.0-dev.1...v2.2.0-dev.2) (2022-07-02)

### Features

* streams overload for `XmlFileHolder` ([6f72c4c](6f72c4c4c0))
2022-07-02 15:46:16 +00:00
oSumAtrIX
6f72c4c4c0 feat: streams overload for XmlFileHolder 2022-07-02 17:44:08 +02:00
oSumAtrIX
c8eedac4d9 refactor: members of ResourceData 2022-07-02 16:22:19 +02:00
semantic-release-bot
60a8278ae8 chore(release): 2.2.0-dev.1 [skip ci]
# [2.2.0-dev.1](https://github.com/revanced/revanced-patcher/compare/v2.1.2...v2.2.0-dev.1) (2022-07-02)

### Features

* remove deprecated functions ([ada5a03](ada5a033de))
2022-07-02 02:23:32 +00:00
oSumAtrIX
ada5a033de feat: remove deprecated functions 2022-07-02 04:21:20 +02:00
semantic-release-bot
109b8a296d chore(release): 2.1.2 [skip ci]
## [2.1.2](https://github.com/revanced/revanced-patcher/compare/v2.1.1...v2.1.2) (2022-06-29)

### Bug Fixes

* invert fingerprint resolution condition of `customFingerprint` ([e2faf4c](e2faf4ca9b))
2022-06-29 23:37:37 +00:00
oSumAtrIX
e2faf4ca9b fix: invert fingerprint resolution condition of customFingerprint 2022-06-30 01:36:25 +02:00
oSumAtrIX
2134182a0e refactor: declare data parameter internal 2022-06-29 19:55:23 +02:00
semantic-release-bot
d8b5b8bb7c chore(release): 2.1.1 [skip ci]
## [2.1.1](https://github.com/revanced/revanced-patcher/compare/v2.1.0...v2.1.1) (2022-06-28)
2022-06-28 17:47:39 +00:00
Sculas
49970b5926 build: update Apktool to re-enable 9patch decoder 2022-06-28 19:45:45 +02:00
semantic-release-bot
c1fbd8cf8c chore(release): 2.1.0 [skip ci]
# [2.1.0](https://github.com/revanced/revanced-patcher/compare/v2.0.4...v2.1.0) (2022-06-28)

### Features

* log failed patches due to failed dependencies ([a467fbb](a467fbb704))
2022-06-28 01:27:05 +00:00
oSumAtrIX
a467fbb704 feat: log failed patches due to failed dependencies 2022-06-28 03:25:49 +02:00
semantic-release-bot
5a4bd7a76e chore(release): 2.0.4 [skip ci]
## [2.0.4](https://github.com/revanced/revanced-patcher/compare/v2.0.3...v2.0.4) (2022-06-27)
2022-06-27 22:38:36 +00:00
Sculas
e5ca86fac6 build: update Apktool to disable 9patch decoder
for real for real, this time
2022-06-28 00:36:50 +02:00
semantic-release-bot
68d9e9f02c chore(release): 2.0.3 [skip ci]
## [2.0.3](https://github.com/revanced/revanced-patcher/compare/v2.0.2...v2.0.3) (2022-06-27)
2022-06-27 22:22:19 +00:00
Sculas
494a9a09ac build: update Apktool to disable 9patch decoder
for real, this time
2022-06-28 00:20:54 +02:00
semantic-release-bot
06a88839de chore(release): 2.0.2 [skip ci]
## [2.0.2](https://github.com/revanced/revanced-patcher/compare/v2.0.1...v2.0.2) (2022-06-27)
2022-06-27 22:05:56 +00:00
Sculas
4c41b955df ci: trigger release on build commits 2022-06-28 00:04:39 +02:00
Sculas
614e555f4c build: update Apktool to disable 9patch decoder 2022-06-28 00:01:38 +02:00
Lucaskyy
6bfe5716c3 feat: Improve Smali Compiler
- Branching support has been added. See InlineSmaliCompilerTest.kt for an example.
- Some other improvements have been made too.
2022-06-27 21:11:59 +02:00
semantic-release-bot
d6ed06a327 chore(release): 2.0.1 [skip ci]
## [2.0.1](https://github.com/revanced/revanced-patcher/compare/v2.0.0...v2.0.1) (2022-06-26)

### Bug Fixes

* use `Exception` instead of `MethodNotFoundException` ([2fc4ec4](2fc4ec4021))
2022-06-26 16:03:10 +00:00
oSumAtrIX
2fc4ec4021 fix: use Exception instead of MethodNotFoundException 2022-06-26 18:01:54 +02:00
Lucaskyy
f565c4f6a7 refactor: improve ResourceData.kt
Old methods have been marked as deprecated, and will be removed in the future.

- ResourceData.kt was made an Iterable<File>, and the forEach method was removed in favor of Kotlin's forEach function. (no modifications required)
- The resolve method was deprecated in favor of a new operator getter function, which can be either called using get(path) or data[path]. This keeps backwards compatibility with the old get method.
- The getXmlEditor method was deprecated in favor of the new xmlEditor variable, which is a XmlFileHolder which has an operator getter which acts like an array. This is syntactically better.
2022-06-26 17:14:38 +02:00
Lucaskyy
35749454ab refactor: remove deprecated methods in ResourceData.kt 2022-06-26 16:53:25 +02:00
Lucaskyy
2b492e7a5e refactor: cleanup code 2022-06-26 16:32:22 +02:00
Lucaskyy
081a5a6849 refactor: fmt ExampleBytecodePatch.kt 2022-06-26 16:21:55 +02:00
Lucaskyy
852ae7d8d1 refactor: move BytecodeData#proxy into class 2022-06-26 16:20:45 +02:00
semantic-release-bot
52f8a6a2eb chore(release): 2.0.0 [skip ci]
# [2.0.0](https://github.com/revanced/revanced-patcher/compare/v1.11.0...v2.0.0) (2022-06-26)

### Code Refactoring

* migrate from `Signature` to `Fingerprint` ([efa8ea1](efa8ea1445))

### BREAKING CHANGES

* Not backwards compatible, since a lot of classes where renamed.
2022-06-26 13:12:24 +00:00
oSumAtrIX
efa8ea1445 refactor: migrate from Signature to Fingerprint
BREAKING CHANGE: Not backwards compatible, since a lot of classes where renamed.
2022-06-26 15:10:54 +02:00
semantic-release-bot
c828fa2a27 chore(release): 1.11.0 [skip ci]
# [1.11.0](https://github.com/revanced/revanced-patcher/compare/v1.10.2...v1.11.0) (2022-06-24)

### Features

* add replace and remove extensions ([#50](https://github.com/revanced/revanced-patcher/issues/50)) ([92ac5e4](92ac5e4dc2))
2022-06-24 16:49:12 +00:00
bogadana
92ac5e4dc2 feat: add replace and remove extensions (#50) 2022-06-24 18:47:37 +02:00
semantic-release-bot
070c09cf71 chore(release): 1.10.2 [skip ci]
## [1.10.2](https://github.com/revanced/revanced-patcher/compare/v1.10.1...v1.10.2) (2022-06-23)

### Bug Fixes

* dexlib must be propagated ([b738dcd](b738dcd7ea))
2022-06-23 10:21:25 +00:00
Sculas
b738dcd7ea fix: dexlib must be propagated 2022-06-23 12:20:04 +02:00
semantic-release-bot
8efcf329bb chore(release): 1.10.1 [skip ci]
## [1.10.1](https://github.com/revanced/revanced-patcher/compare/v1.10.0...v1.10.1) (2022-06-23)

### Bug Fixes

* callback only when inteded ([e3bf367](e3bf367ad6))
* mutability of local variable `modified` ([0e87ef5](0e87ef56c4))
2022-06-23 06:59:43 +00:00
oSumAtrIX
0e87ef56c4 fix: mutability of local variable modified 2022-06-23 08:57:41 +02:00
oSumAtrIX
e3bf367ad6 fix: callback only when inteded 2022-06-23 08:54:47 +02:00
semantic-release-bot
3d61dacbda chore(release): 1.10.0 [skip ci]
# [1.10.0](https://github.com/revanced/revanced-patcher/compare/v1.9.0...v1.10.0) (2022-06-23)

### Features

* improve logging ([c20dfe1](c20dfe12d5))
2022-06-23 00:12:04 +00:00
oSumAtrIX
c20dfe12d5 feat: improve logging 2022-06-23 02:10:43 +02:00
semantic-release-bot
78663cde88 chore(release): 1.9.0 [skip ci]
# [1.9.0](https://github.com/revanced/revanced-patcher/compare/v1.8.0...v1.9.0) (2022-06-22)

### Bug Fixes

* callback for each file instead of class ([930768d](930768dfb3))

### Features

* yield the patch result ([dde5385](dde5385232))
2022-06-22 23:43:17 +00:00
oSumAtrIX
dde5385232 feat: yield the patch result 2022-06-23 01:41:52 +02:00
oSumAtrIX
930768dfb3 fix: callback for each file instead of class 2022-06-23 01:41:52 +02:00
semantic-release-bot
1f4bc5079f chore(release): 1.8.0 [skip ci]
# [1.8.0](https://github.com/revanced/revanced-patcher/compare/v1.7.2...v1.8.0) (2022-06-22)

### Features

* logging class ([caf2745](caf2745805))
2022-06-22 23:25:29 +00:00
oSumAtrIX
caf2745805 feat: logging class 2022-06-23 01:23:35 +02:00
oSumAtrIX
a4529c3fee refactor: logging and exception strings 2022-06-22 16:47:58 +02:00
semantic-release-bot
835c0f9f7a chore(release): 1.7.2 [skip ci]
## [1.7.2](https://github.com/revanced/revanced-patcher/compare/v1.7.1...v1.7.2) (2022-06-22)

### Bug Fixes

* add execute permission to `./gradlew` file ([#46](https://github.com/revanced/revanced-patcher/issues/46)) ([34f607a](34f607aa24))
2022-06-22 14:17:16 +00:00
Oskar
34f607aa24 fix: add execute permission to ./gradlew file (#46) 2022-06-22 16:16:00 +02:00
Lucaskyy
0f38b94701 Merge remote-tracking branch 'origin/main' into main 2022-06-22 16:13:34 +02:00
Lucaskyy
39bb1b25dc refactor: add logging 2022-06-22 16:13:23 +02:00
Lucaskyy
4fc63a4d8a refactor: add callbacks for applyPatches & addFiles 2022-06-22 15:37:33 +02:00
semantic-release-bot
6037397bc2 chore(release): 1.7.1 [skip ci]
## [1.7.1](https://github.com/revanced/revanced-patcher/compare/v1.7.0...v1.7.1) (2022-06-22)

### Reverts

* revert "feat: use of `java.util.logging.Logger`" ([e8488b3](e8488b3e86))
2022-06-22 13:07:22 +00:00
Lucaskyy
273dd86b65 chore: remove ExtFile import 2022-06-22 15:04:05 +02:00
Lucaskyy
e8488b3e86 revert "feat: use of java.util.logging.Logger"
This reverts commit 9c39c9efdb.
This reverts commit 8f66f9f606.
2022-06-22 15:03:30 +02:00
semantic-release-bot
c13361823d chore(release): 1.7.0 [skip ci]
# [1.7.0](https://github.com/revanced/revanced-patcher/compare/v1.6.0...v1.7.0) (2022-06-22)

### Features

* migrate logger to `slf4j` ([8f66f9f](8f66f9f606))
2022-06-22 12:18:57 +00:00
oSumAtrIX
8f66f9f606 feat: migrate logger to slf4j 2022-06-22 14:17:09 +02:00
semantic-release-bot
a123026f46 chore(release): 1.6.0 [skip ci]
# [1.6.0](https://github.com/revanced/revanced-patcher/compare/v1.5.0...v1.6.0) (2022-06-22)

### Features

* use of `java.util.logging.Logger` ([9c39c9e](9c39c9efdb))
2022-06-22 11:48:43 +00:00
oSumAtrIX
9c39c9efdb feat: use of java.util.logging.Logger 2022-06-22 13:45:13 +02:00
semantic-release-bot
3ee1c01430 chore(release): 1.5.0 [skip ci]
# [1.5.0](https://github.com/revanced/revanced-patcher/compare/v1.4.0...v1.5.0) (2022-06-22)

### Features

* use streams to write the dex files ([64bae88](64bae884dc))
2022-06-22 01:21:33 +00:00
oSumAtrIX
64bae884dc feat: use streams to write the dex files 2022-06-22 03:19:39 +02:00
semantic-release-bot
e94a706949 chore(release): 1.4.0 [skip ci]
# [1.4.0](https://github.com/revanced/revanced-patcher/compare/v1.3.4...v1.4.0) (2022-06-22)

### Features

* return a `File` instance instead of `ExtFile` ([68174bb](68174bbd6b))
2022-06-22 00:55:56 +00:00
oSumAtrIX
89bb43066b build: use dependencies as implementations instead of apis 2022-06-22 02:54:23 +02:00
oSumAtrIX
68174bbd6b feat: return a File instance instead of ExtFile 2022-06-22 02:53:37 +02:00
semantic-release-bot
d05c9416d6 chore(release): 1.3.4 [skip ci]
## [1.3.4](https://github.com/revanced/revanced-patcher/compare/v1.3.3...v1.3.4) (2022-06-21)

### Bug Fixes

* `String.toInstructions` defaulting `forStaticMethod` to `false` ([5a2f02b](5a2f02b97d)), closes [revanced/revanced-patches#46](https://github.com/revanced/revanced-patches/issues/46)
2022-06-21 21:53:33 +00:00
oSumAtrIX
5a2f02b97d fix: String.toInstructions defaulting forStaticMethod to false
Fixes revanced/revanced-patches#46
2022-06-21 23:52:09 +02:00
semantic-release-bot
a3005fa08e chore(release): 1.3.3 [skip ci]
## [1.3.3](https://github.com/revanced/revanced-patcher/compare/v1.3.2...v1.3.3) (2022-06-21)

### Bug Fixes

* add docs (trigger release) ([6628b78](6628b7870f))

### Reverts

* propagate dependencies ([365e1d7](365e1d7a45))
2022-06-21 19:04:06 +00:00
Lucaskyy
6628b7870f fix: add docs (trigger release) 2022-06-21 21:02:50 +02:00
Lucaskyy
a6411245aa Merge remote-tracking branch 'origin/main' into main 2022-06-21 20:50:11 +02:00
Lucaskyy
365e1d7a45 revert: propagate dependencies
guess it doesn't work when not propagating them
2022-06-21 20:50:00 +02:00
semantic-release-bot
4507cd2353 chore(release): 1.3.2 [skip ci]
## [1.3.2](https://github.com/revanced/revanced-patcher/compare/v1.3.1...v1.3.2) (2022-06-21)

### Bug Fixes

* return resourceFile to caller ([1f75777](1f75777cf9))
2022-06-21 18:45:16 +00:00
Lucaskyy
1f75777cf9 fix: return resourceFile to caller 2022-06-21 20:43:47 +02:00
Lucaskyy
28d5468b07 build: do not propagate all dependencies 2022-06-21 20:29:37 +02:00
semantic-release-bot
746496125d chore(release): 1.3.1 [skip ci]
## [1.3.1](https://github.com/revanced/revanced-patcher/compare/v1.3.0...v1.3.1) (2022-06-21)

### Bug Fixes

* `InlineSmaliCompiler.compile` using 0 registers instead of 1 by default ([835a421](835a421cc0))
2022-06-21 15:48:43 +00:00
oSumAtrIX
835a421cc0 fix: InlineSmaliCompiler.compile using 0 registers instead of 1 by default 2022-06-21 17:46:43 +02:00
semantic-release-bot
99342fe033 chore(release): 1.3.0 [skip ci]
# [1.3.0](https://github.com/revanced/revanced-patcher/compare/v1.2.9...v1.3.0) (2022-06-20)

### Features

* `parametersCount` for `InlineSmaliCompiler` instead of `parameters` ([ad6c5c8](ad6c5c8273))
* simplify adding instructions ([e47b67d](e47b67d7ec))
2022-06-20 19:22:22 +00:00
oSumAtrIX
e47b67d7ec feat: simplify adding instructions 2022-06-20 21:20:51 +02:00
oSumAtrIX
ad6c5c8273 feat: parametersCount for InlineSmaliCompiler instead of parameters 2022-06-20 20:10:11 +02:00
oSumAtrIX
fd690acd61 refactor: add internal attribute to signatures field 2022-06-20 20:10:06 +02:00
semantic-release-bot
e698b02bf6 chore(release): 1.2.9 [skip ci]
## [1.2.9](https://github.com/revanced/revanced-patcher/compare/v1.2.8...v1.2.9) (2022-06-20)

### Bug Fixes

* update apktool ([ab866bb](ab866bb8ef))
2022-06-20 15:08:57 +00:00
Lucaskyy
ab866bb8ef fix: update apktool 2022-06-20 17:07:04 +02:00
semantic-release-bot
714a98422d chore(release): 1.2.8 [skip ci]
## [1.2.8](https://github.com/revanced/revanced-patcher/compare/v1.2.7...v1.2.8) (2022-06-18)

### Bug Fixes

* update apktool ([051afd9](051afd98d0))
2022-06-18 21:51:07 +00:00
Sculas
051afd98d0 fix: update apktool 2022-06-18 23:49:41 +02:00
semantic-release-bot
d38cf6a229 chore(release): 1.2.7 [skip ci]
## [1.2.7](https://github.com/revanced/revanced-patcher/compare/v1.2.6...v1.2.7) (2022-06-18)

### Bug Fixes

* version not working with apktool due to cache ([03f5ee0](03f5ee088b))
2022-06-18 21:17:22 +00:00
Sculas
03f5ee088b fix: version not working with apktool due to cache 2022-06-18 23:15:33 +02:00
semantic-release-bot
5d0fd48b15 chore(release): 1.2.6 [skip ci]
## [1.2.6](https://github.com/revanced/revanced-patcher/compare/v1.2.5...v1.2.6) (2022-06-18)

### Bug Fixes

* remove javadoc jar (also trigger release) ([56f6ca3](56f6ca3891))
2022-06-18 20:54:29 +00:00
Sculas
56f6ca3891 fix: remove javadoc jar (also trigger release) 2022-06-18 22:52:49 +02:00
semantic-release-bot
9e0a74fcfb chore(release): 1.2.5 [skip ci]
## [1.2.5](https://github.com/revanced/revanced-patcher/compare/v1.2.4...v1.2.5) (2022-06-17)

### Bug Fixes

* goodbye security ([8f3ac77](8f3ac7702a))
2022-06-17 16:13:47 +00:00
Sculas
8f3ac7702a fix: goodbye security 2022-06-17 18:12:18 +02:00
semantic-release-bot
7b65f2d02c chore(release): 1.2.4 [skip ci]
## [1.2.4](https://github.com/revanced/revanced-patcher/compare/v1.2.3...v1.2.4) (2022-06-15)

### Reverts

* "fix: enforce aapt v1" ([dfd8a24](dfd8a24512))
2022-06-15 19:41:28 +00:00
Lucaskyy
2a1b2df56b Merge remote-tracking branch 'origin/main' into main 2022-06-15 21:39:42 +02:00
Lucaskyy
dfd8a24512 revert: "fix: enforce aapt v1"
This reverts commit cff87ff077.
2022-06-15 21:39:27 +02:00
semantic-release-bot
a3efd212fc chore(release): 1.2.3 [skip ci]
## [1.2.3](https://github.com/revanced/revanced-patcher/compare/v1.2.2...v1.2.3) (2022-06-14)

### Bug Fixes

* enforce aapt v1 ([cff87ff](cff87ff077))
2022-06-14 22:26:32 +00:00
Lucaskyy
3e610f7ba9 Merge remote-tracking branch 'origin/main' into main 2022-06-15 00:25:21 +02:00
Lucaskyy
cff87ff077 fix: enforce aapt v1 2022-06-15 00:25:06 +02:00
semantic-release-bot
54aa04ca34 chore(release): 1.2.2 [skip ci]
## [1.2.2](https://github.com/revanced/revanced-patcher/compare/v1.2.1...v1.2.2) (2022-06-14)

### Bug Fixes

* enforce aapt v2 ([b68b0bf](b68b0bf3d7))
2022-06-14 20:35:38 +00:00
Lucaskyy
0eda84eaef Merge remote-tracking branch 'origin/main' into main 2022-06-14 22:34:21 +02:00
Lucaskyy
b68b0bf3d7 fix: enforce aapt v2 2022-06-14 22:34:10 +02:00
semantic-release-bot
c692202f67 chore(release): 1.2.1 [skip ci]
## [1.2.1](https://github.com/revanced/revanced-patcher/compare/v1.2.0...v1.2.1) (2022-06-14)

### Bug Fixes

* Patcher setting BuildOptions too late ([6a5c873](6a5c8735fb))
2022-06-14 16:25:08 +00:00
Lucaskyy
8ce3535427 Merge remote-tracking branch 'origin/main' into main 2022-06-14 18:23:49 +02:00
Lucaskyy
6a5c8735fb fix: Patcher setting BuildOptions too late
This causes the Manager to crash, due to a stupid bug in Apktool which is prevented by setting a valid frameworkFolderLocation.
2022-06-14 18:23:40 +02:00
semantic-release-bot
8f32bc9c08 chore(release): 1.2.0 [skip ci]
# [1.2.0](https://github.com/revanced/revanced-patcher/compare/v1.1.0...v1.2.0) (2022-06-14)

### Features

* allow custom framework path to be specified ([d3a580e](d3a580ea19))
2022-06-14 15:50:24 +00:00
Lucaskyy
d3a580ea19 feat: allow custom framework path to be specified 2022-06-14 17:49:07 +02:00
oSumAtrIX
4c8eb0e5c7 refactor: gradle build script 2022-06-14 01:34:48 +02:00
semantic-release-bot
bc92eb7fd8 chore(release): 1.1.0 [skip ci]
# [1.1.0](https://github.com/revanced/revanced-patcher/compare/v1.0.0...v1.1.0) (2022-06-11)

### Bug Fixes

* resource patcher ([31815ca](31815ca9ea))
* update apktool to fork ([566ecef](566ecefa2b))

### Features

* allow custom aapt path to be specified ([8eb4a8f](8eb4a8f87a))
2022-06-11 23:25:19 +00:00
oSumAtrIX
cf89bd4171 Merge pull request #39 from revanced/non-root
fix: resource patcher
2022-06-12 01:24:04 +02:00
Lucaskyy
566ecefa2b fix: update apktool to fork 2022-06-11 20:39:29 +02:00
Lucaskyy
8eb4a8f87a feat: allow custom aapt path to be specified 2022-06-11 20:08:00 +02:00
oSumAtrIX
afcba5c212 refactor: simplify code by removing the with block 2022-06-11 19:45:11 +02:00
oSumAtrIX
2dcbd8d079 refactor: use include annotation parameter instead of excludeByDefault 2022-06-11 19:14:19 +02:00
oSumAtrIX
81895c7d5c Merge remote-tracking branch 'origin/non-root' into non-root
# Conflicts:
#	src/main/kotlin/app/revanced/patcher/Patcher.kt
2022-06-11 18:56:38 +02:00
Lucaskyy
22267883b1 refactor: get rid of all useless let blocks 2022-06-11 16:56:05 +02:00
oSumAtrIX
26fca60b53 refactor: use also instead of let where possible 2022-06-11 16:24:49 +02:00
oSumAtrIX
31815ca9ea fix: resource patcher 2022-06-11 06:36:13 +02:00
semantic-release-bot
1ce6098cad chore(release): 1.0.0 [skip ci]
# 1.0.0 (2022-06-05)

### Bug Fixes

* `compareSignatureToMethod` not matching correctly in case opcodes are null ([cca12aa](cca12aa34a))
* `ConcurrentModificationException` while iterating through `proxies` and modifying it ([6cb7cdb](6cb7cdb0b2))
* `JarPatchBundle` loading non-class files to class loader ([849616d](849616dc2b))
* `PackageMetadata` ([7399450](7399450139))
* `replaceWith` not replacing classes with used class proxies ([4178a1e](4178a1eedc))
* adding existing classes to the patchers cache ([9659a61](9659a61c5c))
* always return PatchResultSuccess on patch success ([996c4ac](996c4acb20))
* applying no patches throwing error ([5ca5a1c](5ca5a1c29e))
* applyPatches not returning successful patches ([f806cb3](f806cb38c5))
* avoid ignoring test resources (fixes [#1](https://github.com/revanced/revanced-patcher/issues/1)) ([d5a3c76](d5a3c76389))
* Classes not being written properly because of array shifting ([6e4db11](6e4db110c8))
* current must be calculated after increment ([5f12bab](5f12bab5df))
* failing tests temporarily ([fc05fe7](fc05fe79de))
* fix classes having multiple instances of fields ([7cc8a7d](7cc8a7dec3))
* fix classes having multiple method instances ([398239d](398239dc10))
* Fixed writer & signature resolver, improved tests & speed, minor refactoring ([e6c2501](e6c2501539))
* fuzzy resolver warning params were turned around ([e5bea06](e5bea06353))
* give ClassWriter a ClassReader for symtable ([41749ba](41749ba829))
* **gradle:** publish source and javadocs ([c236ebe](c236ebe078))
* incorrect pattern offset ([f3b5f67](f3b5f67b39))
* **Io:** fix finding classes by name ([b957501](b957501e70))
* **Io:** JAR loading and saving ([#8](https://github.com/revanced/revanced-patcher/issues/8)) ([310a7c4](310a7c446b))
* make `methodMetadata` nullable in `MethodSignatureMetadata` ([4e56652](4e56652429))
* make warnings nullable instead of lateinit ([8f1a629](8f1a629191))
* match to correct signature method parameters ([1ee2e4b](1ee2e4ba56))
* **MethodResolver:** fix cd57a8c9a0 ([cbd8df2](cbd8df2df0))
* **MethodResolver:** strip labels and line numbers so opcode patterns match ([699c730](699c730a7c))
* **MethodResolver:** strip labels nodes so opcode patterns match ([82c5306](82c530650f))
* MethodSignature#resolved throwing an exception ([c612676](c612676543))
* Move proxy package out of cache package ([ce21bd6](ce21bd60f3))
* null check causing an exception ([338bd9f](338bd9f739))
* nullable signature members ([#10](https://github.com/revanced/revanced-patcher/issues/10)) ([674461f](674461f08d))
* Patch should have access to the Cache ([4dd820f](4dd820ffdf))
* Patcher not writing resolved methods ([fac44a5](fac44a50c3))
* qualifying `Element` with wrong package ([024fa86](024fa867e1))
* reaching all constructors not possible ([c459beb](c459beb5f8))
* reformat (trigger release) ([bf48945](bf4894592b))
* remove broken code ([0e72a6e](0e72a6e85f))
* remove dependency to fork of Apktool ([11abc67](11abc67d9a))
* remove leftover debug code ([0f30eac](0f30eac32c))
* return mutable set of classes ([66a9b76](66a9b76845))
* returning failure on success ([48c4ea2](48c4ea2f6d))
* Search method map for existing class proxy ([a1e909b](a1e909b163))
* set index for insertAt to 0 by default ([d5b4c99](d5b4c99c00))
* set marklimit to Integer.MAX_VALUE ([e6e468f](e6e468fbb5))
* string signature in `SignatureResolver` ([e5ae970](e5ae970009))
* Suppress unused for addFiles ([3d6a1d3](3d6a1d38f3))
* throwing in case the opcode patterns do not match ([3144ec8](3144ec872a))
* use Array instead of Iterable for methodParameters ([dfac8f0](dfac8f03a3))
* using old instance of `Androlib` when saving ([a4d8be2](a4d8be20fc))
* workflow on dev branch ([428f7f4](428f7f4dec))
* write all classes ([f068fc8](f068fc87ff))

### Code Refactoring

* bump multidexlib2 to 2.5.2.r2 ([a6c6b49](a6c6b4979a))
* Change all references from Array to Iterable ([72f3cad](72f3cad3f9))
* convert Patch to abstract class ([cb9b1b9](cb9b1b9416))
* Optimize Signature class ([#11](https://github.com/revanced/revanced-patcher/issues/11)) ([7faa001](7faa001406))
* Rename `net.revanced` to `app.revanced` ([7087230](70872307e3))

### Features

* `Dependencies` annotation ([893d4c6](893d4c699b))
* `PatchLoader` ([ec9fd15](ec9fd15f9b))
* Add `findParentMethod` utility method ([#4](https://github.com/revanced/revanced-patcher/issues/4)) ([bbb2c54](bbb2c547aa))
* add `MethodWalker` ([7755bbc](7755bbc645))
* add `p` naming scheme to smali compiler ([79909cf](79909cf260))
* add extensions for cloning methods ([01bfbd6](01bfbd656e))
* add findClass method with className ([4087f49](4087f49863))
* Add first tests ([544bcf7](544bcf76bd))
* add fuzzy resolver ([7a56dca](7a56dca004))
* add immutableMethod ([c63b20f](c63b20fa65))
* add inline smali compiler ([bfe4e3e](bfe4e3e298))
* add missing test for fields ([6b8b057](6b8b0573d4))
* add or extension for AccessFlags ([00c85b5](00c85b5d75))
* Add patch metadata ([642e903](642e9031eb)), closes [ReVancedTeam/revanced-patches#1](https://github.com/ReVancedTeam/revanced-patches/issues/1)
* add SafeClassWriter ([6626014](6626014ef3))
* Add warnings for Fuzzy resolver ([715a2ad](715a2ad025))
* allow classes to be overwritten in addFiles and resolve signatures when applyPatches is called ([1db735b](1db735b1e2))
* Allow unknown opcodes using `null` ([0e5f4ba](0e5f4ba2d5))
* Finish first patcher test ([0d8d19e](0d8d19e708))
* Improve `SignatureResolver` ([139a23b](139a23b750))
* migrate to `DexPatchBundle` and `JarPatchBundle` ([8615798](8615798711))
* migrate to dexlib ([3651981](3651981161))
* Minor refactor and return proxy, if class has been proxied already ([4b26305](4b26305bd5))
* optional `forStaticMethod` parameter for `InlineSmaliCompiler.compileMethodInstructions` ([41e8860](41e88605c3))
* patch dependencies annotation and `PatcherOptions` ([6c65952](6c65952d80))
* properly manage `ClassProxy` & add `ProxyBackedClassList` ([6cb1fdf](6cb1fdf617))
* remaining mutable `EncodedValue` classes ([3f97cc8](3f97cc8e1f))
* string signature ([#22](https://github.com/revanced/revanced-patcher/issues/22)) ([612515a](612515acf8))
* use annotations instead of metadata objects ([d20f7fd](d20f7fd6e1))
* utility functions to get metadata of patch & sigs ([54511a4](54511a4fc6))

### Performance Improvements

* check type instead of class ([c7ef264](c7ef2644d8))
* decode manifest only when not using resource patcher ([4f60bea](4f60bea81e))
* depend on `androlib` instead of `ApkDecoder` ([cc9416d](cc9416dd11))
* do not resolve empty signatures list ([b1eebc9](b1eebc99a7))
* lazy-ify all mutable clones ([d18a3b6](d18a3b6a28))
* optimize indexOf call away ([9991f39](9991f39c9a))
* use Set instead of List since there are no dupes ([e65ebd2](e65ebd27c2))
* use String List and compare instead of any lambda ([5bd416b](5bd416b409))

### Reverts

* AccessFlag extensions not working with IDE ([0bfb92a](0bfb92a0cb))
* previous commits check for dupes in dexFile, not cache ([e810197](e810197e2a))

### BREAKING CHANGES

* arrayOf has to be changed to listOf.
* Method signature of Patcher#save() was changed to comply with the changes of multidexlib2.
* Removed usage of ASM library
* Array<Int> was changed to IntArray. This breaks existing patches.
* Package name was changed from "net.revanced" to "app.revanced"
* Method signature of execute() was changed to include the cache, this will break existing implementations of the Patch class.
* Patch class is now an abstract class. You must implement it. You can use anonymous implements, like done in the tests.
2022-06-05 06:10:56 +00:00
semantic-release-bot
46a6396114 chore(release): 1.0.0-dev.18 [skip ci]
# [1.0.0-dev.18](https://github.com/revanced/revanced-patcher/compare/v1.0.0-dev.17...v1.0.0-dev.18) (2022-06-04)

### Features

* `Dependencies` annotation ([83d608a](83d608ac06))
* optional `forStaticMethod` parameter for `InlineSmaliCompiler.compileMethodInstructions` ([28b9847](28b98478e4))
2022-06-05 08:03:41 +02:00
oSumAtrIX
41e88605c3 feat: optional forStaticMethod parameter for InlineSmaliCompiler.compileMethodInstructions 2022-06-05 08:03:40 +02:00
oSumAtrIX
893d4c699b feat: Dependencies annotation 2022-06-05 08:03:40 +02:00
semantic-release-bot
bf8655ead8 chore(release): 1.0.0-dev.17 [skip ci]
# [1.0.0-dev.17](https://github.com/revanced/revanced-patcher/compare/v1.0.0-dev.16...v1.0.0-dev.17) (2022-05-31)

### Features

* patch dependencies annotation and `PatcherOptions` ([8442991](8442991290))
2022-06-05 08:03:40 +02:00
oSumAtrIX
6c65952d80 feat: patch dependencies annotation and PatcherOptions 2022-06-05 08:03:39 +02:00
semantic-release-bot
26f3e7336b chore(release): 1.0.0-dev.16 [skip ci]
# [1.0.0-dev.16](https://github.com/revanced/revanced-patcher/compare/v1.0.0-dev.15...v1.0.0-dev.16) (2022-05-27)

### Bug Fixes

* `JarPatchBundle` loading non-class files to class loader ([3f0c740](3f0c740200))
* remove dependency to fork of Apktool ([0fa529f](0fa529fcdf))

### Features

* migrate to `DexPatchBundle` and `JarPatchBundle` ([7573db2](7573db2575))
2022-06-05 08:03:39 +02:00
oSumAtrIX
849616dc2b fix: JarPatchBundle loading non-class files to class loader 2022-06-05 08:03:38 +02:00
oSumAtrIX
e8a131fb08 chore: update gradlew wrapper 2022-06-05 08:03:38 +02:00
oSumAtrIX
11abc67d9a fix: remove dependency to fork of Apktool 2022-06-05 08:03:38 +02:00
oSumAtrIX
8615798711 feat: migrate to DexPatchBundle and JarPatchBundle
Signed-off-by: oSumAtrIX <johan.melkonyan1@web.de>
2022-06-05 08:03:37 +02:00
semantic-release-bot
070e02ea28 chore(release): 1.0.0-dev.15 [skip ci]
# [1.0.0-dev.15](https://github.com/revanced/revanced-patcher/compare/v1.0.0-dev.14...v1.0.0-dev.15) (2022-05-25)

### Features

* utility functions to get metadata of patch & sigs ([72f16b7](72f16b7785))
2022-06-05 08:03:37 +02:00
Lucaskyy
54511a4fc6 feat: utility functions to get metadata of patch & sigs 2022-06-05 08:03:37 +02:00
Lucaskyy
94f3c9116e chore: fix typo 2022-06-05 08:03:36 +02:00
semantic-release-bot
fe56c0cadb chore(release): 1.0.0-dev.14 [skip ci]
# [1.0.0-dev.14](https://github.com/revanced/revanced-patcher/compare/v1.0.0-dev.13...v1.0.0-dev.14) (2022-05-24)

### Bug Fixes

* reformat (trigger release) ([45a167e](45a167e785))
2022-06-05 08:03:36 +02:00
Lucaskyy
bf4894592b fix: reformat (trigger release) 2022-06-05 08:03:36 +02:00
Lucaskyy
5a96f2d99f refactor: use apktool fork
also fixed some compilation issues
2022-06-05 08:03:35 +02:00
semantic-release-bot
839a5ef22a chore(release): 1.0.0-dev.13 [skip ci]
# [1.0.0-dev.13](https://github.com/revanced/revanced-patcher/compare/v1.0.0-dev.12...v1.0.0-dev.13) (2022-05-24)

### Performance Improvements

* decode manifest only when not using resource patcher ([40b1fa4](40b1fa43e1))
2022-06-05 08:03:35 +02:00
oSumAtrIX
0ebdb100fd refactor: use resourceData.get(path) instead of a reader/writer
Signed-off-by: oSumAtrIX <johan.melkonyan1@web.de>
2022-06-05 08:03:35 +02:00
oSumAtrIX
4f60bea81e perf: decode manifest only when not using resource patcher
Signed-off-by: oSumAtrIX <johan.melkonyan1@web.de>
2022-06-05 08:03:34 +02:00
oSumAtrIX
1a49d9439f chore: update kotlin jvm
Signed-off-by: oSumAtrIX <johan.melkonyan1@web.de>
2022-06-05 08:03:34 +02:00
oSumAtrIX
5535eb4f01 refactor: improve ExampleResourcePatch
Signed-off-by: oSumAtrIX <johan.melkonyan1@web.de>
2022-06-05 08:03:33 +02:00
oSumAtrIX
5dc6aa9bfd chore: update dependencies
Signed-off-by: oSumAtrIX <johan.melkonyan1@web.de>
2022-06-05 08:03:33 +02:00
semantic-release-bot
6c0d28191b chore(release): 1.0.0-dev.12 [skip ci]
# [1.0.0-dev.12](https://github.com/revanced/revanced-patcher/compare/v1.0.0-dev.11...v1.0.0-dev.12) (2022-05-22)

### Bug Fixes

* using old instance of `Androlib` when saving ([5630e49](5630e49663))
2022-06-05 08:03:33 +02:00
semantic-release-bot
9d067b9b0d chore(release): 1.0.0-dev.11 [skip ci]
# [1.0.0-dev.11](https://github.com/revanced/revanced-patcher/compare/v1.0.0-dev.10...v1.0.0-dev.11) (2022-05-22)

### Features

* `PatchLoader` ([1a99eca](1a99ecaffe))
* use annotations instead of metadata objects ([6726884](6726884be5))
2022-06-05 08:03:32 +02:00
oSumAtrIX
a4d8be20fc fix: using old instance of Androlib when saving
Signed-off-by: oSumAtrIX <johan.melkonyan1@web.de>
2022-06-05 08:03:32 +02:00
oSumAtrIX
ec9fd15f9b feat: PatchLoader
Signed-off-by: oSumAtrIX <johan.melkonyan1@web.de>
2022-06-05 08:03:32 +02:00
oSumAtrIX
d20f7fd6e1 feat: use annotations instead of metadata objects
Signed-off-by: oSumAtrIX <johan.melkonyan1@web.de>
2022-06-05 08:03:31 +02:00
semantic-release-bot
ebbcf78e56 chore(release): 1.0.0-dev.10 [skip ci]
# [1.0.0-dev.10](https://github.com/revanced/revanced-patcher/compare/v1.0.0-dev.9...v1.0.0-dev.10) (2022-05-07)

### Bug Fixes

* qualifying `Element` with wrong package ([4d74de4](4d74de4061))
2022-06-05 08:03:31 +02:00
oSumAtrIX
024fa867e1 fix: qualifying Element with wrong package
Signed-off-by: oSumAtrIX <johan.melkonyan1@web.de>
2022-06-05 08:03:31 +02:00
semantic-release-bot
e506d8fd8c chore(release): 1.0.0-dev.9 [skip ci]
# [1.0.0-dev.9](https://github.com/revanced/revanced-patcher/compare/v1.0.0-dev.8...v1.0.0-dev.9) (2022-05-07)

### Bug Fixes

* `compareSignatureToMethod` not matching correctly in case opcodes are null ([5ae5e98](5ae5e98f1f))
* `ConcurrentModificationException` while iterating through `proxies` and modifying it ([bfeeaf4](bfeeaf4435))
* `PackageMetadata` ([305a817](305a81793a))
* `replaceWith` not replacing classes with used class proxies ([f0f3403](f0f34031dd))
* adding existing classes to the patchers cache ([4281546](4281546f69))
* always return PatchResultSuccess on patch success ([866b03a](866b03af21))
* applying no patches throwing error ([f88c118](f88c11820d))
* applyPatches not returning successful patches ([8b70bb4](8b70bb4290))
* Classes not being written properly because of array shifting ([1471956](147195647c))
* failing tests temporarily ([66b08f8](66b08f8b3a))
* fix classes having multiple instances of fields ([b711b80](b711b8001e))
* fix classes having multiple method instances ([12c10d8](12c10d8c64))
* Fixed writer & signature resolver, improved tests & speed, minor refactoring ([bb42fa3](bb42fa3c6f))
* fuzzy resolver warning params were turned around ([d49df10](d49df10a3c))
* incorrect pattern offset ([03700ff](03700ffa51))
* make `methodMetadata` nullable in `MethodSignatureMetadata` ([864e38c](864e38c069))
* make warnings nullable instead of lateinit ([04b49b8](04b49b8b66))
* match to correct signature method parameters ([c49071a](c49071aff7))
* MethodSignature#resolved throwing an exception ([82b1e66](82b1e66d54))
* Move proxy package out of cache package ([6bc4e7e](6bc4e7eab7))
* null check causing an exception ([560c485](560c485ab0))
* Patcher not writing resolved methods ([d15240d](d15240d033))
* reaching all constructors not possible ([37fa994](37fa9949ec))
* remove leftover debug code ([4458141](4458141d6d))
* return mutable set of classes ([84bc7e0](84bc7e0dc7))
* returning failure on success ([3b68d5c](3b68d5c65e))
* Search method map for existing class proxy ([d5e694c](d5e694c306))
* string signature in `SignatureResolver` ([ac36d19](ac36d19693))
* Suppress unused for addFiles ([a0d6d46](a0d6d46217))
* throwing in case the opcode patterns do not match ([f72dd68](f72dd68ec5))
* use Array instead of Iterable for methodParameters ([312235b](312235b194))
* write all classes ([6ad51aa](6ad51aad9a))

### Code Refactoring

* bump multidexlib2 to 2.5.2.r2 ([32e6458](32e645850d))
* Change all references from Array to Iterable ([264989f](264989f488))

### Features

* add `MethodWalker` ([659e108](659e1087c9))
* add `p` naming scheme to smali compiler ([38556d6](38556d61ab))
* add extensions for cloning methods ([df7503b](df7503b47b))
* add findClass method with className ([78235d1](78235d1abe))
* Add first tests ([6767c8f](6767c8fbc1))
* add fuzzy resolver ([a492808](a492808021))
* add immutableMethod ([eed1cfd](eed1cfda7b))
* add inline smali compiler ([dbafe2a](dbafe2ab37))
* add missing test for fields ([4022b8b](4022b8b847))
* add or extension for AccessFlags ([aec5eeb](aec5eeb597))
* Add patch metadata ([8544fc4](8544fc4cbc)), closes [ReVancedTeam/revanced-patches#1](https://github.com/ReVancedTeam/revanced-patches/issues/1)
* Add warnings for Fuzzy resolver ([643a14e](643a14e664))
* allow classes to be overwritten in addFiles and resolve signatures when applyPatches is called ([5f71a34](5f71a342ac))
* Allow unknown opcodes using `null` ([f4a47d4](f4a47d4dc8))
* Finish first patcher test ([a9e4e8a](a9e4e8ac32))
* Improve `SignatureResolver` ([88a6a27](88a6a27302))
* migrate to dexlib ([be51f42](be51f42710))
* Minor refactor and return proxy, if class has been proxied already ([2d3c611](2d3c61113d))
* properly manage `ClassProxy` & add `ProxyBackedClassList` ([2319787](23197879b2))
* remaining mutable `EncodedValue` classes ([7d38bb0](7d38bb0baa))
* string signature ([#22](https://github.com/revanced/revanced-patcher/issues/22)) ([c245edb](c245edb0c5))

### Performance Improvements

* depend on `androlib` instead of `ApkDecoder` ([e5c054a](e5c054ac2f))
* do not resolve empty signatures list ([1f7bf3a](1f7bf3ac6c))
* lazy-ify all mutable clones ([05e4400](05e44007d8))
* optimize indexOf call away ([f8e978a](f8e978af88))
* use Set instead of List since there are no dupes ([6221387](622138736d))
* use String List and compare instead of any lambda ([aed4fd9](aed4fd9a3c))

### Reverts

* AccessFlag extensions not working with IDE ([e161f7f](e161f7fea4))
* previous commits check for dupes in dexFile, not cache ([433914f](433914feda))

### BREAKING CHANGES

* arrayOf has to be changed to listOf.
* Method signature of Patcher#save() was changed to comply with the changes of multidexlib2.
* Removed usage of ASM library
2022-06-05 08:03:30 +02:00
oSumAtrIX
f5b5c52e55 chore: bump java-version for action setup-java
Signed-off-by: oSumAtrIX <johan.melkonyan1@web.de>
2022-06-05 08:03:30 +02:00
oSumAtrIX
fc05fe79de fix: failing tests temporarily
Signed-off-by: oSumAtrIX <johan.melkonyan1@web.de>
2022-06-05 08:03:29 +02:00
j4k0xb
79909cf260 feat: add p naming scheme to smali compiler 2022-06-05 08:03:29 +02:00
autergame
8f12873200 Replace ReVancedTeam with revanced in build.gradle.kts 2022-06-05 08:03:29 +02:00
oSumAtrIX
cc9416dd11 perf: depend on androlib instead of ApkDecoder
Signed-off-by: oSumAtrIX <johan.melkonyan1@web.de>
2022-06-05 08:03:28 +02:00
oSumAtrIX
99319e63da add: resource patcher
Signed-off-by: oSumAtrIX <johan.melkonyan1@web.de>
2022-06-05 08:03:28 +02:00
oSumAtrIX
c459beb5f8 fix: reaching all constructors not possible
Signed-off-by: oSumAtrIX <johan.melkonyan1@web.de>
2022-06-05 08:03:28 +02:00
oSumAtrIX
e5ae970009 fix: string signature in SignatureResolver
Signed-off-by: oSumAtrIX <johan.melkonyan1@web.de>
2022-06-05 08:03:27 +02:00
oSumAtrIX
612515acf8 feat: string signature (#22)
* feat: string signature

Signed-off-by: oSumAtrIX <johan.melkonyan1@web.de>

* fix: signature in test

Signed-off-by: oSumAtrIX <johan.melkonyan1@web.de>

* fix: make string signature optional

Signed-off-by: oSumAtrIX <johan.melkonyan1@web.de>

* fix: use of `compareOpcodes` when comparing string signatures

Signed-off-by: oSumAtrIX <johan.melkonyan1@web.de>

* add: `PackageMetadata` for signatures

Signed-off-by: oSumAtrIX <johan.melkonyan1@web.de>
2022-06-05 08:03:27 +02:00
oSumAtrIX
b1eebc99a7 perf: do not resolve empty signatures list
Signed-off-by: oSumAtrIX <johan.melkonyan1@web.de>
2022-06-05 08:03:27 +02:00
oSumAtrIX
6cb7cdb0b2 fix: ConcurrentModificationException while iterating through proxies and modifying it
Signed-off-by: oSumAtrIX <johan.melkonyan1@web.de>
2022-06-05 08:03:26 +02:00
oSumAtrIX
beff1df9b0 refactor: resolve signatures automatically
Signed-off-by: oSumAtrIX <johan.melkonyan1@web.de>
2022-06-05 08:03:26 +02:00
oSumAtrIX
f58a498849 add: applyProxies method
Signed-off-by: oSumAtrIX <johan.melkonyan1@web.de>
2022-06-05 08:03:26 +02:00
oSumAtrIX
6cb1fdf617 feat: properly manage ClassProxy & add ProxyBackedClassList
Signed-off-by: oSumAtrIX <johan.melkonyan1@web.de>
2022-06-05 08:03:25 +02:00
oSumAtrIX
7399450139 fix: PackageMetadata
Signed-off-by: oSumAtrIX <johan.melkonyan1@web.de>
2022-06-05 08:03:25 +02:00
oSumAtrIX
193eae298a add: PackageMetadata for signatures
Signed-off-by: oSumAtrIX <johan.melkonyan1@web.de>
2022-06-05 08:03:25 +02:00
oSumAtrIX
4e56652429 fix: make methodMetadata nullable in MethodSignatureMetadata
Signed-off-by: oSumAtrIX <johan.melkonyan1@web.de>
2022-06-05 08:03:24 +02:00
oSumAtrIX
7755bbc645 feat: add MethodWalker
Signed-off-by: oSumAtrIX <johan.melkonyan1@web.de>
2022-06-05 08:03:24 +02:00
Lucaskyy
f3b5f67b39 fix: incorrect pattern offset 2022-06-05 08:03:24 +02:00
Lucaskyy
7f18bbf66e docs: fix improper docs for fuzzy resolver Warning 2022-06-05 08:03:23 +02:00
oSumAtrIX
c8b68e36e0 refactor: better naming for resolver warning parameters
Signed-off-by: oSumAtrIX <johan.melkonyan1@web.de>
2022-06-05 08:03:23 +02:00
oSumAtrIX
5ca5a1c29e fix: applying no patches throwing error
Signed-off-by: oSumAtrIX <johan.melkonyan1@web.de>
2022-06-05 08:03:23 +02:00
oSumAtrIX
d677d9e800 refact: better parameter names for Warning
Signed-off-by: oSumAtrIX <johan.melkonyan1@web.de>
2022-06-05 08:03:22 +02:00
Lucaskyy
e5bea06353 fix: fuzzy resolver warning params were turned around 2022-06-05 08:03:22 +02:00
Lucaskyy
8f1a629191 fix: make warnings nullable instead of lateinit 2022-06-05 08:03:22 +02:00
Lucaskyy
e6086511e5 refactor: remove all parameter names 2022-06-05 08:03:21 +02:00
Lucaskyy
c612676543 fix: MethodSignature#resolved throwing an exception 2022-06-05 08:03:21 +02:00
Lucaskyy
bca948658e test: Add tests for unknown opcodes 2022-06-05 08:03:20 +02:00
Lucaskyy
0e5f4ba2d5 feat: Allow unknown opcodes using null
This is the same as `??` in IDA signatures.
2022-06-05 08:03:20 +02:00
Lucaskyy
6ca05769ef chore: remove todo 2022-06-05 08:03:20 +02:00
Lucaskyy
c21e5affba refactor: remove all @Suppression's 2022-06-05 08:03:19 +02:00
Lucaskyy
1c5a04caf9 refactor: format code 2022-06-05 08:03:19 +02:00
Lucaskyy
3d6a1d38f3 fix: Suppress unused for addFiles 2022-06-05 08:03:19 +02:00
Lucaskyy
715a2ad025 feat: Add warnings for Fuzzy resolver 2022-06-05 08:03:18 +02:00
Lucaskyy
9889ec9d03 docs: fix wrong wording 2022-06-05 08:03:18 +02:00
Lucaskyy
01bfbd656e feat: add extensions for cloning methods 2022-06-05 08:03:17 +02:00
Lucaskyy
6c9797583d test: fix outdated test 2022-06-05 08:03:17 +02:00
Lucaskyy
3cf07f5ce2 refactor: replace asInstructions with toInstruction to follow proper naming scheme 2022-06-05 08:03:17 +02:00
Lucaskyy
0bfb92a0cb revert: AccessFlag extensions not working with IDE 2022-06-05 08:03:16 +02:00
Lucaskyy
042638a399 refactor: replace Array with Iterable 2022-06-05 08:03:16 +02:00
oSumAtrIX
4178a1eedc fix: replaceWith not replacing classes with used class proxies
Signed-off-by: oSumAtrIX <johan.melkonyan1@web.de>
2022-06-05 08:03:15 +02:00
oSumAtrIX
338bd9f739 fix: null check causing an exception
Signed-off-by: oSumAtrIX <johan.melkonyan1@web.de>
2022-06-05 08:03:15 +02:00
oSumAtrIX
c55c62a57e add: throw on getting result of MethodSignature if null
Signed-off-by: oSumAtrIX <johan.melkonyan1@web.de>
2022-06-05 08:03:15 +02:00
oSumAtrIX
1f08da8b2a refact: include each signature in its corresponding patch
Signed-off-by: oSumAtrIX <johan.melkonyan1@web.de>
2022-06-05 08:03:14 +02:00
Lucaskyy
b2dab3fabf refactor: rename method to resolverMethod 2022-06-05 08:03:14 +02:00
Lucaskyy
0f30eac32c fix: remove leftover debug code 2022-06-05 08:03:14 +02:00
Lucaskyy
642e9031eb feat: Add patch metadata
Fixes ReVancedTeam/revanced-patches#1
2022-06-05 08:03:13 +02:00
Lucaskyy
7a56dca004 feat: add fuzzy resolver
fixed docs for MethodSignature & added tests for fuzzy resolver
2022-06-05 08:03:13 +02:00
Lucaskyy
18853f70a4 refactor: migrate signature schema changes to Patcher
also updated Extensions, for good measure.
2022-06-05 08:03:13 +02:00
oSumAtrIX
6b8b0573d4 feat: add missing test for fields
Signed-off-by: oSumAtrIX <johan.melkonyan1@web.de>
2022-06-05 08:03:12 +02:00
oSumAtrIX
3889d72927 style: reformat code
Signed-off-by: oSumAtrIX <johan.melkonyan1@web.de>
2022-06-05 08:03:12 +02:00
oSumAtrIX
3f97cc8e1f feat: remaining mutable EncodedValue classes 2022-06-05 08:03:11 +02:00
Lucaskyy
1db735b1e2 feat: allow classes to be overwritten in addFiles and resolve signatures when applyPatches is called 2022-06-05 08:03:11 +02:00
Lucaskyy
996c4acb20 fix: always return PatchResultSuccess on patch success 2022-06-05 08:03:11 +02:00
Lucaskyy
5b28523eea add: optional callback for CLI 2022-06-05 08:03:10 +02:00
Lucaskyy
72f3cad3f9 refactor: Change all references from Array to Iterable
BREAKING CHANGE: arrayOf has to be changed to listOf.
2022-06-05 08:03:10 +02:00
oSumAtrIX
9659a61c5c fix: adding existing classes to the patchers cache 2022-06-05 08:03:10 +02:00
Lucaskyy
b892729332 chore: update kotlin, don't shade deps, publish to maven local, make deps api instead of implementation 2022-06-05 08:03:09 +02:00
Lucaskyy
6e4db110c8 fix: Classes not being written properly because of array shifting
We now use a MutableList to replace it at the proper index, and use a ListBackedSet, so we don't copy List's to Set's for no reason.
This was a very bad issue. The array was shifted every time we removed the original class, the fact we even got a "working" dex file surprises me. Thankfully, this issue is now solved, and we lived happily after.
2022-06-05 08:03:09 +02:00
Lucaskyy
e810197e2a revert: previous commits check for dupes in dexFile, not cache
This reverts commit aed4fd9a3c.
This reverts commit 622138736d.
2022-06-05 08:03:08 +02:00
Lucaskyy
e65ebd27c2 perf: use Set instead of List since there are no dupes 2022-06-05 08:03:08 +02:00
Lucaskyy
5bd416b409 perf: use String List and compare instead of any lambda 2022-06-05 08:03:08 +02:00
Lucaskyy
a6c6b4979a refactor: bump multidexlib2 to 2.5.2.r2
BREAKING CHANGE: Method signature of Patcher#save() was changed to comply with the changes of multidexlib2.
2022-06-05 08:03:07 +02:00
Lucaskyy
db10ab03be ci: Fix Unauthorized error 2022-06-05 08:03:07 +02:00
Lucaskyy
94dbb573cf refactor: bump multidexlib2, dexlib2 and smali 2022-06-05 08:03:07 +02:00
oSumAtrIX
08253ee010 add: addFiles method to merge additional dex containers 2022-06-05 08:03:06 +02:00
oSumAtrIX
3144ec872a fix: throwing in case the opcode patterns do not match 2022-06-05 08:03:06 +02:00
Lucaskyy
48c4ea2f6d fix: returning failure on success
oh wow, that's an oopsie
2022-06-05 08:03:06 +02:00
Lucaskyy
c63b20fa65 feat: add immutableMethod
added docs
2022-06-05 08:03:05 +02:00
Lucaskyy
f806cb38c5 fix: applyPatches not returning successful patches 2022-06-05 08:03:05 +02:00
Lucaskyy
6c3e2d79ea chore: format code 2022-06-05 08:03:05 +02:00
oSumAtrIX
cca12aa34a fix: compareSignatureToMethod not matching correctly in case opcodes are null 2022-06-05 08:03:04 +02:00
Lucaskyy
c267b12a7d refactor: make method a property 2022-06-05 08:03:04 +02:00
Lucaskyy
eef448cc39 refactor: cleanup SignatureResolver.kt 2022-06-05 08:03:04 +02:00
Lucaskyy
45303f66ec test: fix test with previous changes 2022-06-05 08:03:03 +02:00
Lucaskyy
783fbf43f2 refactor: rename resolveAndGetMethod to method 2022-06-05 08:03:03 +02:00
Lucaskyy
59189058ac refactor: cleanup Patcher.kt 2022-06-05 08:03:03 +02:00
Lucaskyy
dfac8f03a3 fix: use Array instead of Iterable for methodParameters 2022-06-05 08:03:02 +02:00
Lucaskyy
b44bf4c267 chore: move replace extension method to Extensions.kt 2022-06-05 08:03:02 +02:00
Lucaskyy
066ad274ed docs: fixup 2022-06-05 08:03:02 +02:00
Lucaskyy
a8653fe6a0 chore: publish jar with dependencies 2022-06-05 08:03:01 +02:00
oSumAtrIX
139a23b750 feat: Improve SignatureResolver 2022-06-05 08:03:01 +02:00
oSumAtrIX
0d8d19e708 feat: Finish first patcher test 2022-06-05 08:03:00 +02:00
oSumAtrIX
a1e909b163 fix: Search method map for existing class proxy 2022-06-05 08:03:00 +02:00
oSumAtrIX
e4157332d3 add: MutableMethodImplementation.addInstructions extension 2022-06-05 08:03:00 +02:00
oSumAtrIX
923efc4caf add: TODO for mutable encoded value clones 2022-06-05 08:02:59 +02:00
oSumAtrIX
bea0cbc550 refactor: lazy initialize implementation field for mutable methods 2022-06-05 08:02:59 +02:00
oSumAtrIX
1ee2e4ba56 fix: match to correct signature method parameters 2022-06-05 08:02:59 +02:00
oSumAtrIX
fac44a50c3 fix: Patcher not writing resolved methods 2022-06-05 08:02:58 +02:00
oSumAtrIX
544bcf76bd feat: Add first tests 2022-06-05 08:02:58 +02:00
oSumAtrIX
a16c8cabf2 refactor: Improve SignatureResolver 2022-06-05 08:02:58 +02:00
oSumAtrIX
2777117da2 refactor: Use String instead of CharSequence for method parameter signature 2022-06-05 08:02:57 +02:00
oSumAtrIX
66a9b76845 fix: return mutable set of classes 2022-06-05 08:02:57 +02:00
oSumAtrIX
f068fc87ff fix: write all classes 2022-06-05 08:02:57 +02:00
oSumAtrIX
7cc8a7dec3 fix: fix classes having multiple instances of fields 2022-06-05 08:02:56 +02:00
oSumAtrIX
398239dc10 fix: fix classes having multiple method instances 2022-06-05 08:02:56 +02:00
Lucaskyy
d18a3b6a28 perf: lazy-ify all mutable clones 2022-06-05 08:02:56 +02:00
Lucaskyy
bfe4e3e298 feat: add inline smali compiler 2022-06-05 08:02:55 +02:00
Lucaskyy
a1b6b06bd3 test: use findClass with className & cleanup 2022-06-05 08:02:55 +02:00
Lucaskyy
4087f49863 feat: add findClass method with className 2022-06-05 08:02:54 +02:00
Lucaskyy
00c85b5d75 feat: add or extension for AccessFlags 2022-06-05 08:02:54 +02:00
Lucaskyy
cb78c5a86f style: reformat code 2022-06-05 08:02:54 +02:00
Lucaskyy
9991f39c9a perf: optimize indexOf call away 2022-06-05 08:02:53 +02:00
oSumAtrIX
650bf71124 docs: Document important parts of the code 2022-06-05 08:02:53 +02:00
oSumAtrIX
1dd3394ea3 refactor: Replacing original classes with mutated ones 2022-06-05 08:02:53 +02:00
oSumAtrIX
e6c2501539 fix: Fixed writer & signature resolver, improved tests & speed, minor refactoring 2022-06-05 08:02:52 +02:00
oSumAtrIX
4b26305bd5 feat: Minor refactor and return proxy, if class has been proxied already 2022-06-05 08:02:52 +02:00
oSumAtrIX
ce21bd60f3 fix: Move proxy package out of cache package 2022-06-05 08:02:51 +02:00
oSumAtrIX
3651981161 feat: migrate to dexlib
BREAKING CHANGE: Removed usage of ASM library
2022-06-05 08:02:51 +02:00
semantic-release-bot
6299b9e951 chore(release): 1.0.0-dev.8 [skip ci]
# [1.0.0-dev.8](https://github.com/ReVancedTeam/revanced-patcher/compare/v1.0.0-dev.7...v1.0.0-dev.8) (2022-03-24)

### Performance Improvements

* check type instead of class ([47eb493](47eb493f54))
2022-06-05 08:02:51 +02:00
semantic-release-bot
24b544708f chore(release): 1.0.0-dev.7 [skip ci]
# [1.0.0-dev.7](https://github.com/ReVancedTeam/revanced-patcher/compare/v1.0.0-dev.6...v1.0.0-dev.7) (2022-03-24)

### Bug Fixes

* **MethodResolver:** fix cd57a8c9a0 ([1af31b2](1af31b2aa3))
2022-06-05 08:02:50 +02:00
Lucaskyy
c7ef2644d8 perf: check type instead of class
this is way better, thank you oSumAtrIX!
2022-06-05 08:02:50 +02:00
Lucaskyy
fa6e454ae9 test: fix assert message 2022-06-05 08:02:50 +02:00
Lucaskyy
cbd8df2df0 fix(MethodResolver): fix cd57a8c9a0 2022-06-05 08:02:49 +02:00
semantic-release-bot
f3d8b917de chore(release): 1.0.0-dev.6 [skip ci]
# [1.0.0-dev.6](https://github.com/ReVancedTeam/revanced-patcher/compare/v1.0.0-dev.5...v1.0.0-dev.6) (2022-03-24)

### Bug Fixes

* **MethodResolver:** strip labels nodes so opcode patterns match ([cd57a8c](cd57a8c9a0))
2022-06-05 08:02:49 +02:00
Lucaskyy
82c530650f fix(MethodResolver): strip labels nodes so opcode patterns match
this commit is also a fix for 8d1bb5f3d9 because it corrupted the stack by completely removing the nodes
2022-06-05 08:02:49 +02:00
semantic-release-bot
81d0cf20f3 chore(release): 1.0.0-dev.5 [skip ci]
# [1.0.0-dev.5](https://github.com/ReVancedTeam/revanced-patcher/compare/v1.0.0-dev.4...v1.0.0-dev.5) (2022-03-24)

### Bug Fixes

* **MethodResolver:** strip labels and line numbers so opcode patterns match ([8d1bb5f](8d1bb5f3d9))
2022-06-05 08:02:48 +02:00
Lucaskyy
36d4f71325 refactor: log as trace instead of debug
so there's less spam in console
2022-06-05 08:02:48 +02:00
Lucaskyy
699c730a7c fix(MethodResolver): strip labels and line numbers so opcode patterns match 2022-06-05 08:02:48 +02:00
Lucaskyy
b197956e39 refactor: only compute maxs and use existing stack frames 2022-06-05 08:02:47 +02:00
semantic-release-bot
be992a3e6f chore(release): 1.0.0-dev.4 [skip ci]
# [1.0.0-dev.4](https://github.com/ReVancedTeam/revanced-patcher/compare/v1.0.0-dev.3...v1.0.0-dev.4) (2022-03-23)

### Bug Fixes

* give ClassWriter a ClassReader for symtable ([e8f6973](e8f6973938))
2022-06-05 08:02:47 +02:00
semantic-release-bot
e0437397df chore(release): 1.0.0-dev.3 [skip ci]
# [1.0.0-dev.3](https://github.com/ReVancedTeam/revanced-patcher/compare/v1.0.0-dev.2...v1.0.0-dev.3) (2022-03-23)

### Features

* add SafeClassWriter ([ca6b94d](ca6b94d943))
2022-06-05 08:02:47 +02:00
Lucaskyy
41749ba829 fix: give ClassWriter a ClassReader for symtable
removed SafeClassWriter as it was unused
2022-06-05 08:02:46 +02:00
semantic-release-bot
8161ce4fa6 chore(release): 1.0.0-dev.2 [skip ci]
# [1.0.0-dev.2](https://github.com/ReVancedTeam/revanced-patcher/compare/v1.0.0-dev.1...v1.0.0-dev.2) (2022-03-23)

### Bug Fixes

* set marklimit to Integer.MAX_VALUE ([ab6453c](ab6453ca8a))
2022-06-05 08:02:46 +02:00
Lucaskyy
6626014ef3 feat: add SafeClassWriter
the standard ClassWriter implementation uses the ClassLoader to find a common superclass. this won't work for us since we are not loading the JAR into the classpath. using this SafeClassWriter should fix that issue.
2022-06-05 08:02:46 +02:00
Lucaskyy
e6e468fbb5 fix: set marklimit to Integer.MAX_VALUE 2022-06-05 08:02:45 +02:00
semantic-release-bot
2fabbdf71b chore(release): 1.0.0-dev.1 [skip ci]
# 1.0.0-dev.1 (2022-03-23)

### Bug Fixes

* avoid ignoring test resources (fixes [#1](https://github.com/ReVancedTeam/revanced-patcher/issues/1)) ([d5a3c76](d5a3c76389))
* current must be calculated after increment ([5f12bab](5f12bab5df))
* **gradle:** publish source and javadocs ([87bbde5](87bbde5e06))
* **Io:** fix finding classes by name ([460d62a](460d62a24c))
* **Io:** JAR loading and saving ([#8](https://github.com/ReVancedTeam/revanced-patcher/issues/8)) ([4d98cbc](4d98cbc9e8))
* nullable signature members ([#10](https://github.com/ReVancedTeam/revanced-patcher/issues/10)) ([8db8893](8db8893ab1))
* Patch should have access to the Cache ([6c0f082](6c0f0823c9))
* remove broken code ([0e72a6e](0e72a6e85f))
* set index for insertAt to 0 by default ([1769132](1769132a9e))
* workflow on dev branch ([7e67daf](7e67daf878))

### Code Refactoring

* convert Patch to abstract class ([23e897a](23e897a7a9))
* Optimize Signature class ([#11](https://github.com/ReVancedTeam/revanced-patcher/issues/11)) ([49beec9](49beec9fc6))
* Rename `net.revanced` to `app.revanced` ([3ab42a9](3ab42a932c))

### Features

* Add `findParentMethod` utility method ([#4](https://github.com/ReVancedTeam/revanced-patcher/issues/4)) ([00c6ab7](00c6ab7faf))

### BREAKING CHANGES

* Array<Int> was changed to IntArray. This breaks existing patches.
* Package name was changed from "net.revanced" to "app.revanced"
* Method signature of execute() was changed to include the cache, this will break existing implementations of the Patch class.
* Patch class is now an abstract class. You must implement it. You can use anonymous implements, like done in the tests.
2022-06-05 08:02:45 +02:00
Lucaskyy
7faa001406 refactor: Optimize Signature class (#11)
BREAKING CHANGE: Array<Int> was changed to IntArray. This breaks existing patches.
2022-06-05 08:02:44 +02:00
Lucaskyy
70872307e3 refactor: Rename net.revanced to app.revanced
BREAKING CHANGE: Package name was changed from "net.revanced" to "app.revanced"
2022-06-05 08:02:44 +02:00
oSumAtrIX
310a7c446b fix(Io): JAR loading and saving (#8)
* refactor: Complete rewrite of `Io`

* style: format code

* style: rewrite todos

* fix: use lateinit instead of nonnull assert for zipEntry

* fix: use lateinit instead of nonnull assert for jarEntry & reuse zipEntry

* docs: add docs to `Patcher`

* test: match output of patcher

* chore: add todo to `Io` for removing non-class files

Co-authored-by: Sculas <contact@sculas.xyz>
2022-06-05 08:02:43 +02:00
Lucaskyy
c236ebe078 fix(gradle): publish source and javadocs 2022-06-05 08:02:43 +02:00
oSumAtrIX
674461f08d fix: nullable signature members (#10)
This commit will allow "partial" signatures, basically we will be allowed to exclude members to match for the signature
2022-06-05 08:02:43 +02:00
oSumAtrIX
bbb2c547aa feat: Add findParentMethod utility method (#4)
* feat: Add `findParentMethod` utitly method

* refactor: add `resolveMethod` to `MethodResolver`

added some assertions and some tests

Co-authored-by: Lucaskyy <contact@sculas.xyz>
2022-06-05 08:02:42 +02:00
Bleuzen
b957501e70 fix(Io): fix finding classes by name 2022-06-05 08:02:42 +02:00
Lucaskyy
b6ca31a970 chore: push IntelliJ project files 2022-06-05 08:02:42 +02:00
Lucaskyy
cbcf93f7d6 refactor: target java 8 instead of java 17 2022-06-05 08:02:41 +02:00
Lucaskyy
d5b4c99c00 fix: set index for insertAt to 0 by default 2022-06-05 08:02:41 +02:00
Lucaskyy
4dd820ffdf fix: Patch should have access to the Cache
BREAKING CHANGE: Method signature of execute() was changed to include the cache, this will break existing implementations of the Patch class.
2022-06-05 08:02:41 +02:00
Lucaskyy
cb9b1b9416 refactor: convert Patch to abstract class
BREAKING CHANGE: Patch class is now an abstract class. You must implement it. You can use anonymous implements, like done in the tests.
2022-06-05 08:02:40 +02:00
Lucaskyy
428f7f4dec fix: workflow on dev branch 2022-06-05 08:02:40 +02:00
Lucaskyy
77536cce8f style: remove tab 2022-06-05 08:02:39 +02:00
she11sh0cked
7b6a61b674 ci: add gradle-semantic-release-plugin and remove the github release assets 2022-06-05 08:02:39 +02:00
she11sh0cked
7f5f3b217d ci: add semantic-release 2022-06-05 08:02:39 +02:00
98 changed files with 4609 additions and 672 deletions

60
.github/ISSUE_TEMPLATE/bug-issue.yml vendored Normal file
View File

@@ -0,0 +1,60 @@
name: 🐞 Bug report
description: Report a very clearly broken issue.
title: 'bug: <title>'
labels: [bug]
body:
- type: markdown
attributes:
value: |
# ReVanced bug report
Important to note that your issue may have already been reported before. Please check for existing issues [here](https://github.com/revanced/revanced-patcher/labels/bug).
- type: dropdown
attributes:
label: Type
options:
- Crash
- Cosmetic
- Other
validations:
required: true
- type: textarea
attributes:
label: Bug description
description: How did you find the bug? Any additional details that might help?
validations:
required: true
- type: textarea
attributes:
label: Steps to reproduce
description: Add the steps to reproduce this bug including your environment.
placeholder: Step 1. Download some files. Step 2. ...
validations:
required: true
- type: textarea
attributes:
label: Relevant log output
description: Please copy and paste any relevant log output. This will be automatically formatted into code, so no need for backticks.
render: shell
validations:
required: true
- type: textarea
attributes:
label: Screenshots or videos
description: Add screenshots or videos that show the bug here.
placeholder: Drag and drop the screenshots/videos into this box.
validations:
required: false
- type: textarea
attributes:
label: Solution
description: If applicable, add a possible solution.
validations:
required: false
- type: textarea
attributes:
label: Additional context
description: Add additional context here.
validations:
required: false

8
.github/ISSUE_TEMPLATE/config.yml vendored Normal file
View File

@@ -0,0 +1,8 @@
blank_issues_enabled: false
contact_links:
- name: 📃 Documentation
url: https://github.com/revanced/revanced-documentation/
about: Don't know how or where to start? Check out our documentation!
- name: 🗨 Discussions
url: https://github.com/revanced/revanced-suggestions/discussions
about: Got something you think should change or be added? Search for or start a new discussion!

View File

@@ -0,0 +1,46 @@
name: ⭐ Feature request
description: Create a detailed feature request.
title: 'feat: <title>'
labels: [feature-request]
body:
- type: markdown
attributes:
value: |
# ReVanced feature request
Do not submit requests for patches here. Please submit them [here](https://github.com/orgs/revanced/discussions/categories/patches) instead.
Important to note that your feature request may have already been made before. Please check for existing feature requests [here](https://github.com/revanced/revanced-patcher/labels/feature-request).
- type: dropdown
attributes:
label: Type
options:
- Functionality
- Cosmetic
- Other
validations:
required: true
- type: textarea
attributes:
label: Issue
description: What is the current problem. Why does it require a feature request?
validations:
required: true
- type: textarea
attributes:
label: Feature
description: Describe your feature in detail. How does it solve the issue?
validations:
required: true
- type: textarea
attributes:
label: Motivation
description: Why should your feature should be considered?
validations:
required: true
- type: textarea
attributes:
label: Additional context
description: Add additional context here.
validations:
required: false

40
.github/workflows/release.yml vendored Normal file
View File

@@ -0,0 +1,40 @@
name: Release
on:
workflow_dispatch:
push:
branches:
- main
- dev
pull_request:
branches:
- main
- dev
jobs:
release:
name: Release
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Setup JDK
uses: actions/setup-java@v2
with:
java-version: '17'
distribution: 'adopt'
cache: gradle
- name: Setup Node.js
uses: actions/setup-node@v2
with:
node-version: "lts/*"
- name: Build with Gradle
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: ./gradlew build
- name: Setup semantic-release
run: npm install -g semantic-release @semantic-release/git @semantic-release/changelog gradle-semantic-release-plugin -D
- name: Release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: npx semantic-release

1
.idea/.gitignore generated vendored
View File

@@ -6,3 +6,4 @@
# Datasource local storage ignored files
/dataSources/
/dataSources.local.xml
/kotlinc.xml

15
.idea/git_toolbox_prj.xml generated Normal file
View File

@@ -0,0 +1,15 @@
<?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>

View File

@@ -0,0 +1,6 @@
<component name="InspectionProjectProfileManager">
<profile version="1.0">
<option name="myName" value="Project Default" />
<inspection_tool class="UnusedSymbol" enabled="false" level="WARNING" enabled_by_default="false" />
</profile>
</component>

6
.idea/vcs.xml generated
View File

@@ -1,5 +1,11 @@
<?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>

29
.releaserc Normal file
View File

@@ -0,0 +1,29 @@
{
"branches": [
"main",
{
"name": "dev",
"prerelease": true
}
],
"plugins": [
["@semantic-release/commit-analyzer", {
"releaseRules": [
{"type": "build", "release": "patch"}
]
}],
"@semantic-release/release-notes-generator",
"@semantic-release/changelog",
"gradle-semantic-release-plugin",
[
"@semantic-release/git",
{
"assets": [
"CHANGELOG.md",
"gradle.properties"
]
}
],
"@semantic-release/github"
]
}

912
CHANGELOG.md Normal file

File diff suppressed because it is too large Load Diff

View File

@@ -1 +1,2 @@
# Patcher
Patcher framework used in the ReVanced project.

View File

@@ -1,42 +1,61 @@
plugins {
kotlin("jvm") version "1.6.10"
kotlin("jvm") version "1.7.0"
java
`maven-publish`
}
group = "net.revanced"
group = "app.revanced"
val githubUsername: String = project.findProperty("gpr.user") as? String ?: System.getenv("GITHUB_ACTOR")
val githubPassword: String = project.findProperty("gpr.key") as? String ?: System.getenv("GITHUB_TOKEN")
repositories {
mavenCentral()
maven {
url = uri("https://maven.pkg.github.com/revanced/multidexlib2")
credentials {
username = githubUsername
password = githubPassword
}
}
}
dependencies {
implementation(kotlin("stdlib"))
implementation("org.ow2.asm:asm:9.2")
implementation("org.ow2.asm:asm-util:9.2")
implementation("org.ow2.asm:asm-tree:9.2")
implementation("org.ow2.asm:asm-commons:9.2")
implementation("io.github.microutils:kotlin-logging:2.1.21")
testImplementation("ch.qos.logback:logback-classic:1.2.11") // use your own logger!
implementation("xpp3:xpp3:1.1.4c")
implementation("org.smali:smali:2.5.2")
implementation("app.revanced:multidexlib2:2.5.2.r2")
implementation("org.apktool:apktool-lib:2.7.0-SNAPSHOT")
implementation(kotlin("reflect"))
testImplementation(kotlin("test"))
}
tasks.test {
useJUnitPlatform()
testLogging {
events("PASSED", "SKIPPED", "FAILED")
tasks {
test {
useJUnitPlatform()
testLogging {
events("PASSED", "SKIPPED", "FAILED")
}
}
}
java {
withSourcesJar()
}
publishing {
repositories {
maven {
name = "GitHubPackages"
url = uri("https://maven.pkg.github.com/ReVancedTeam/revanced-patcher")
credentials {
username = System.getenv("GITHUB_ACTOR")
password = System.getenv("GITHUB_TOKEN")
if (System.getenv("GITHUB_ACTOR") != null)
maven {
name = "GitHubPackages"
url = uri("https://maven.pkg.github.com/revanced/revanced-patcher")
credentials {
username = System.getenv("GITHUB_ACTOR")
password = System.getenv("GITHUB_TOKEN")
}
}
}
else
mavenLocal()
}
publications {
register<MavenPublication>("gpr") {

View File

@@ -1,2 +1,2 @@
kotlin.code.style=official
version=1.0.0
kotlin.code.style = official
version = 4.1.5

View File

@@ -1,5 +1,5 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-7.2-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-7.4.2-all.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists

269
gradlew vendored Normal file → Executable file

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,19 @@
package app.revanced.patcher
import app.revanced.patcher.data.Data
import app.revanced.patcher.data.PackageMetadata
import app.revanced.patcher.data.impl.BytecodeData
import app.revanced.patcher.data.impl.ResourceData
import app.revanced.patcher.patch.Patch
import org.jf.dexlib2.iface.ClassDef
import java.io.File
data class PatcherData(
internal val internalClasses: MutableList<ClassDef>,
internal val resourceCacheDirectory: String,
val packageMetadata: PackageMetadata
) {
internal val patches = mutableListOf<Class<out Patch<Data>>>()
internal val bytecodeData = BytecodeData(internalClasses)
internal val resourceData = ResourceData(File(resourceCacheDirectory))
}

View File

@@ -0,0 +1,23 @@
package app.revanced.patcher
import app.revanced.patcher.logging.Logger
import app.revanced.patcher.logging.impl.NopLogger
import java.io.File
/**
* Options for the [Patcher].
* @param inputFile The input file (usually an apk file).
* @param resourceCacheDirectory Directory to cache resources.
* @param patchResources Weather to use the resource patcher. Resources will still need to be decoded.
* @param aaptPath Optional path to a custom aapt binary.
* @param frameworkFolderLocation Optional path to a custom framework folder.
* @param logger Custom logger implementation for the [Patcher].
*/
data class PatcherOptions(
internal val inputFile: File,
internal val resourceCacheDirectory: String,
internal val patchResources: Boolean = false,
internal val aaptPath: String = "",
internal val frameworkFolderLocation: String? = null,
internal val logger: Logger = NopLogger
)

View File

@@ -0,0 +1,16 @@
package app.revanced.patcher
import app.revanced.patcher.util.dex.DexFile
import java.io.File
/**
* The result of a patcher.
* @param dexFiles The patched dex files.
* @param doNotCompress List of relative paths to files to exclude from compressing.
* @param resourceFile File containing resources that need to be extracted into the APK.
*/
data class PatcherResult(
val dexFiles: List<DexFile>,
val doNotCompress: List<String>? = null,
val resourceFile: File?
)

View File

@@ -0,0 +1,28 @@
package app.revanced.patcher.annotation
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
import app.revanced.patcher.patch.Patch
/**
* Annotation to constrain a [Patch] or [MethodFingerprint] to compatible packages.
* @param compatiblePackages A list of packages a [Patch] or [MethodFingerprint] is compatible with.
*/
@Target(AnnotationTarget.CLASS)
@Retention(AnnotationRetention.RUNTIME)
@MustBeDocumented
annotation class Compatibility(
val compatiblePackages: Array<Package>,
)
/**
* Annotation to represent packages a patch can be compatible with.
* @param name The package identifier name.
* @param versions The versions of the package the [Patch] or [MethodFingerprint]is compatible with.
*/
@Target()
@Retention(AnnotationRetention.RUNTIME)
@MustBeDocumented
annotation class Package(
val name: String,
val versions: Array<String> = [],
)

View File

@@ -0,0 +1,20 @@
package app.revanced.patcher.annotation
import app.revanced.patcher.data.Data
import app.revanced.patcher.patch.Patch
import kotlin.reflect.KClass
/**
* Declares a [Patch] deprecated for removal.
* @param reason The reason why the patch is deprecated.
* @param replacement The replacement for the deprecated patch, if any.
*/
@Target(AnnotationTarget.CLASS)
@Retention(AnnotationRetention.RUNTIME)
@MustBeDocumented
@Repeatable
annotation class PatchDeprecated(
val reason: String,
val replacement: KClass<out Patch<Data>> = Patch::class
// Values cannot be nullable in annotations, so this will have to do.
)

View File

@@ -0,0 +1,38 @@
package app.revanced.patcher.annotation
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
import app.revanced.patcher.patch.Patch
/**
* Annotation to name a [Patch] or [MethodFingerprint].
* @param name A suggestive name for the [Patch] or [MethodFingerprint].
*/
@Target(AnnotationTarget.CLASS)
@Retention(AnnotationRetention.RUNTIME)
@MustBeDocumented
annotation class Name(
val name: String,
)
/**
* Annotation to describe a [Patch] or [MethodFingerprint].
* @param description A description for the [Patch] or [MethodFingerprint].
*/
@Target(AnnotationTarget.CLASS)
@Retention(AnnotationRetention.RUNTIME)
@MustBeDocumented
annotation class Description(
val description: String,
)
/**
* Annotation to version a [Patch] or [MethodFingerprint].
* @param version The version of a [Patch] or [MethodFingerprint].
*/
@Target(AnnotationTarget.CLASS)
@Retention(AnnotationRetention.RUNTIME)
@MustBeDocumented
annotation class Version(
val version: String,
)

View File

@@ -0,0 +1,9 @@
package app.revanced.patcher.data
import app.revanced.patcher.data.impl.BytecodeData
import app.revanced.patcher.data.impl.ResourceData
/**
* Constraint interface for [BytecodeData] and [ResourceData]
*/
interface Data

View File

@@ -0,0 +1,13 @@
package app.revanced.patcher.data
import brut.androlib.meta.MetaInfo
/**
* Metadata about a package.
*/
class PackageMetadata {
lateinit var packageName: String
lateinit var packageVersion: String
internal val metaInfo: MetaInfo = MetaInfo()
}

View File

@@ -0,0 +1,69 @@
package app.revanced.patcher.data.impl
import app.revanced.patcher.data.Data
import app.revanced.patcher.util.ProxyBackedClassList
import app.revanced.patcher.util.method.MethodWalker
import org.jf.dexlib2.iface.ClassDef
import org.jf.dexlib2.iface.Method
class BytecodeData(
internalClasses: MutableList<ClassDef>
) : Data {
val classes = ProxyBackedClassList(internalClasses)
/**
* Find a class by a given class name.
* @param className The name of the class.
* @return A proxy for the first class that matches the class name.
*/
fun findClass(className: String) = findClass { it.type.contains(className) }
/**
* Find a class by a given predicate.
* @param predicate A predicate to match the class.
* @return A proxy for the first class that matches the predicate.
*/
fun findClass(predicate: (ClassDef) -> Boolean) =
// if we already proxied the class matching the predicate...
classes.proxies.firstOrNull { predicate(it.immutableClass) } ?:
// else resolve the class to a proxy and return it, if the predicate is matching a class
classes.find(predicate)?.let { proxy(it) }
fun proxy(classDef: ClassDef): app.revanced.patcher.util.proxy.ClassProxy {
var proxy = this.classes.proxies.find { it.immutableClass.type == classDef.type }
if (proxy == null) {
proxy = app.revanced.patcher.util.proxy.ClassProxy(classDef)
this.classes.add(proxy)
}
return proxy
}
}
internal class MethodNotFoundException(s: String) : Exception(s)
internal inline fun <reified T> Iterable<T>.find(predicate: (T) -> Boolean): T? {
for (element in this) {
if (predicate(element)) {
return element
}
}
return null
}
/**
* Create a [MethodWalker] instance for the current [BytecodeData].
* @param startMethod The method to start at.
* @return A [MethodWalker] instance.
*/
fun BytecodeData.toMethodWalker(startMethod: Method): MethodWalker {
return MethodWalker(this, startMethod)
}
internal inline fun <T> Iterable<T>.findIndexed(predicate: (T) -> Boolean): Pair<T, Int>? {
for ((index, element) in this.withIndex()) {
if (predicate(element)) {
return element to index
}
}
return null
}

View File

@@ -0,0 +1,84 @@
package app.revanced.patcher.data.impl
import app.revanced.patcher.data.Data
import org.w3c.dom.Document
import java.io.Closeable
import java.io.File
import java.io.InputStream
import java.io.OutputStream
import javax.xml.parsers.DocumentBuilderFactory
import javax.xml.transform.TransformerFactory
import javax.xml.transform.dom.DOMSource
import javax.xml.transform.stream.StreamResult
class ResourceData(private val resourceCacheDirectory: File) : Data, Iterable<File> {
val xmlEditor = XmlFileHolder()
operator fun get(path: String) = resourceCacheDirectory.resolve(path)
override fun iterator() = resourceCacheDirectory.walkTopDown().iterator()
inner class XmlFileHolder {
operator fun get(inputStream: InputStream) =
DomFileEditor(inputStream)
operator fun get(path: String): DomFileEditor {
return DomFileEditor(this@ResourceData[path])
}
}
}
/**
* DomFileEditor is a wrapper for a file that can be edited as a dom document.
*
* @param inputStream the input stream to read the xml file from.
* @param outputStream the output stream to write the xml file to. If null, the file will not be written.
*/
class DomFileEditor internal constructor(
private val inputStream: InputStream,
private val outputStream: Lazy<OutputStream>? = null,
) : Closeable {
// path to the xml file to unlock the resource when closing the editor
private var filePath: String? = null
/**
* The document of the xml file
*/
val file: Document = DocumentBuilderFactory.newInstance().newDocumentBuilder().parse(inputStream)
.also(Document::normalize)
// lazily open an output stream
// this is required because when constructing a DomFileEditor the output stream is created along with the input stream, which is not allowed
// the workaround is to lazily create the output stream. This way it would be used after the input stream is closed, which happens in the constructor
constructor(file: File) : this(file.inputStream(), lazy { file.outputStream() }) {
filePath = file.path
// prevent sharing mutability of the same file between multiple instances of DomFileEditor
if (locks.contains(filePath))
throw IllegalStateException("Can not create a DomFileEditor for that file because it is already locked by another instance of DomFileEditor.")
locks.add(filePath!!)
}
override fun close() {
inputStream.close()
// if the output stream is not null, do not close it
outputStream?.let {
val result = StreamResult(it.value)
TransformerFactory.newInstance().newTransformer().transform(DOMSource(file), result)
it.value.close()
}
// remove the lock, if it exists
filePath?.let {
locks.remove(it)
}
}
private companion object {
// list of locked file paths
val locks = mutableListOf<String>()
}
}

View File

@@ -0,0 +1,78 @@
package app.revanced.patcher.extensions
import app.revanced.patcher.annotation.*
import app.revanced.patcher.data.Data
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
import app.revanced.patcher.patch.OptionsContainer
import app.revanced.patcher.patch.Patch
import app.revanced.patcher.patch.PatchOptions
import kotlin.reflect.KClass
import kotlin.reflect.KVisibility
import kotlin.reflect.full.companionObject
import kotlin.reflect.full.companionObjectInstance
/**
* Recursively find a given annotation on a class.
* @param targetAnnotation The annotation to find.
* @return The annotation.
*/
private fun <T : Annotation> Class<*>.recursiveAnnotation(targetAnnotation: KClass<T>) =
this.findAnnotationRecursively(targetAnnotation.java, mutableSetOf())
private fun <T : Annotation> Class<*>.findAnnotationRecursively(
targetAnnotation: Class<T>, traversed: MutableSet<Annotation>
): T? {
val found = this.annotations.firstOrNull { it.annotationClass.java.name == targetAnnotation.name }
@Suppress("UNCHECKED_CAST") if (found != null) return found as T
for (annotation in this.annotations) {
if (traversed.contains(annotation)) continue
traversed.add(annotation)
return (annotation.annotationClass.java.findAnnotationRecursively(targetAnnotation, traversed)) ?: continue
}
return null
}
object PatchExtensions {
val Class<*>.patchName: String
get() = recursiveAnnotation(Name::class)?.name ?: this.javaClass.simpleName
val Class<out Patch<Data>>.version get() = recursiveAnnotation(Version::class)?.version
val Class<out Patch<Data>>.include get() = recursiveAnnotation(app.revanced.patcher.patch.annotations.Patch::class)!!.include
val Class<out Patch<Data>>.description get() = recursiveAnnotation(Description::class)?.description
val Class<out Patch<Data>>.dependencies get() = recursiveAnnotation(app.revanced.patcher.patch.annotations.DependsOn::class)?.dependencies
val Class<out Patch<Data>>.compatiblePackages get() = recursiveAnnotation(Compatibility::class)?.compatiblePackages
val Class<out Patch<Data>>.options: PatchOptions?
get() = kotlin.companionObject?.let { cl ->
if (cl.visibility != KVisibility.PUBLIC) return null
kotlin.companionObjectInstance?.let {
(it as? OptionsContainer)?.options
}
}
val Class<out Patch<Data>>.deprecated: Pair<String, KClass<out Patch<Data>>?>?
get() = recursiveAnnotation(PatchDeprecated::class)?.let {
it.reason to it.replacement.let { cl ->
if (cl == Patch::class) null else cl
}
}
@JvmStatic
fun Class<out Patch<Data>>.dependsOn(patch: Class<out Patch<Data>>): Boolean {
if (this.patchName == patch.patchName) throw IllegalArgumentException("thisval and patch may not be the same")
return this.dependencies?.any { it.java.patchName == this@dependsOn.patchName } == true
}
}
object MethodFingerprintExtensions {
val MethodFingerprint.name: String
get() = javaClass.recursiveAnnotation(Name::class)?.name ?: this.javaClass.simpleName
val MethodFingerprint.version get() = javaClass.recursiveAnnotation(Version::class)?.version ?: "0.0.1"
val MethodFingerprint.description get() = javaClass.recursiveAnnotation(Description::class)?.description
val MethodFingerprint.compatiblePackages get() = javaClass.recursiveAnnotation(Compatibility::class)?.compatiblePackages
val MethodFingerprint.matchingMethod get() = javaClass.recursiveAnnotation(app.revanced.patcher.fingerprint.method.annotation.MatchingMethod::class)
val MethodFingerprint.fuzzyPatternScanMethod get() = javaClass.recursiveAnnotation(app.revanced.patcher.fingerprint.method.annotation.FuzzyPatternScanMethod::class)
val MethodFingerprint.fuzzyScanThreshold get() = fuzzyPatternScanMethod?.threshold ?: 0
}

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,9 @@
package app.revanced.patcher.fingerprint
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
/**
* A ReVanced fingerprint.
* Can be a [MethodFingerprint].
*/
interface Fingerprint

View File

@@ -0,0 +1,32 @@
package app.revanced.patcher.fingerprint.method.annotation
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
/**
* Annotations for a method which matches to a [MethodFingerprint].
* @param definingClass The defining class name of the method.
* @param name A suggestive name for the method which the [MethodFingerprint] was created for.
*/
@Target(AnnotationTarget.CLASS)
@Retention(AnnotationRetention.RUNTIME)
annotation class MatchingMethod(
val definingClass: String = "L<unspecified-class>;",
val name: String = "<unspecified-method>"
)
/**
* Annotations to scan a pattern [MethodFingerprint] with fuzzy algorithm.
* @param threshold if [threshold] or more of the opcodes do not match, skip.
*/
@Target(AnnotationTarget.CLASS)
@Retention(AnnotationRetention.RUNTIME)
annotation class FuzzyPatternScanMethod(
val threshold: Int = 1
)
/**
* Annotations to scan a pattern [MethodFingerprint] directly.
*/
@Target(AnnotationTarget.CLASS)
@Retention(AnnotationRetention.RUNTIME)
annotation class DirectPatternScanMethod

View File

@@ -0,0 +1,98 @@
package app.revanced.patcher.fingerprint.method.impl
import app.revanced.patcher.data.impl.BytecodeData
import app.revanced.patcher.data.impl.MethodNotFoundException
import app.revanced.patcher.extensions.MethodFingerprintExtensions.name
import app.revanced.patcher.extensions.softCompareTo
import app.revanced.patcher.fingerprint.Fingerprint
import app.revanced.patcher.fingerprint.method.utils.MethodFingerprintUtils
import app.revanced.patcher.util.proxy.ClassProxy
import org.jf.dexlib2.Opcode
import org.jf.dexlib2.iface.ClassDef
import org.jf.dexlib2.iface.Method
/**
* Represents the [MethodFingerprint] for a method.
* @param returnType The return type of the method.
* @param access The access flags of the method.
* @param parameters The parameters of the method.
* @param opcodes The list of opcodes of the method.
* @param strings A list of strings which a method contains.
* @param customFingerprint A custom condition for this fingerprint.
* A `null` opcode is equals to an unknown opcode.
*/
abstract class MethodFingerprint(
internal val returnType: String? = null,
internal val access: Int? = null,
internal val parameters: Iterable<String>? = null,
internal val opcodes: Iterable<Opcode?>? = null,
internal val strings: Iterable<String>? = null,
internal val customFingerprint: ((methodDef: Method) -> Boolean)? = null
) : Fingerprint {
/**
* The result of the [MethodFingerprint] the [Method].
* @throws MethodNotFoundException If the resolution of the [Method] has not happened.
*/
var result: MethodFingerprintResult? = null
get() = field ?: throw Exception("${this.name} has not been resolved yet.")
}
/**
* Represents the result of a [MethodFingerprintUtils].
* @param method The matching method.
* @param classDef The [ClassDef] that contains the matching [method].
* @param patternScanResult Opcodes pattern scan result.
* @param data The [BytecodeData] this [MethodFingerprintResult] is attached to, to create proxies.
*/
data class MethodFingerprintResult(
val method: Method,
val classDef: ClassDef,
val patternScanResult: PatternScanResult?,
internal val data: BytecodeData
) {
/**
* Returns a mutable clone of [classDef]
*
* Please note, this method allocates a [ClassProxy].
* Use [classDef] where possible.
*/
val mutableClass by lazy { data.proxy(classDef).resolve() }
/**
* Returns a mutable clone of [method]
*
* Please note, this method allocates a [ClassProxy].
* Use [method] where possible.
*/
val mutableMethod by lazy {
mutableClass.methods.first {
it.softCompareTo(this.method)
}
}
}
/**
* The result of a pattern scan.
* @param startIndex The start index of the instructions where to which this pattern matches.
* @param endIndex The end index of the instructions where to which this pattern matches.
* @param warnings A list of warnings considering this [PatternScanResult].
*/
data class PatternScanResult(
val startIndex: Int,
val endIndex: Int,
var warnings: List<Warning>? = null
) {
/**
* Represents warnings of the pattern scan.
* @param correctOpcode The opcode the instruction list has.
* @param wrongOpcode The opcode the pattern list of the signature currently has.
* @param instructionIndex The index of the opcode relative to the instruction list.
* @param patternIndex The index of the opcode relative to the pattern list from the signature.
*/
data class Warning(
val correctOpcode: Opcode,
val wrongOpcode: Opcode,
val instructionIndex: Int,
val patternIndex: Int,
)
}

View File

@@ -0,0 +1,158 @@
package app.revanced.patcher.fingerprint.method.utils
import app.revanced.patcher.data.impl.BytecodeData
import app.revanced.patcher.extensions.MethodFingerprintExtensions.fuzzyPatternScanMethod
import app.revanced.patcher.extensions.MethodFingerprintExtensions.fuzzyScanThreshold
import app.revanced.patcher.extensions.parametersEqual
import app.revanced.patcher.fingerprint.method.annotation.FuzzyPatternScanMethod
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprintResult
import app.revanced.patcher.fingerprint.method.impl.PatternScanResult
import org.jf.dexlib2.Opcode
import org.jf.dexlib2.iface.ClassDef
import org.jf.dexlib2.iface.Method
import org.jf.dexlib2.iface.instruction.Instruction
import org.jf.dexlib2.iface.instruction.ReferenceInstruction
import org.jf.dexlib2.iface.reference.StringReference
/**
* Utility class for [MethodFingerprint]
*/
object MethodFingerprintUtils {
/**
* Resolve a list of [MethodFingerprint] against a list of [ClassDef].
* @param context The classes on which to resolve the [MethodFingerprint].
* @param forData The [BytecodeData] to host proxies.
* @return True if the resolution was successful, false otherwise.
*/
fun Iterable<MethodFingerprint>.resolve(forData: BytecodeData, context: Iterable<ClassDef>) {
for (fingerprint in this) // For each fingerprint
classes@ for (classDef in context) // search through all classes for the fingerprint
if (fingerprint.resolve(forData, classDef))
break@classes // if the resolution succeeded, continue with the next fingerprint
}
/**
* Resolve a [MethodFingerprint] against a [ClassDef].
* @param context The class on which to resolve the [MethodFingerprint].
* @param forData The [BytecodeData] to host proxies.
* @return True if the resolution was successful, false otherwise.
*/
fun MethodFingerprint.resolve(forData: BytecodeData, context: ClassDef): Boolean {
for (method in context.methods)
if (this.resolve(forData, method, context))
return true
return false
}
/**
* Resolve a [MethodFingerprint] against a [Method].
* @param context The context on which to resolve the [MethodFingerprint].
* @param classDef The class of the matching [Method].
* @param forData The [BytecodeData] to host proxies.
* @return True if the resolution was successful, false otherwise.
*/
fun MethodFingerprint.resolve(forData: BytecodeData, context: Method, classDef: ClassDef): Boolean {
val methodFingerprint = this
if (methodFingerprint.returnType != null && !context.returnType.startsWith(methodFingerprint.returnType))
return false
if (methodFingerprint.access != null && methodFingerprint.access != context.accessFlags)
return false
if (methodFingerprint.parameters != null && !parametersEqual(
methodFingerprint.parameters, // TODO: parseParameters()
context.parameterTypes
)
) return false
if (methodFingerprint.customFingerprint != null && !methodFingerprint.customFingerprint!!(context))
return false
if (methodFingerprint.strings != null) {
val implementation = context.implementation ?: return false
val stringsList = methodFingerprint.strings.toMutableList()
implementation.instructions.forEach { instruction ->
if (instruction.opcode.ordinal != Opcode.CONST_STRING.ordinal) return@forEach
val string = ((instruction as ReferenceInstruction).reference as StringReference).string
val index = stringsList.indexOfFirst { it == string }
if (index != -1) stringsList.removeAt(index)
}
if (stringsList.isNotEmpty()) return false
}
val patternScanResult = if (methodFingerprint.opcodes != null) {
context.implementation?.instructions ?: return false
context.patternScan(methodFingerprint) ?: return false
} else null
methodFingerprint.result = MethodFingerprintResult(context, classDef, patternScanResult, forData)
return true
}
private fun Method.patternScan(
fingerprint: MethodFingerprint
): PatternScanResult? {
val instructions = this.implementation!!.instructions
val fingerprintFuzzyPatternScanThreshold = fingerprint.fuzzyScanThreshold
val pattern = fingerprint.opcodes!!
val instructionLength = instructions.count()
val patternLength = pattern.count()
for (index in 0 until instructionLength) {
var patternIndex = 0
var threshold = fingerprintFuzzyPatternScanThreshold
while (index + patternIndex < instructionLength) {
val originalOpcode = instructions.elementAt(index + patternIndex).opcode
val patternOpcode = pattern.elementAt(patternIndex)
if (patternOpcode != null && patternOpcode.ordinal != originalOpcode.ordinal) {
// reaching maximum threshold (0) means,
// the pattern does not match to the current instructions
if (threshold-- == 0) break
}
if (patternIndex < patternLength - 1) {
// if the entire pattern has not been scanned yet
// continue the scan
patternIndex++
continue
}
// the pattern is valid, generate warnings if fuzzyPatternScanMethod is FuzzyPatternScanMethod
val result = PatternScanResult(index, index + patternIndex)
if (fingerprint.fuzzyPatternScanMethod !is FuzzyPatternScanMethod) return result
result.warnings = result.createWarnings(pattern, instructions)
return result
}
}
return null
}
}
private fun PatternScanResult.createWarnings(
pattern: Iterable<Opcode?>, instructions: Iterable<Instruction>
) = buildList {
for ((patternIndex, instructionIndex) in (this@createWarnings.startIndex until this@createWarnings.endIndex).withIndex()) {
val originalOpcode = instructions.elementAt(instructionIndex).opcode
val patternOpcode = pattern.elementAt(patternIndex)
if (patternOpcode == null || patternOpcode.ordinal == originalOpcode.ordinal) continue
this.add(PatternScanResult.Warning(originalOpcode, patternOpcode, instructionIndex, patternIndex))
}
}
private operator fun ClassDef.component1() = this
private operator fun ClassDef.component2() = this.methods

Some files were not shown because too many files have changed in this diff Show More