frostfs-api-go/prepare.sh

37 lines
664 B
Bash
Raw Normal View History

2020-08-13 13:23:13 +00:00
#!/bin/bash
prefix=v2
if [ -z "$1" ]; then
echo "usage: ./prepare.sh path/to/neofs-api"
exit 1
fi
API_GO_PATH=$(pwd)
API_PATH=$1
2020-08-13 13:23:13 +00:00
mkdir $API_GO_PATH/$prefix 2>/dev/null
# MOVE FILES FROM API REPO
cd $API_PATH
ARGS=$(find ./ -name '*.proto' -not -path './vendor/*')
for file in $ARGS; do
dir=$(dirname $file)
2020-08-13 13:23:13 +00:00
cp -r $dir $API_GO_PATH/$prefix
done
# MODIFY FILES
2020-08-13 13:39:10 +00:00
cd $API_GO_PATH/$prefix
for file in $ARGS; do
2020-08-13 13:39:10 +00:00
sed -i "s/import\ \"\(.*\)\";/import\ \"$prefix\/\1\";/" $file
done
2020-08-13 13:39:10 +00:00
cd $API_GO_PATH
# COMPILE
make protoc
2020-08-13 13:39:10 +00:00
# REMOVE PROTO DEFINITIONS
ARGS=$(find ./ -name '*.proto' -not -path './vendor/*')
for file in $ARGS; do
rm $file
done