Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

idl: fix recompile_thrift.sh & script: add format_files.sh #205

Merged
merged 5 commits into from
Nov 2, 2018
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
8 changes: 4 additions & 4 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
$DSN_ROOT/bin/Linux/thrift --gen cpp:moveable_types -out $TMP_DIR rrdb.thrift
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
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