Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
NoName-exe authored Jan 6, 2025
2 parents 4b9d521 + e65a296 commit 5c261c8
Show file tree
Hide file tree
Showing 16 changed files with 469 additions and 331 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ jobs:
if git checkout origin/update build.md; then
UPDATE_CFG=$(./build.sh config.toml --config-update)
if [ "$UPDATE_CFG" ]; then
echo "$UPDATE_CFG" > config.toml
echo "$UPDATE_CFG" > config.json
fi
fi
Expand All @@ -45,7 +45,7 @@ jobs:
echo "NEXT_VER_CODE=$((TAG + 1))" >> $GITHUB_OUTPUT
- name: Build modules/APKs
run: ./build.sh config.toml
run: if [ -f "config.json" ]; then ./build.sh config.json; else ./build.sh config.toml; fi
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GITHUB_REPOSITORY: $GITHUB_REPOSITORY
Expand Down Expand Up @@ -86,7 +86,7 @@ jobs:
get_update_json() {
echo "{
\"version\": \"$1\",
\"versionCode\": ${{ steps.next_ver_code.outputs.NEXT_VER_CODE}},
\"versionCode\": ${{ steps.next_ver_code.outputs.NEXT_VER_CODE }},
\"zipUrl\": \"$2\",
\"changelog\": \"https://raw.githubusercontent.com/$GITHUB_REPOSITORY/update/build.md\"
}"
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ jobs:
else
UPDATE_CFG=$(./build.sh config.toml --config-update)
if [ "$UPDATE_CFG" ]; then
echo "'$UPDATE_CFG'"
echo "SHOULD_BUILD=1" >> $GITHUB_OUTPUT
else
echo "SHOULD_BUILD=0" >> $GITHUB_OUTPUT
Expand Down
49 changes: 33 additions & 16 deletions CONFIG.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,31 +13,48 @@ There exists an example below with all defaults shown and all the keys explicitl
**All keys are optional** (except download urls) and are assigned to their default values if not set explicitly.

```toml
parallel-jobs = 1 # amount of cores to use for parallel patching, if not set nproc is used
parallel-jobs = 1 # amount of cores to use for parallel patching, if not set $(nproc) is used
compression-level = 9 # module zip compression level
remove-rv-integrations-checks = true # remove checks from the revanced integrations

patches-source = "revanced/revanced-patches" # where to fetch patches bundle from. default: "revanced/revanced-patches"
integrations-source = "revanced/revanced-integrations" # where to fetch integrations from. default: "revanced/revanced-integrations"
cli-source = "j-hc/revanced-cli" # where to fetch cli from. default: "j-hc/revanced-cli"
cli-source = "j-hc/revanced-cli" # where to fetch cli from. default: "j-hc/revanced-cli"
# options like cli-source can also set per app
rv-brand = "ReVanced Extended" # rebrand from 'ReVanced' to something different. default: "ReVanced"

patches-version = "v2.160.0" # locks the patches version. default: latest available
integrations-version = "v0.95.0" # locks the integrations version. default: latest available
patches-version = "v2.160.0" # 'latest', 'dev', or a version number. default: "latest"
cli-version = "v5.0.0" # 'latest', 'dev', or a version number. default: "latest"

[Some-App]
app-name = "SomeApp" # if set, release name becomes SomeApp instead of Some-App. default is same as table name, which is 'Some-App' here.
enabled = true # whether to build the app. default: true
version = "auto" # 'auto', 'latest', 'beta' or a custom one e.g. '17.40.41'. default: auto
enabled = true # whether to build the app. default: true
build-mode = "apk" # 'both', 'apk' or 'module'. default: apk

# 'auto' option gets the latest possible version supported by all the included patches
# 'latest' gets the latest stable without checking patches support. 'beta' gets the latest beta/alpha
include-stock = true # includes stock apk in the module. default: true
build-mode = "apk" # 'both', 'apk' or 'module'. default: apk
excluded-patches = "'Some Patch' 'Some Other Patch'" # whitespace seperated list of patches to exclude. default: "" (empty)
included-patches = "'Patch something'" # whitespace seperated list of patches to include, all default patches are included by default. default: "" (empty)
exclusive-patches = false # exclude all patches by default. default: false
# whitespace seperated list of patches to exclude. default: ""
version = "auto" # 'auto', 'latest', 'beta' or a version number (e.g. '17.40.41'). default: auto

# optional args to be passed to cli. can be used to set patch options
# multiline strings in the config is supported
patcher-args = """\
-OdarkThemeBackgroundColor=#FF0F0F0F \
-Oanother-option=value \
"""

excluded-patches = """\
'Some Patch' \
'Some Other Patch' \
"""

included-patches = "'Some Patch'" # whitespace seperated list of non-default patches to include. default: ""
include-stock = true # includes stock apk in the module. default: true
exclusive-patches = false # exclude all patches by default. default: false
apkmirror-dlurl = "https://www.apkmirror.com/apk/inc/app"
uptodown-dlurl = "https://spotify.en.uptodown.com/android"
module-prop-name = "some-app-magisk" # magisk module prop name.
apkmirror-dpi = "360-480dpi" # used to select apk variant from apkmirror. default: nodpi
arch = "arm64-v8a" # 'arm64-v8a', 'arm-v7a', 'all', 'both'. 'both' downloads both arm64-v8a and arm-v7a. default: all
riplib = true # enables ripping x86 and x86_64 libs from apks with j-hc revanced cli. default: true
module-prop-name = "some-app-magisk" # magisk module prop name.
apkmirror-dpi = "360-480dpi" # used to select apk variant from apkmirror. default: nodpi
arch = "arm64-v8a" # 'arm64-v8a', 'arm-v7a', 'all', 'both'. 'both' downloads both arm64-v8a and arm-v7a. default: all
riplib = true # enables ripping x86 and x86_64 libs from apks with j-hc revanced cli. default: true

```
Binary file added bin/dexlib2.jar
Binary file not shown.
Binary file added bin/paccer.jar
Binary file not shown.
Binary file added bin/toml/tq-arm
Binary file not shown.
Binary file added bin/toml/tq-arm64
Binary file not shown.
Binary file added bin/toml/tq-x86_64
Binary file not shown.
26 changes: 13 additions & 13 deletions build-termux.sh
Original file line number Diff line number Diff line change
Expand Up @@ -26,24 +26,17 @@ until
do sleep 1; done
if [ ! -f ~/.rvmm_"$(date '+%Y%m')" ]; then
pr "Setting up environment..."
yes "" | pkg update -y && pkg install -y openssl git wget jq openjdk-17 zip
yes "" | pkg update -y && pkg install -y git curl jq openjdk-17 zip
: >~/.rvmm_"$(date '+%Y%m')"
fi
mkdir -p /sdcard/Download/revanced-magisk-module/

if [ ! -d revanced-magisk-module ]; then
pr "Cloning revanced-magisk-module."
git clone https://github.com/j-hc/revanced-magisk-module --depth 1
cd revanced-magisk-module
sed -i '/^enabled.*/d; /^\[.*\]/a enabled = false' config.toml
grep -q 'revanced-magisk-module' ~/.gitconfig 2>/dev/null \
|| git config --global --add safe.directory ~/revanced-magisk-module
else
cd revanced-magisk-module
if [ -d revanced-magisk-module ] || [ -f config.toml ]; then
if [ -d revanced-magisk-module ]; then cd revanced-magisk-module; fi
pr "Checking for revanced-magisk-module updates"
git fetch
if git status | grep -q 'is behind\|fatal'; then
pr "revanced-magisk-module already is not synced with upstream."
pr "revanced-magisk-module is not synced with upstream."
pr "Cloning revanced-magisk-module. config.toml will be preserved."
cd ..
cp -f revanced-magisk-module/config.toml .
Expand All @@ -52,10 +45,17 @@ else
mv -f config.toml revanced-magisk-module/config.toml
cd revanced-magisk-module
fi
else
pr "Cloning revanced-magisk-module."
git clone https://github.com/j-hc/revanced-magisk-module --depth 1
cd revanced-magisk-module
sed -i '/^enabled.*/d; /^\[.*\]/a enabled = false' config.toml
grep -q 'revanced-magisk-module' ~/.gitconfig 2>/dev/null ||
git config --global --add safe.directory ~/revanced-magisk-module
fi

[ -f ~/storage/downloads/revanced-magisk-module/config.toml ] \
|| cp config.toml ~/storage/downloads/revanced-magisk-module/config.toml
[ -f ~/storage/downloads/revanced-magisk-module/config.toml ] ||
cp config.toml ~/storage/downloads/revanced-magisk-module/config.toml

if ask "Open rvmm-config-gen to generate a config?"; then
am start -a android.intent.action.VIEW -d https://j-hc.github.io/rvmm-config-gen/
Expand Down
77 changes: 32 additions & 45 deletions build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,24 +10,24 @@ if [ "${1-}" = "clean" ]; then
fi

source utils.sh
set_prebuilts

vtf() { if ! isoneof "${1}" "true" "false"; then abort "ERROR: '${1}' is not a valid option for '${2}': only true or false is allowed"; fi; }

toml_prep "$(cat 2>/dev/null "${1:-config.toml}")" || abort "could not find config file '${1:-config.toml}'\n\tUsage: $0 <config.toml>"
# -- Main config --
main_config_t=$(toml_get_table "")
toml_prep "${1:-config.toml}" || abort "could not find config file '${1:-config.toml}'\n\tUsage: $0 <config.toml>"
main_config_t=$(toml_get_table_main)
COMPRESSION_LEVEL=$(toml_get "$main_config_t" compression-level) || COMPRESSION_LEVEL="9"
if ! PARALLEL_JOBS=$(toml_get "$main_config_t" parallel-jobs); then
if [ "$OS" = Android ]; then PARALLEL_JOBS=1; else PARALLEL_JOBS=$(nproc); fi
fi
DEF_PATCHES_VER=$(toml_get "$main_config_t" patches-version) || DEF_PATCHES_VER=""
DEF_INTEGRATIONS_VER=$(toml_get "$main_config_t" integrations-version) || DEF_INTEGRATIONS_VER=""
DEF_CLI_VER=$(toml_get "$main_config_t" cli-version) || DEF_CLI_VER=""
DEF_PATCHES_SRC=$(toml_get "$main_config_t" patches-source) || DEF_PATCHES_SRC="inotia00/revanced-patches"
DEF_INTEGRATIONS_SRC=$(toml_get "$main_config_t" integrations-source) || DEF_INTEGRATIONS_SRC="inotia00/revanced-integrations"
DEF_CLI_SRC=$(toml_get "$main_config_t" cli-source) || DEF_CLI_SRC="inotia00/revanced-cli"
REMOVE_RV_INTEGRATIONS_CHECKS=$(toml_get "$main_config_t" remove-rv-integrations-checks) || REMOVE_RV_INTEGRATIONS_CHECKS="true"
DEF_PATCHES_VER=$(toml_get "$main_config_t" patches-version) || DEF_PATCHES_VER="latest"
DEF_CLI_VER=$(toml_get "$main_config_t" cli-version) || DEF_CLI_VER="latest"
DEF_PATCHES_SRC=$(toml_get "$main_config_t" patches-source) || DEF_PATCHES_SRC="ReVanced/revanced-patches"
DEF_CLI_SRC=$(toml_get "$main_config_t" cli-source) || DEF_CLI_SRC="j-hc/revanced-cli"
DEF_RV_BRAND=$(toml_get "$main_config_t" rv-brand) || DEF_RV_BRAND="ReVanced eXtended"
mkdir -p $TEMP_DIR $BUILD_DIR
mkdir -p "$TEMP_DIR" "$BUILD_DIR"

if [ "${2-}" = "--config-update" ]; then
config_update
Expand All @@ -40,38 +40,30 @@ if [ "$ENABLE_MAGISK_UPDATE" = true ] && [ -z "${GITHUB_REPOSITORY-}" ]; then
pr "You are building locally. Magisk updates will not be enabled."
ENABLE_MAGISK_UPDATE=false
fi
# -----------------

if ((COMPRESSION_LEVEL > 9)) || ((COMPRESSION_LEVEL < 0)); then abort "compression-level must be within 0-9"; fi

# -- check_deps --
jq --version >/dev/null || abort "\`jq\` is not installed. install it with 'apt install jq' or equivalent"
java --version >/dev/null || abort "\`openjdk 17\` is not installed. install it with 'apt install openjdk-17-jre' or equivalent"
zip --version >/dev/null || abort "\`zip\` is not installed. install it with 'apt install zip' or equivalent"
# ----------------

rm -rf revanced-magisk/bin/*/tmp.*
get_prebuilts

set_prebuilts() {
local integrations_src=$1 patches_src=$2 cli_src=$3 integrations_ver=$4 patches_ver=$5 cli_ver=$6
local patches_dir=${patches_src%/*}
local integrations_dir=${integrations_src%/*}
local cli_dir=${cli_src%/*}
cli_ver=${cli_ver#v}
integrations_ver="${integrations_ver#v}"
patches_ver="${patches_ver#v}"
app_args[cli]=$(find "${TEMP_DIR}/${cli_dir,,}-rv" -name "revanced-cli-${cli_ver:-*}-all.jar" -type f -print -quit 2>/dev/null) && [ "${app_args[cli]}" ] || return 1
app_args[integ]=$(find "${TEMP_DIR}/${integrations_dir,,}-rv" -name "revanced-integrations-${integrations_ver:-*}.apk" -type f -print -quit 2>/dev/null) && [ "${app_args[integ]}" ] || return 1
app_args[ptjar]=$(find "${TEMP_DIR}/${patches_dir,,}-rv" -name "revanced-patches-${patches_ver:-*}.jar" -type f -print -quit 2>/dev/null) && [ "${app_args[ptjar]}" ] || return 1
app_args[ptjs]=$(find "${TEMP_DIR}/${patches_dir,,}-rv" -name "patches-${patches_ver:-*}.json" -type f -print -quit 2>/dev/null) && [ "${app_args[ptjs]}" ] || return 1
}
if [ "$(echo "$TEMP_DIR"/*-rv/changelog.md)" ]; then
: >"$TEMP_DIR"/*-rv/changelog.md || :
fi

mkdir -p ${MODULE_TEMPLATE_DIR}/bin/arm64 ${MODULE_TEMPLATE_DIR}/bin/arm ${MODULE_TEMPLATE_DIR}/bin/x86 ${MODULE_TEMPLATE_DIR}/bin/x64
gh_dl "${MODULE_TEMPLATE_DIR}/bin/arm64/cmpr" "https://github.com/j-hc/cmpr/releases/latest/download/cmpr-arm64-v8a"
gh_dl "${MODULE_TEMPLATE_DIR}/bin/arm/cmpr" "https://github.com/j-hc/cmpr/releases/latest/download/cmpr-armeabi-v7a"
gh_dl "${MODULE_TEMPLATE_DIR}/bin/x86/cmpr" "https://github.com/j-hc/cmpr/releases/latest/download/cmpr-x86"
gh_dl "${MODULE_TEMPLATE_DIR}/bin/x64/cmpr" "https://github.com/j-hc/cmpr/releases/latest/download/cmpr-x86_64"

declare -A cliriplib
idx=0
for table_name in $(toml_get_table_names); do
if [ -z "$table_name" ]; then continue; fi
t=$(toml_get_table "$table_name")
enabled=$(toml_get "$t" enabled) && vtf "$enabled" "enabled" || enabled=true
enabled=$(toml_get "$t" enabled) || enabled=true
vtf "$enabled" "enabled"
if [ "$enabled" = false ]; then continue; fi
if ((idx >= PARALLEL_JOBS)); then
wait -n
Expand All @@ -81,21 +73,15 @@ for table_name in $(toml_get_table_names); do
declare -A app_args
patches_src=$(toml_get "$t" patches-source) || patches_src=$DEF_PATCHES_SRC
patches_ver=$(toml_get "$t" patches-version) || patches_ver=$DEF_PATCHES_VER
integrations_src=$(toml_get "$t" integrations-source) || integrations_src=$DEF_INTEGRATIONS_SRC
integrations_ver=$(toml_get "$t" integrations-version) || integrations_ver=$DEF_INTEGRATIONS_VER
cli_src=$(toml_get "$t" cli-source) || cli_src=$DEF_CLI_SRC
cli_ver=$(toml_get "$t" cli-version) || cli_ver=$DEF_CLI_VER

if ! set_prebuilts "$integrations_src" "$patches_src" "$cli_src" "$integrations_ver" "$patches_ver" "$cli_ver"; then
if ! RVP="$(get_rv_prebuilts "$cli_src" "$cli_ver" "$integrations_src" "$integrations_ver" "$patches_src" "$patches_ver")"; then
abort "could not download rv prebuilts"
fi
read -r rv_cli_jar rv_integrations_apk rv_patches_jar rv_patches_json <<<"$RVP"
app_args[cli]=$rv_cli_jar
app_args[integ]=$rv_integrations_apk
app_args[ptjar]=$rv_patches_jar
app_args[ptjs]=$rv_patches_json
if ! RVP="$(get_rv_prebuilts "$cli_src" "$cli_ver" "$patches_src" "$patches_ver")"; then
abort "could not download rv prebuilts"
fi
read -r rv_cli_jar rv_patches_jar <<<"$RVP"
app_args[cli]=$rv_cli_jar
app_args[ptjar]=$rv_patches_jar
if [[ -v cliriplib[${app_args[cli]}] ]]; then app_args[riplib]=${cliriplib[${app_args[cli]}]}; else
if [[ $(java -jar "${app_args[cli]}" patch 2>&1) == *rip-lib* ]]; then
cliriplib[${app_args[cli]}]=true
Expand All @@ -106,7 +92,7 @@ for table_name in $(toml_get_table_names); do
fi
fi
if [ "${app_args[riplib]}" = "true" ] && [ "$(toml_get "$t" riplib)" = "false" ]; then app_args[riplib]=false; fi
app_args[rv_brand]=$(toml_get "$t" rv-brand) || app_args[rv_brand]="$DEF_RV_BRAND"
app_args[rv_brand]=$(toml_get "$t" rv-brand) || app_args[rv_brand]=$DEF_RV_BRAND

app_args[excluded_patches]=$(toml_get "$t" excluded-patches) || app_args[excluded_patches]=""
if [ -n "${app_args[excluded_patches]}" ] && [[ ${app_args[excluded_patches]} != *'"'* ]]; then abort "patch names inside excluded-patches must be quoted"; fi
Expand All @@ -115,6 +101,7 @@ for table_name in $(toml_get_table_names); do
app_args[exclusive_patches]=$(toml_get "$t" exclusive-patches) && vtf "${app_args[exclusive_patches]}" "exclusive-patches" || app_args[exclusive_patches]=false
app_args[version]=$(toml_get "$t" version) || app_args[version]="auto"
app_args[app_name]=$(toml_get "$t" app-name) || app_args[app_name]=$table_name
app_args[patcher_args]=$(toml_get "$t" patcher-args) || app_args[patcher_args]=""
app_args[table]=$table_name
app_args[build_mode]=$(toml_get "$t" build-mode) && {
if ! isoneof "${app_args[build_mode]}" both apk module; then
Expand Down Expand Up @@ -176,14 +163,14 @@ for table_name in $(toml_get_table_names); do
done
wait
rm -rf temp/tmp.*
if [ -z "$(ls -A1 ${BUILD_DIR})" ]; then abort "All builds failed."; fi
if [ -z "$(ls -A1 "${BUILD_DIR}")" ]; then abort "All builds failed."; fi

log "\nInstall [MicroG](https://github.com/ReVanced/GmsCore/releases) to be able to use non-root YouTube or YouTube-Music."
log "Use [zygisk-detach](https://github.com/j-hc/zygisk-detach) to block Play Store from updating YouTube and YouTube-Music."
log "\n[Main Repo](https://github.com/NoName-exe/revanced-extended)"
log "$(cat $TEMP_DIR/*-rv/changelog.md)"
log "\n[Main Repo](https://github.com/NoName-exe/revanced-extended)\n"
log "$(cat "$TEMP_DIR"/*-rv/changelog.md)"

SKIPPED=$(cat $TEMP_DIR/skipped 2>/dev/null || :)
SKIPPED=$(cat "$TEMP_DIR"/skipped 2>/dev/null || :)
if [ -n "$SKIPPED" ]; then
log "\nSkipped:"
log "$SKIPPED"
Expand Down
4 changes: 3 additions & 1 deletion config.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ patches-source = "inotia00/revanced-patches"
integrations-source = "inotia00/revanced-integrations"
cli-source = "inotia00/revanced-cli"
rv-brand = "ReVanced eXtended"
parallel-jobs = 1

# add 'enabled = false' for not patching a specific app or remove it from the config
# see https://github.com/j-hc/revanced-magisk-module/blob/main/CONFIG.md for more detailed explanations
Expand All @@ -19,11 +20,12 @@ apkmirror-dlurl = "https://www.apkmirror.com/apk/google-inc/youtube/"
module-prop-name = "yt-rvx"

[Music]
arch = "both"
build-mode = "both"
app-name = "YouTube-Music"
excluded-patches = ""
included-patches = ""
version = "auto"
apkmirror-dlurl = "https://www.apkmirror.com/apk/google-inc/youtube-music/"
module-prop-name = "ytm-rvx"
arch = "both"

17 changes: 0 additions & 17 deletions options.json

This file was deleted.

Loading

0 comments on commit 5c261c8

Please sign in to comment.