From c0a76ad36e463e3e726a7a415b57ee2a079a2720 Mon Sep 17 00:00:00 2001 From: Evgenii Kozlov Date: Fri, 26 Jan 2024 18:03:03 +0100 Subject: [PATCH] DROID-2036 App | Tech | Script for downloading custom MW builds (#800) --- Makefile | 8 ++++- scripts/mw/update-mw-custom.sh | 54 ++++++++++++++++++++++++++++++++++ 2 files changed, 61 insertions(+), 1 deletion(-) create mode 100755 scripts/mw/update-mw-custom.sh diff --git a/Makefile b/Makefile index 624df0ff19..df4e43adad 100644 --- a/Makefile +++ b/Makefile @@ -34,8 +34,14 @@ setup_local_mw: download_mw_artefacts: ./scripts/mw/update-mw.sh +download_mw_artefacts_custom: + ./scripts/mw/update-mw-custom.sh + normalize_mw_imports: ./scripts/mw/normalize-imports.sh # Update mw when new release is ready -update_mw: download_mw_artefacts normalize_mw_imports \ No newline at end of file +update_mw: download_mw_artefacts normalize_mw_imports + +# Update mw from custom build (download only library, you have to update your proto files manually) +update_mw_custom: download_mw_artefacts_custom \ No newline at end of file diff --git a/scripts/mw/update-mw-custom.sh b/scripts/mw/update-mw-custom.sh new file mode 100755 index 0000000000..e62a5cafd0 --- /dev/null +++ b/scripts/mw/update-mw-custom.sh @@ -0,0 +1,54 @@ +#!/usr/bin/env bash + +REPO="anyproto/anytype-heart" +FILE="lib.aar" + +echo "Enter custom MW build name:" + +read -r MW_VERSION + +if [ "$MW_VERSION" = "" ]; then + echo "ERROR: mw version is empty" + exit 1 +fi; + +echo "Enter your github token (you probably have in github.properties file in the project root folder):" + +read -r GITHUB_TOKEN + +if [ "$GITHUB_TOKEN" = "" ]; then + echo "ERROR: github token is empty" + exit 1 +fi; + +URL="https://maven.pkg.github.com/anyproto/anytype-heart/io.anyproto/anytype-heart-android/${MW_VERSION}/anytype-heart-android-${MW_VERSION}.aar" + +echo + +echo "Downloading URL: $URL" + +echo + +curl "${URL}" \ + -H "Authorization: Bearer $GITHUB_TOKEN" -L --fail > $FILE + +if [ "$?" -gt 0 ] +then + echo + echo "Error downloading file. Exiting." + exit +fi + echo + echo "Done downloading!" + + echo + + mv lib.aar libs/ + + echo "What you need to do next:" + echo + echo "1. Make sure to update mw version with your custom build version in libs.versions.toml!" + echo "2. Make sure to update custom proto files!" + echo "3. Make sure to run make setup_local_mw in your terminal!" + echo + echo "Script finished." \ No newline at end of file