-
Notifications
You must be signed in to change notification settings - Fork 0
/
generate-evmos-buf-local.sh
executable file
·41 lines (38 loc) · 1.25 KB
/
generate-evmos-buf-local.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
#!/bin/bash
verify_installation() {
if !command -v $1 &> /dev/null
then
echo "$1 could not be found. Install it before continue"
exit
else
echo "$1 installed"
fi
}
echo "Verifying dependencies..."
verify_installation go
echo "$(go version)"
verify_installation git
echo "$(git --version)"
verify_installation buf
echo "$(buf --version)"
verify_installation protobuf
echo "$(protoc --version)"
verify_installation swift-protobuf
echo "$(protoc-gen-swift --version)"
verify_installation grpc-swift
echo "$(protoc-gen-grpc-swift --version)"
echo "Code generation started..."
evmos_commit_hash=c66c6f141d044e31a4ae77f5b852bcb5 # 11.0.2 -> https://buf.build/evmos/evmos
code=./Sources/CosmosSDK/Evmos
protos_output=./Sources/CosmosSDK/Evmos/protobufs
rm -r $code*
echo "Deleted swift code from directory: $code"
buf export buf.build/evmos/evmos:$evmos_commit_hash --output $protos_output
echo "Downloaded evmos-sdk with hash: $evmos_commit_hash to directory: $protos_output"
cd $protos_output
buf generate --template ../../../../buf-local.gen.yaml --output . --verbose
cp -R gen/evmos_*.swift ../.
echo "Generated swift code and copied to directory: $code"
cd ..
rm -r ./protobufs
echo "Deleted evmos-sdk download directory: $protos_output"