From d4b4b0caa0a5ba1f248f416b870775a84c5155a1 Mon Sep 17 00:00:00 2001 From: programminghoch10 <16062290+programminghoch10@users.noreply.github.com> Date: Thu, 5 Dec 2024 21:22:16 +0100 Subject: [PATCH] compile revanced patches locally * removed CheckEnvironmentPatch because it didnt correctly detect the on-device local patching * revanced-patches `v5.2.1` --- .gitmodules | 5 ++- compile.sh | 37 +++++++++++-------- revanced-patches | 1 + .../remove-CheckEnvironmentPatch.patch | 27 ++++++++++++++ update.sh | 6 +++ version.sh | 2 +- 6 files changed, 60 insertions(+), 18 deletions(-) create mode 160000 revanced-patches create mode 100644 revanced-patches-patches/remove-CheckEnvironmentPatch.patch diff --git a/.gitmodules b/.gitmodules index f645bf9..a60763a 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,3 +1,6 @@ [submodule "revanced-cli"] path = revanced-cli - url = https://github.com/revanced/revanced-cli \ No newline at end of file + url = https://github.com/revanced/revanced-cli +[submodule "revanced-patches"] + path = revanced-patches + url = https://github.com/revanced/revanced-patches diff --git a/compile.sh b/compile.sh index dab092b..719ae2c 100755 --- a/compile.sh +++ b/compile.sh @@ -1,5 +1,7 @@ #!/bin/bash set -e +shopt -s inherit_errexit +set -o pipefail for cmd in git wget zip java; do [ -z "$(command -v "$cmd")" ] && echo "missing $cmd" && exit 1 @@ -10,46 +12,49 @@ done [ -z "$GITHUB_TOKEN" ] && echo "missing GITHUB_TOKEN" && exit 1 declare -x GITHUB_ACTOR GITHUB_TOKEN -REVANCED_PATCHES_URL="https://github.com/revanced/revanced-patches/releases/download/v%s/patches-%s.rvp" git submodule update --checkout git clean -fdx magiskmodule/ executeGradle() { ( - cd revanced-android + cd "$1" + shift ./gradlew "$@" ) } +applyPatches() { + ( + cd "$1" + for patch in ../"$1"-patches/*.patch; do + git am --no-3way "$patch" + done + ) +} [ "$1" = "clean" ] && { - executeGradle clean + executeGradle revanced-android clean + executeGradle revanced-patches clean exit } -( - cd revanced-cli - for patch in ../revanced-cli-patches/*.patch; do - git am --no-3way "$patch" - done -) +applyPatches revanced-cli +executeGradle revanced-android assemble :revancedcli:shadowJar -executeGradle assemble :revancedcli:shadowJar +applyPatches revanced-patches +executeGradle revanced-patches buildAndroid git submodule update --checkout source version.sh REVANCED_PATCHES=${REVANCED_PATCHES#v} -printf -v REVANCED_PATCHES_DL "$REVANCED_PATCHES_URL" "$REVANCED_PATCHES" "$REVANCED_PATCHES" -[ ! -f "$(basename "$REVANCED_PATCHES_DL")" ] && wget -c -O "$(basename "$REVANCED_PATCHES_DL")" "$REVANCED_PATCHES_DL" - REVANCED_CLI=${REVANCED_CLI#v} -ln -v -s -f "revanced-cli/build/libs/revancedcli-$REVANCED_CLI-all.jar" "revanced-cli.jar" +ln -v -s -f revanced-cli/build/libs/revancedcli-"$REVANCED_CLI"-all.jar revanced-cli.jar PATCHES_LIST=$(java -jar revanced-cli.jar \ list-packages \ - "$(basename "$REVANCED_PATCHES_DL")" \ + revanced-patches/patches/build/libs/patches-"$REVANCED_PATCHES".rvp \ | sed 's/^INFORMATION: \s*//') rm -rf magiskmodule/packageversions mkdir magiskmodule/packageversions @@ -65,7 +70,7 @@ done logo/convert.sh cp -v revanced-android/revancedcliwrapper/build/outputs/apk/release/revancedcliwrapper-release.apk magiskmodule/revancedandroidcli.apk -cp -v "$(basename "$REVANCED_PATCHES_DL")" magiskmodule/patches.rvp +cp -v revanced-patches/patches/build/libs/patches-"$REVANCED_PATCHES".rvp magiskmodule/patches.rvp cp -r -v --no-target-directory aapt2 magiskmodule/aapt2lib cp -r --no-target-directory logo/assets magiskmodule/logo cp README.md magiskmodule/README.md diff --git a/revanced-patches b/revanced-patches new file mode 160000 index 0000000..69ec47c --- /dev/null +++ b/revanced-patches @@ -0,0 +1 @@ +Subproject commit 69ec47cbeff8d48fa185db183a52958a9960fc5b diff --git a/revanced-patches-patches/remove-CheckEnvironmentPatch.patch b/revanced-patches-patches/remove-CheckEnvironmentPatch.patch new file mode 100644 index 0000000..82ae9e4 --- /dev/null +++ b/revanced-patches-patches/remove-CheckEnvironmentPatch.patch @@ -0,0 +1,27 @@ +From 7b6d527f31ae0e1f2b9aa1b357dd4e9ed4e95e36 Mon Sep 17 00:00:00 2001 +From: programminghoch10 <16062290+programminghoch10@users.noreply.github.com> +Date: Thu, 5 Dec 2024 21:09:36 +0100 +Subject: [PATCH] remove CheckEnvironmentPatch + +since we build on device this patch is not required +--- + .../revanced/patches/youtube/misc/settings/SettingsPatch.kt | 3 --- + 1 file changed, 3 deletions(-) + +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 +index 627a70f91..e15fc9d00 100644 +--- 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 +@@ -118,9 +118,6 @@ val settingsPatch = bytecodePatch( + settingsResourcePatch, + addResourcesPatch, + disableCairoSettingsPatch, +- // Currently there is no easy way to make a mandatory patch, +- // so for now this is a dependent of this patch. +- checkEnvironmentPatch, + ) + + val extensionPackage = "app/revanced/extension/youtube" +-- +2.45.2 + diff --git a/update.sh b/update.sh index 129ba59..6b77f11 100755 --- a/update.sh +++ b/update.sh @@ -12,6 +12,12 @@ source version.sh REVANCED_PATCHES_TAG=$(curl -s https://api.github.com/repos/revanced/revanced-patches/releases/latest | jq -r '.tag_name') if [ "$REVANCED_PATCHES" != "$REVANCED_PATCHES_TAG" ]; then + ( + git submodule update --checkout + cd revanced-patches + git fetch --all --quiet + git checkout "$REVANCED_PATCHES_TAG" + ) sed -i "s/^REVANCED_PATCHES=.*$/REVANCED_PATCHES=\"$REVANCED_PATCHES_TAG\"/" version.sh echo "Updated REVANCED_PATCHES from $REVANCED_PATCHES to $REVANCED_PATCHES_TAG" else diff --git a/version.sh b/version.sh index 717b78c..e0fb16c 100644 --- a/version.sh +++ b/version.sh @@ -1,4 +1,4 @@ #!/bin/bash -REVANCED_PATCHES="v5.0.2" +REVANCED_PATCHES="v5.2.1" REVANCED_CLI="v5.0.0"