2020-08-13 13:23:13 +00:00
|
|
|
#!/bin/bash
|
2020-08-12 09:49:11 +00:00
|
|
|
|
|
|
|
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
|
2020-08-12 09:49:11 +00:00
|
|
|
|
|
|
|
# MOVE FILES FROM API REPO
|
|
|
|
cd $API_PATH
|
2020-08-12 10:19:59 +00:00
|
|
|
ARGS=$(find ./ -name '*.proto' -not -path './vendor/*')
|
2020-08-12 09:49:11 +00:00
|
|
|
for file in $ARGS; do
|
|
|
|
dir=$(dirname $file)
|
2020-08-13 13:23:13 +00:00
|
|
|
cp -r $dir $API_GO_PATH/$prefix
|
2020-08-12 09:49:11 +00:00
|
|
|
done
|
2020-08-13 13:23:13 +00:00
|
|
|
cd $API_GO_PATH/$prefix
|
2020-08-12 09:49:11 +00:00
|
|
|
|
|
|
|
# MODIFY FILES
|
|
|
|
for file in $ARGS; do
|
2020-08-13 13:23:13 +00:00
|
|
|
sed -i "s/import\ \"\(.*\)\";/import\ \"$prefix\/\1\";/" $file
|
2020-08-12 09:49:11 +00:00
|
|
|
done
|
|
|
|
|
|
|
|
# COMPILE
|
|
|
|
make protoc
|
|
|
|
|
|
|
|
# REMOVE PROTO FILES
|
|
|
|
# TO BE DONE AS NEOFS-API WILL BE STABLE
|