2020-08-13 13:23:13 +00:00
|
|
|
#!/bin/bash
|
2020-08-12 09:49:11 +00:00
|
|
|
|
2021-11-12 08:47:56 +00:00
|
|
|
if [ -z "$1" ]; then
|
2022-12-09 10:41:35 +00:00
|
|
|
echo "usage: ./prepare.sh path/to/frostfs-api"
|
2020-08-12 09:49:11 +00:00
|
|
|
exit 1
|
2021-11-12 08:47:56 +00:00
|
|
|
fi
|
2020-08-12 09:49:11 +00:00
|
|
|
|
|
|
|
API_GO_PATH=$(pwd)
|
2021-11-12 08:47:56 +00:00
|
|
|
API_PATH=$1
|
2020-08-12 09:49:11 +00:00
|
|
|
|
|
|
|
# MOVE FILES FROM API REPO
|
2021-11-12 08:47:56 +00:00
|
|
|
cd "$API_PATH" || exit 1
|
2024-08-08 15:02:30 +00:00
|
|
|
ARGS=$(find ./ -name '*.proto' -not -path './bin/*')
|
2020-08-12 09:49:11 +00:00
|
|
|
for file in $ARGS; do
|
2021-11-12 08:47:56 +00:00
|
|
|
dir=$(dirname "$file")
|
2021-11-17 09:35:56 +00:00
|
|
|
mkdir -p "$API_GO_PATH/$dir/grpc"
|
|
|
|
cp -r "$dir"/* "$API_GO_PATH/$dir/grpc"
|
2020-08-12 09:49:11 +00:00
|
|
|
done
|
|
|
|
|
|
|
|
# MODIFY FILES
|
2021-11-17 09:35:56 +00:00
|
|
|
cd "$API_GO_PATH" || exit 1
|
2024-08-08 15:02:30 +00:00
|
|
|
ARGS2=$(find ./ -name '*.proto' -not -path './bin/*')
|
2020-08-14 16:00:16 +00:00
|
|
|
for file in $ARGS2; do
|
2021-11-12 08:47:56 +00:00
|
|
|
echo "$file"
|
2021-11-17 09:35:56 +00:00
|
|
|
sed -i "s/import\ \"\(.*\)\/\(.*\)\.proto\";/import\ \"\1\/grpc\/\2\.proto\";/" $file
|
2020-08-12 09:49:11 +00:00
|
|
|
done
|
|
|
|
|
2021-11-12 08:47:56 +00:00
|
|
|
cd "$API_GO_PATH" || exit 1
|
2020-08-12 09:49:11 +00:00
|
|
|
# COMPILE
|
|
|
|
make protoc
|
|
|
|
|
2020-08-13 13:39:10 +00:00
|
|
|
# REMOVE PROTO DEFINITIONS
|
2024-08-08 15:02:30 +00:00
|
|
|
ARGS=$(find ./$prefix -name '*.proto' -not -path './util/*' -not -path './bin/*')
|
2020-08-13 13:39:10 +00:00
|
|
|
for file in $ARGS; do
|
2021-11-12 08:47:56 +00:00
|
|
|
rm "$file"
|
2020-08-13 13:39:10 +00:00
|
|
|
done
|