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

@ -27,12 +27,12 @@ jobs:
RELEASE_STORE_PWD: ${{ secrets.RELEASE_STORE_PWD }}
run: ./scripts/release/setup-store.sh $token_secret $RELEASE_KEY_ALIAS $RELEASE_KEY_PWD $RELEASE_STORE_PWD
- name: Setup license repository
uses: actions/checkout@master
with:
repository: anytypeio/open
ref: refs/heads/main
path: ./open
- uses: actions/checkout@master
with:
name: Setup license repository
repository: anytypeio/open
ref: refs/heads/main
path: ./open
- name: Check licenses
run: |

View file

@ -12,9 +12,6 @@ distribute_debug:
pr_check: compile_android_test_sources test_debug_all
setup_local_mw:
./gradlew libs:publishToMavenLocal
enable_analytics_for_debug:
sed -i -e 's/config.enableAnalyticsForDebugBuilds=false/config.enableAnalyticsForDebugBuilds=true/g' analytics/gradle.properties
@ -25,4 +22,20 @@ encryption:
./scripts/common/encrypt.sh
decryption:
./scripts/common/decrypt.sh
./scripts/common/decrypt.sh
# MIDDLEWARE INTEGRATION
# Use this only for custom (not yet released) middleware library.
setup_local_mw:
./gradlew libs:publishToMavenLocal
download_mw_artefacts:
./scripts/mw/update-mw.sh
normalize_mw_imports:
./scripts/mw/normalize-imports.sh
# Update mw when new release is ready
update_mw: download_mw_artefacts normalize_mw_imports

View file

@ -80,4 +80,15 @@ application*
```
com.anytype.ci=true - for CI/CD pipeline
```
```
### Updating MW (basics)
1. Run the following command in Terminal or Makefile:
```
make update_mw
```
2. Make sure your proto files located in `protocol/main/proto/` compile.
3. Make sure to update `middlewareVersion` version in `libs.versions.toml`.

View file

@ -1,5 +1,5 @@
[versions]
middlewareVersion = "v0.26.0-rc10"
middlewareVersion = "v0.26.0-rc11"
kotlinVersion = '1.7.10'
androidxCoreVersion = "1.9.0"
androidxComposeVersion1 = '1.3.1'

View file

@ -1,16 +0,0 @@
syntax = "proto3";
package anytype.storage;
import "file.proto";
import "google/protobuf/struct.proto";
import "models.proto";
option go_package = "pkg/lib/pb/storage";
message SmartBlockSnapshot {
map<string, uint64> state = 1;
repeated anytype.model.Block blocks = 2;
google.protobuf.Struct details = 3;
map<string, FileKeys> keysByHash = 4;
int64 clientTime = 5;
}

View file

@ -527,6 +527,7 @@ message Rpc {
option (no_auth) = true;
string path = 1;
string rootPath = 2;
int64 icon = 3;
}
message Response {

View file

@ -1,63 +0,0 @@
syntax = "proto3";
package anytype.storage;
option go_package = "pkg/lib/pb/storage";
import "google/protobuf/struct.proto";
message Step {
string name = 1;
Link link = 2;
}
message FileKeys {
map<string,string> keysByPath = 1;
}
message FileInfo {
string mill = 1;
string checksum = 2;
string source = 3;
string opts = 4;
string hash = 5;
string key = 6;
string media = 7;
string name = 8;
int64 size = 9;
int64 added = 10;
google.protobuf.Struct meta = 11;
repeated string targets = 12;
EncryptionMode encMode = 13;
string metaHash = 14;
enum EncryptionMode {
AES_GCM = 0;
AES_CFB = 1;
}
}
message Directory {
map<string, FileInfo> files = 1;
}
message DirectoryList {
repeated Directory items = 1;
}
message Node {
string name = 1;
bool pin = 2;
bool plaintext = 3;
string mill = 4;
map<string, string> opts = 5;
google.protobuf.Struct json_schema = 6;
map<string, Link> links = 8;
}
message Link {
string use = 1;
bool pin = 2;
bool plaintext = 3;
string mill = 4;
map<string, string> opts = 5;
google.protobuf.Struct json_schema = 6;
}

View file

@ -1,18 +0,0 @@
syntax = "proto3";
package anytype;
option go_package = "pb";
import "models.proto";
import "changes.proto";
message MigrationObject {
anytype.model.SmartBlockType sbType = 1;
anytype.Change.Snapshot snapshot = 2;
}
message Profile {
string mnemonic = 1;
string name = 2;
string avatar = 3;
string address = 4;
}

View file

@ -1,19 +0,0 @@
syntax = "proto3";
package anytype;
option go_package = "pb";
import "models.proto";
import "changes.proto";
message SnapshotWithType {
anytype.model.SmartBlockType sbType = 1;
anytype.Change.Snapshot snapshot = 2;
}
message Profile {
string name = 1;
string avatar = 2;
string address = 4;
string spaceDashboardId = 5;
string profileId = 6;
}

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 >>>"

View file

@ -1,21 +1,29 @@
#!/usr/bin/env bash
TOKEN=$1
PROPERTY_PATH="middleware.path"
PROPERTY_VERSION="middleware.version"
LIBRARY_PATH="libs/lib.aar"
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;
version=`curl -H "Authorization: token $TOKEN" -H "Accept: application/vnd.github.v3+json" -sL https://$GITHUB/repos/$REPO/releases | jq ".[0]"`
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"`
@ -39,26 +47,22 @@ printf "Done\n"
printf "Preparing files\n"
mkdir -p libs/io/anytype/middleware-library/1.0.0/
mv /tmp/lib/lib.aar libs/io/anytype/middleware-library/1.0.0/middleware-library-1.0.0.aar
# 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
printf "Done with downloading the library!"
# 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 "Creating configuration file..."
echo "Done with downloading protobuf files!"
rm -rf configuration.properties
touch configuration.properties
echo "$PROPERTY_PATH=$LIBRARY_PATH" >>configuration.properties
echo "$PROPERTY_VERSION=$tag" >>configuration.properties
echo Configuration file has been successfully created. It contains following properties:
cat configuration.properties
echo Update finished.
echo Now you can rebuild your project. Good luck!
echo ">>> Make sure to update mw version to version $tag in libs.versions.toml >>>"