forked from basho/riak-go-client
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
e59a821
commit 9929d75
Showing
3 changed files
with
48 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
#!/usr/bin/env bash | ||
|
||
set -o errexit | ||
set -o nounset | ||
|
||
if ! hash protoc 2>&1 >/dev/null | ||
then | ||
echo "protoc command must be in PATH." | ||
exit 1 | ||
fi | ||
|
||
declare -r projdir="${1:-unknown_projdir}" | ||
if [[ ! -d $projdir ]] | ||
then | ||
echo "First argument must be project directory." 2>&1 | ||
exit 1 | ||
fi | ||
|
||
declare -r rpb_path="$projdir/rpb" | ||
declare -r proto_path="$projdir/riak_pb/src" | ||
if [[ ! -d $proto_path ]] | ||
then | ||
echo "Could not find $proto_path." 2>&1 | ||
exit 1 | ||
fi | ||
|
||
for proto_file in $proto_path/*.proto | ||
do | ||
proto_file_basename="$(basename -s '.proto' $proto_file)" | ||
rpb_path_tmp="$rpb_path/$proto_file_basename" | ||
|
||
protoc --go_out="$rpb_path_tmp" --proto_path="$proto_path" "$proto_file" | ||
|
||
rpb_file="$rpb_path_tmp/$proto_file_basename.pb.go" | ||
|
||
sed -i 's/^import proto.*/import proto "github.com\/golang\/protobuf\/proto"/g' "$rpb_file" | ||
|
||
if [[ $proto_file_basename == 'riak_search' || $proto_file_basename == 'riak_kv' ]] | ||
then | ||
sed -i 's/^import riak.*/import riak "github.com\/basho\/riak-go-client\/rpb\/riak"/g' "$rpb_file" | ||
fi | ||
done |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters