Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
88a3252
feat: Add identity hash code to unnamed patches
oSumAtrIX Dec 7, 2024
fc505a8
chore: Release v21.1.0-dev.1 [skip ci]
semantic-release-bot Dec 7, 2024
fe5fb73
build: Bump dependencies
oSumAtrIX Dec 17, 2024
754b02e
feat: Use option name as key for simplicity and consistency
oSumAtrIX Dec 24, 2024
bb8771b
fix: Support UTF-8 chars when compiling instructions in Smali in non …
Jan 7, 2025
e4e66b0
fix: Add back missing log by naming logger correctly (#332)
kitadai31 Jan 19, 2025
509ecc8
docs: Correct API usage of fingerprints
oSumAtrIX Mar 10, 2025
d80abbc
docs: Correct API usage of fingerprints
oSumAtrIX Mar 10, 2025
99f4318
perf: Use a buffered writer to reduce IO overhead (#347)
Taknok Jun 20, 2025
062ae14
chore: Release v21.1.0-dev.2 [skip ci]
semantic-release-bot Jun 20, 2025
4f2ef3c
fix: Encode XML files as UTF-8 to fix compilation of resources (#339)
Taknok Jun 20, 2025
68db95b
chore: Release v21.1.0-dev.3 [skip ci]
semantic-release-bot Jun 20, 2025
33fadcb
fix: Correctly save XML files in UTF-8 by using a bufferedWriter (#356)
kitadai31 Jul 18, 2025
b160a2a
chore: Release v21.1.0-dev.4 [skip ci]
semantic-release-bot Jul 18, 2025
b0d3471
build(deps): bump org.jetbrains.kotlinx.binary-compatibility-validato…
dependabot[bot] Aug 1, 2025
81e6aed
build(deps): bump io.mockk:mockk from 1.13.10 to 1.14.5 (#363)
dependabot[bot] Aug 1, 2025
42c5a75
build(deps-dev): bump semantic-release from 24.1.2 to 24.2.7 (#364)
dependabot[bot] Aug 1, 2025
e8358ab
build(deps): bump org.jetbrains.kotlinx:kotlinx-coroutines-core from …
dependabot[bot] Aug 1, 2025
dd95d8c
build(deps): bump burrunan/gradle-cache-action from 1 to 3 (#352)
dependabot[bot] Aug 1, 2025
d21d2b1
build(deps): bump com.android.tools.smali:smali from 3.0.8 to 3.0.9 (…
dependabot[bot] Aug 1, 2025
f70e857
build(deps): bump kotlin from 2.0.20 to 2.2.0 (#354)
dependabot[bot] Aug 1, 2025
8255ca1
Revert "build(deps): bump kotlin from 2.0.20 to 2.2.0 (#354)"
LisoUseInAIKyrios Aug 1, 2025
6d401fc
build(deps-dev): bump semantic-release from 24.2.7 to 24.2.9 (#374)
dependabot[bot] Oct 1, 2025
5756d58
build(deps): bump actions/setup-node from 4 to 5 (#373)
dependabot[bot] Oct 1, 2025
f570a9f
build(deps): bump actions/checkout from 4 to 5 (#368)
dependabot[bot] Oct 1, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/build_pull_request.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,12 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
uses: actions/checkout@v5
with:
fetch-depth: 0

- name: Cache Gradle
uses: burrunan/gradle-cache-action@v1
uses: burrunan/gradle-cache-action@v3

- name: Build
env:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/open_pull_request.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
uses: actions/checkout@v5

- name: Open pull request
uses: repo-sync/pull-request@v2
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,23 +16,23 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
uses: actions/checkout@v5
with:
# Make sure the release step uses its own credentials:
# https://github.com/cycjimmy/semantic-release-action#private-packages
persist-credentials: false
fetch-depth: 0

- name: Cache Gradle
uses: burrunan/gradle-cache-action@v1
uses: burrunan/gradle-cache-action@v3

- name: Build
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: ./gradlew build clean

- name: Setup Node.js
uses: actions/setup-node@v4
uses: actions/setup-node@v5
with:
node-version: "lts/*"
cache: 'npm'
Expand Down
39 changes: 39 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,42 @@
# [21.1.0-dev.4](https://github.com/ReVanced/revanced-patcher/compare/v21.1.0-dev.3...v21.1.0-dev.4) (2025-07-18)


### Bug Fixes

* Correctly save XML files in UTF-8 by using a bufferedWriter ([#356](https://github.com/ReVanced/revanced-patcher/issues/356)) ([33fadcb](https://github.com/ReVanced/revanced-patcher/commit/33fadcbd0c7076b848bdca4d62a9c684d5781232))

# [21.1.0-dev.3](https://github.com/ReVanced/revanced-patcher/compare/v21.1.0-dev.2...v21.1.0-dev.3) (2025-06-20)


### Bug Fixes

* Encode XML files as UTF-8 to fix compilation of resources ([#339](https://github.com/ReVanced/revanced-patcher/issues/339)) ([4f2ef3c](https://github.com/ReVanced/revanced-patcher/commit/4f2ef3c47cea76a26c464cfb45d4bb57fe7198b5))

# [21.1.0-dev.2](https://github.com/ReVanced/revanced-patcher/compare/v21.1.0-dev.1...v21.1.0-dev.2) (2025-06-20)


### Bug Fixes

* Add back missing log by naming logger correctly ([#332](https://github.com/ReVanced/revanced-patcher/issues/332)) ([e4e66b0](https://github.com/ReVanced/revanced-patcher/commit/e4e66b0d8bb0986b79fb150b9c15da35b8e11561))
* Support UTF-8 chars when compiling instructions in Smali in non UTF-8 environments ([#331](https://github.com/ReVanced/revanced-patcher/issues/331)) ([bb8771b](https://github.com/ReVanced/revanced-patcher/commit/bb8771bb8b8ab1724d957e56f4de88c02684d87b))


### Features

* Use option name as key for simplicity and consistency ([754b02e](https://github.com/ReVanced/revanced-patcher/commit/754b02e4ca66ec10764d5205c6643f2d86d0c6a2))


### Performance Improvements

* Use a buffered writer to reduce IO overhead ([#347](https://github.com/ReVanced/revanced-patcher/issues/347)) ([99f4318](https://github.com/ReVanced/revanced-patcher/commit/99f431897eb9e607987fd5d09b879d7eda442f3e))

# [21.1.0-dev.1](https://github.com/ReVanced/revanced-patcher/compare/v21.0.0...v21.1.0-dev.1) (2024-12-07)


### Features

* Add identity hash code to unnamed patches ([88a3252](https://github.com/ReVanced/revanced-patcher/commit/88a325257494939a79fb30dd51d60c5c52546755))

# [21.0.0](https://github.com/ReVanced/revanced-patcher/compare/v20.0.2...v21.0.0) (2024-11-05)


Expand Down
5 changes: 5 additions & 0 deletions api/revanced-patcher.api
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,8 @@ public final class app/revanced/patcher/Patcher : java/io/Closeable {
}

public final class app/revanced/patcher/PatcherConfig {
public fun <init> (Ljava/io/File;Ljava/io/File;Ljava/io/File;Ljava/lang/String;)V
public synthetic fun <init> (Ljava/io/File;Ljava/io/File;Ljava/io/File;Ljava/lang/String;ILkotlin/jvm/internal/DefaultConstructorMarker;)V
public fun <init> (Ljava/io/File;Ljava/io/File;Ljava/lang/String;Ljava/lang/String;)V
public synthetic fun <init> (Ljava/io/File;Ljava/io/File;Ljava/lang/String;Ljava/lang/String;ILkotlin/jvm/internal/DefaultConstructorMarker;)V
}
Expand Down Expand Up @@ -169,9 +171,12 @@ public final class app/revanced/patcher/patch/BytecodePatchContext : app/revance
public final class app/revanced/patcher/patch/Option {
public fun <init> (Ljava/lang/String;Ljava/lang/Object;Ljava/util/Map;Ljava/lang/String;Ljava/lang/String;ZLkotlin/reflect/KType;Lkotlin/jvm/functions/Function2;)V
public synthetic fun <init> (Ljava/lang/String;Ljava/lang/Object;Ljava/util/Map;Ljava/lang/String;Ljava/lang/String;ZLkotlin/reflect/KType;Lkotlin/jvm/functions/Function2;ILkotlin/jvm/internal/DefaultConstructorMarker;)V
public fun <init> (Ljava/lang/String;Ljava/lang/Object;Ljava/util/Map;Ljava/lang/String;ZLkotlin/reflect/KType;Lkotlin/jvm/functions/Function2;)V
public synthetic fun <init> (Ljava/lang/String;Ljava/lang/Object;Ljava/util/Map;Ljava/lang/String;ZLkotlin/reflect/KType;Lkotlin/jvm/functions/Function2;ILkotlin/jvm/internal/DefaultConstructorMarker;)V
public final fun getDefault ()Ljava/lang/Object;
public final fun getDescription ()Ljava/lang/String;
public final fun getKey ()Ljava/lang/String;
public final fun getName ()Ljava/lang/String;
public final fun getRequired ()Z
public final fun getTitle ()Ljava/lang/String;
public final fun getType ()Lkotlin/reflect/KType;
Expand Down
42 changes: 21 additions & 21 deletions docs/2_2_patch_anatomy.md
Original file line number Diff line number Diff line change
Expand Up @@ -73,26 +73,26 @@ package app.revanced.patches.ads
val disableAdsPatch = bytecodePatch(
name = "Disable ads",
description = "Disable ads in the app.",
) {
) {
compatibleWith("com.some.app"("1.0.0"))

// Patches can depend on other patches, executing them first.
dependsOn(disableAdsResourcePatch)

// Merge precompiled DEX files into the patched app, before the patch is executed.
extendWith("disable-ads.rve")

// Business logic of the patch to disable ads in the app.
execute {
// Fingerprint to find the method to patch.
val showAdsMatch by showAdsFingerprint {
// More about fingerprints on the next page of the documentation.
val showAdsFingerprint = fingerprint {
// More about fingerprints on the next page of the documentation.
}

// In the method that shows ads,
// call DisableAdsPatch.shouldDisableAds() from the extension (precompiled DEX file)
// to enable or disable ads.
showAdsMatch.method.addInstructions(
showAdsFingerprint.method.addInstructions(
0,
"""
invoke-static {}, LDisableAdsPatch;->shouldDisableAds()Z
Expand Down Expand Up @@ -122,11 +122,11 @@ To define an option, use the available `option` functions:
```kt
val patch = bytecodePatch(name = "Patch") {
// Add an inbuilt option and delegate it to a property.
val value by stringOption(key = "option")
val value by stringOption(name = "Inbuilt option")

// Add an option with a custom type and delegate it to a property.
val string by option<String>(key = "string")
val string by option<String>(name = "String option")

execute {
println(value)
println(string)
Expand All @@ -139,7 +139,7 @@ Options of a patch can be set after loading the patches with `PatchLoader` by ob
```kt
loadPatchesJar(patches).apply {
// Type is checked at runtime.
first { it.name == "Patch" }.options["option"] = "Value"
first { it.name == "Patch" }.options["Option"] = "Value"
}
```

Expand All @@ -152,7 +152,7 @@ option.type // The KType of the option. Captures the full type information of th
Options can be declared outside a patch and added to a patch manually:

```kt
val option = stringOption(key = "option")
val option = stringOption(name = "Option")

bytecodePatch(name = "Patch") {
val value by option()
Expand Down Expand Up @@ -183,18 +183,18 @@ and use it in a patch:
```kt
val patch = bytecodePatch(name = "Complex patch") {
extendWith("complex-patch.rve")
execute {
fingerprint.match!!.mutableMethod.addInstructions(0, "invoke-static { }, LComplexPatch;->doSomething()V")

execute {
fingerprint.method.addInstructions(0, "invoke-static { }, LComplexPatch;->doSomething()V")
}
}
```

ReVanced Patcher merges the classes from the extension into `context.classes` before executing the patch.
ReVanced Patcher merges the classes from the extension into `context.classes` before executing the patch.
When the patch is executed, it can reference the classes and methods from the extension.

> [!NOTE]
>
>
> The [ReVanced Patches template](https://github.com/ReVanced/revanced-patches-template) repository
> is a template project to create patches and extensions.

Expand All @@ -211,9 +211,9 @@ A simple real-world example would be a patch that opens a resource file of the a
Other patches that depend on this patch can write to the file, and the finalization block can close the file.

```kt
val patch = bytecodePatch(name = "Patch") {
val patch = bytecodePatch(name = "Patch") {
dependsOn(
bytecodePatch(name = "Dependency") {
bytecodePatch(name = "Dependency") {
execute {
print("1")
}
Expand Down Expand Up @@ -249,10 +249,10 @@ The same order is followed for multiple patches depending on the patch.
- A patch can declare compatibility with specific packages and versions,
but patches can still be executed on any package or version.
It is recommended that compatibility is specified to present known compatible packages and versions.
- If `compatibleWith` is not used, the patch is treated as compatible with any package
- If `compatibleWith` is not used, the patch is treated as compatible with any package
- If a package is specified with no versions, the patch is compatible with any version of the package
- If an empty array of versions is specified, the patch is not compatible with any version of the package.
This is useful for declaring incompatibility with a specific package.
This is useful for declaring incompatibility with a specific package.
- A patch can raise a `PatchException` at any time of execution to indicate that the patch failed to execute.

## ⏭️ What's next
Expand Down
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
org.gradle.parallel = true
org.gradle.caching = true
version = 21.0.0
version = 21.1.0-dev.4
12 changes: 6 additions & 6 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
[versions]
android = "4.1.1.4"
apktool-lib = "2.9.3"
binary-compatibility-validator = "0.15.1"
kotlin = "2.0.0"
kotlinx-coroutines-core = "1.8.1"
mockk = "1.13.10"
apktool-lib = "2.10.1.1"
binary-compatibility-validator = "0.18.1"
kotlin = "2.0.20"
kotlinx-coroutines-core = "1.10.2"
mockk = "1.14.5"
multidexlib2 = "3.0.3.r3"
# Tracking https://github.com/google/smali/issues/64.
#noinspection GradleDependency
smali = "3.0.5"
smali = "3.0.9"
xpp3 = "1.1.4c"

[libraries]
Expand Down
Loading