Skip to content

Commit d4b4b0c

Browse files
compile revanced patches locally
* removed CheckEnvironmentPatch because it didnt correctly detect the on-device local patching * revanced-patches `v5.2.1`
1 parent 2763f41 commit d4b4b0c

File tree

6 files changed

+60
-18
lines changed

6 files changed

+60
-18
lines changed

.gitmodules

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
11
[submodule "revanced-cli"]
22
path = revanced-cli
3-
url = https://github.com/revanced/revanced-cli
3+
url = https://github.com/revanced/revanced-cli
4+
[submodule "revanced-patches"]
5+
path = revanced-patches
6+
url = https://github.com/revanced/revanced-patches

compile.sh

Lines changed: 21 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
#!/bin/bash
22
set -e
3+
shopt -s inherit_errexit
4+
set -o pipefail
35

46
for cmd in git wget zip java; do
57
[ -z "$(command -v "$cmd")" ] && echo "missing $cmd" && exit 1
@@ -10,46 +12,49 @@ done
1012
[ -z "$GITHUB_TOKEN" ] && echo "missing GITHUB_TOKEN" && exit 1
1113

1214
declare -x GITHUB_ACTOR GITHUB_TOKEN
13-
REVANCED_PATCHES_URL="https://github.com/revanced/revanced-patches/releases/download/v%s/patches-%s.rvp"
1415

1516
git submodule update --checkout
1617
git clean -fdx magiskmodule/
1718

1819
executeGradle() {
1920
(
20-
cd revanced-android
21+
cd "$1"
22+
shift
2123
./gradlew "$@"
2224
)
2325
}
26+
applyPatches() {
27+
(
28+
cd "$1"
29+
for patch in ../"$1"-patches/*.patch; do
30+
git am --no-3way "$patch"
31+
done
32+
)
33+
}
2434

2535
[ "$1" = "clean" ] && {
26-
executeGradle clean
36+
executeGradle revanced-android clean
37+
executeGradle revanced-patches clean
2738
exit
2839
}
2940

30-
(
31-
cd revanced-cli
32-
for patch in ../revanced-cli-patches/*.patch; do
33-
git am --no-3way "$patch"
34-
done
35-
)
41+
applyPatches revanced-cli
42+
executeGradle revanced-android assemble :revancedcli:shadowJar
3643

37-
executeGradle assemble :revancedcli:shadowJar
44+
applyPatches revanced-patches
45+
executeGradle revanced-patches buildAndroid
3846

3947
git submodule update --checkout
4048

4149
source version.sh
4250

4351
REVANCED_PATCHES=${REVANCED_PATCHES#v}
44-
printf -v REVANCED_PATCHES_DL "$REVANCED_PATCHES_URL" "$REVANCED_PATCHES" "$REVANCED_PATCHES"
45-
[ ! -f "$(basename "$REVANCED_PATCHES_DL")" ] && wget -c -O "$(basename "$REVANCED_PATCHES_DL")" "$REVANCED_PATCHES_DL"
46-
4752
REVANCED_CLI=${REVANCED_CLI#v}
48-
ln -v -s -f "revanced-cli/build/libs/revancedcli-$REVANCED_CLI-all.jar" "revanced-cli.jar"
53+
ln -v -s -f revanced-cli/build/libs/revancedcli-"$REVANCED_CLI"-all.jar revanced-cli.jar
4954

5055
PATCHES_LIST=$(java -jar revanced-cli.jar \
5156
list-packages \
52-
"$(basename "$REVANCED_PATCHES_DL")" \
57+
revanced-patches/patches/build/libs/patches-"$REVANCED_PATCHES".rvp \
5358
| sed 's/^INFORMATION: \s*//')
5459
rm -rf magiskmodule/packageversions
5560
mkdir magiskmodule/packageversions
@@ -65,7 +70,7 @@ done
6570
logo/convert.sh
6671

6772
cp -v revanced-android/revancedcliwrapper/build/outputs/apk/release/revancedcliwrapper-release.apk magiskmodule/revancedandroidcli.apk
68-
cp -v "$(basename "$REVANCED_PATCHES_DL")" magiskmodule/patches.rvp
73+
cp -v revanced-patches/patches/build/libs/patches-"$REVANCED_PATCHES".rvp magiskmodule/patches.rvp
6974
cp -r -v --no-target-directory aapt2 magiskmodule/aapt2lib
7075
cp -r --no-target-directory logo/assets magiskmodule/logo
7176
cp README.md magiskmodule/README.md

revanced-patches

Submodule revanced-patches added at 69ec47c
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
From 7b6d527f31ae0e1f2b9aa1b357dd4e9ed4e95e36 Mon Sep 17 00:00:00 2001
2+
From: programminghoch10 <[email protected]>
3+
Date: Thu, 5 Dec 2024 21:09:36 +0100
4+
Subject: [PATCH] remove CheckEnvironmentPatch
5+
6+
since we build on device this patch is not required
7+
---
8+
.../revanced/patches/youtube/misc/settings/SettingsPatch.kt | 3 ---
9+
1 file changed, 3 deletions(-)
10+
11+
diff --git a/patches/src/main/kotlin/app/revanced/patches/youtube/misc/settings/SettingsPatch.kt b/patches/src/main/kotlin/app/revanced/patches/youtube/misc/settings/SettingsPatch.kt
12+
index 627a70f91..e15fc9d00 100644
13+
--- a/patches/src/main/kotlin/app/revanced/patches/youtube/misc/settings/SettingsPatch.kt
14+
+++ b/patches/src/main/kotlin/app/revanced/patches/youtube/misc/settings/SettingsPatch.kt
15+
@@ -118,9 +118,6 @@ val settingsPatch = bytecodePatch(
16+
settingsResourcePatch,
17+
addResourcesPatch,
18+
disableCairoSettingsPatch,
19+
- // Currently there is no easy way to make a mandatory patch,
20+
- // so for now this is a dependent of this patch.
21+
- checkEnvironmentPatch,
22+
)
23+
24+
val extensionPackage = "app/revanced/extension/youtube"
25+
--
26+
2.45.2
27+

update.sh

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,12 @@ source version.sh
1212

1313
REVANCED_PATCHES_TAG=$(curl -s https://api.github.com/repos/revanced/revanced-patches/releases/latest | jq -r '.tag_name')
1414
if [ "$REVANCED_PATCHES" != "$REVANCED_PATCHES_TAG" ]; then
15+
(
16+
git submodule update --checkout
17+
cd revanced-patches
18+
git fetch --all --quiet
19+
git checkout "$REVANCED_PATCHES_TAG"
20+
)
1521
sed -i "s/^REVANCED_PATCHES=.*$/REVANCED_PATCHES=\"$REVANCED_PATCHES_TAG\"/" version.sh
1622
echo "Updated REVANCED_PATCHES from $REVANCED_PATCHES to $REVANCED_PATCHES_TAG"
1723
else

version.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
#!/bin/bash
22

3-
REVANCED_PATCHES="v5.0.2"
3+
REVANCED_PATCHES="v5.2.1"
44
REVANCED_CLI="v5.0.0"

0 commit comments

Comments
 (0)