1
0
Fork 0
mirror of https://github.com/anyproto/anytype-kotlin.git synced 2025-06-08 05:47:05 +09:00

DROID-1218 Protocol | Enhancement | MW v0.26.0-rc11 + scripts for updating / downloading mw artefacts (#3126)

This commit is contained in:
Evgenii Kozlov 2023-04-26 16:57:42 +02:00 committed by uburoiubu
parent dfd04c4b42
commit d62835294f
No known key found for this signature in database
GPG key ID: C8FB80E0A595FBB6
11 changed files with 76 additions and 154 deletions

View file

@ -1,7 +1,9 @@
#!/usr/bin/env bash
cd ..
cd ..
echo -n "Starting script for normalizing imports"
echo -n "Normalizing imports... "
cd protocol/src/main/proto/ || exit
sed -i '' 's/pkg\/lib\/pb\/model\/protos\///g' events.proto
@ -16,3 +18,10 @@ sed -i '' 's/pb\/protos\///g' changes.proto
sed -i '' 's/pkg\/lib\/pb\/model\/protos\///g' localstore.proto
sed -i '' 's/pb\/protos\///g' localstore.proto
sed -i '' 's/pkg\/lib\/pb\/model\/protos\///g' snapshot.proto
sed -i '' 's/pb\/protos\///g' snapshot.proto
echo -n "Done normalizing imports."
echo -n ">>> Make sure to update mw version in libs.versions.toml >>>"

68
scripts/mw/update-mw.sh Executable file
View file

@ -0,0 +1,68 @@
#!/usr/bin/env bash
REPO="anytypeio/go-anytype-middleware"
FILE="lib.tar.gz"
GITHUB="api.github.com"
echo "Enter your github token (check your github.properties file)"
read -r TOKEN
if [ "$TOKEN" = "" ]; then
echo "ERROR: token is empty"
exit 1
fi;
echo "Enter MW version without any prefix (for instance: 0.26.0)"
read -r MW_VERSION
if [ "$MW_VERSION" = "" ]; then
echo "ERROR: mw version is empty"
exit 1
fi;
version=`curl -H "Authorization: token $TOKEN" -H "Accept: application/vnd.github.v3+json" -sL https://$GITHUB/repos/$REPO/releases/tags/v$MW_VERSION | jq .`
tag=`echo $version | jq ".tag_name"`
asset_id=`echo $version | jq ".assets | map(select(.name | match(\"android_lib_\";\"i\")))[0].id"`
if [ "$asset_id" = "" ]; then
echo "ERROR: version not found"
exit 1
fi;
printf "Version: $tag\n"
printf "Found asset: $asset_id\n"
echo -n "Downloading file... "
curl -sL -H 'Accept: application/octet-stream' https://$TOKEN:@$GITHUB/repos/$REPO/releases/assets/$asset_id > $FILE
printf "Done\n"
echo -n "Uncompressing... "
mkdir /tmp/lib
tar -zxf $FILE -C /tmp/lib/
printf "Done\n"
printf "Preparing files\n"
# Moving proto files to protocol module
mkdir -p libs/protobuf/protos
mv /tmp/lib/protobuf/protos/* protocol/src/main/proto
# Clearing temp folder
rm -rf /tmp/lib
rm -rf $FILE
# For Android app internal usage, we don't need the following protos:
rm -rf protocol/src/main/proto/service.proto
rm -rf protocol/src/main/proto/block.proto
rm -rf protocol/src/main/proto/file.proto
rm -rf protocol/src/main/proto/snapshot.proto
rm -rf protocol/src/main/proto/migration.proto
echo "Done with downloading protobuf files!"
echo ">>> Make sure to update mw version to version $tag in libs.versions.toml >>>"