Skip to content

Commit

Permalink
idl: fix recompile_thrift.sh & script: add format_files.sh (#205)
Browse files Browse the repository at this point in the history
  • Loading branch information
HuangWei authored and Wu Tao committed Nov 2, 2018
1 parent be693f9 commit 2544463
Show file tree
Hide file tree
Showing 4 changed files with 1,318 additions and 1,248 deletions.
19 changes: 19 additions & 0 deletions scripts/format_files.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
#!/bin/bash

pwd="$( cd "$( dirname "$0" )" && pwd )"
root_dir="$( cd $pwd/.. && pwd )"
cd $root_dir

linenoise=./src/shell/linenoise
sds=./src/shell/sds

if [ $# -eq 0 ]; then
echo "formating all .h/.cpp files in $root_dir ..."
find . -type f -not \( -wholename "$linenoise/*" -o -wholename "$sds/*" -o -wholename "./rocksdb/*" \) -regextype posix-egrep -regex ".*\.(cpp|h)" | xargs clang-format -i -style=file
elif [ $1 = "-h" ]; then
echo "USAGE: ./format-files.sh [<relative_path>] -- format .h/.cpp files in $root_dir/relative_path"
echo " ./format-files.sh means format all .h/.cpp files in $root_dir"
else
echo "formating all .h/.cpp files in $root_dir/$1 ..."
find ./$1 -type f -not \( -wholename "$linenoise/*" -o -wholename "$sds/*" -o -wholename "./rocksdb/*" \) -regextype posix-egrep -regex ".*\.(cpp|h)" | xargs clang-format -i -style=file
fi
10 changes: 5 additions & 5 deletions src/idl/recompile_thrift.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
#!/bin/bash
# recommand thrift-0.9.3

cd `dirname $0`
DSN_ROOT=../../rdsn

if [ ! -d "$DSN_ROOT" ]; then
echo "ERROR: DSN_ROOT not set"
exit 1
Expand All @@ -10,11 +13,8 @@ TMP_DIR=./tmp
rm -rf $TMP_DIR

mkdir -p $TMP_DIR
sh $DSN_ROOT/bin/dsn.cg.sh rrdb.thrift cpp $TMP_DIR
cp -v $TMP_DIR/rrdb.types.h ../include/rrdb/
#cp -v $TMP_DIR/rrdb.code.definition.h ../include/rrdb/
#cp -v $TMP_DIR/rrdb.client.h ../include/rrdb/
#sed 's/# include "rrdb.code.definition.h"/# include <rrdb\/rrdb.code.definition.h>/' $TMP_DIR/rrdb.server.h > ../include/rrdb/rrdb.server.h
$DSN_ROOT/bin/Linux/thrift --gen cpp:moveable_types -out $TMP_DIR rrdb.thrift

sed 's/#include "dsn_types.h"/#include <dsn\/service_api_cpp.h>/' $TMP_DIR/rrdb_types.h > ../include/rrdb/rrdb_types.h
sed 's/#include "rrdb_types.h"/#include <rrdb\/rrdb_types.h>/' $TMP_DIR/rrdb_types.cpp > ../base/rrdb_types.cpp

Expand Down
4 changes: 1 addition & 3 deletions src/server/test/pegasus_server_write_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -51,9 +51,7 @@ class pegasus_server_write_test : public pegasus_server_test_base
for (int i = put_rpc_cnt; i < total_rpc_cnt; i++) {
writes[i] = pegasus::create_remove_request(key);
}
auto cleanup = dsn::defer([=]() {
delete[] writes;
});
auto cleanup = dsn::defer([=]() { delete[] writes; });

int err =
_server_write->on_batched_write_requests(writes, total_rpc_cnt, decree, 0);
Expand Down
Loading

0 comments on commit 2544463

Please sign in to comment.