memgraph/tools/lcp
Matej Ferencevic 5c244c1ad4 Remove Cap'n Proto
Summary:
There will be a lot of leftover files, execute the following commands inside
`src/` to remove them:
```
git clean -xf
rm -r rpc/ storage/single_node_ha/rpc/
```

Reviewers: teon.banek

Reviewed By: teon.banek

Subscribers: pullbot

Differential Revision: https://phabricator.memgraph.io/D2011
2019-05-08 10:51:10 +02:00

42 lines
987 B
Bash
Executable File

#!/bin/bash -e
if [[ $# -ne 1 && $# -ne 2 ]]; then
echo "Usage: $0 LCP_FILE"
echo "Convert a LCP_FILE to C++ header file and output to stdout."
echo "If SLK_SERIALIZE is provided, then SLK serialization is generated."
exit 1
fi
if [[ ! -r "$1" ]]; then
echo "File '$1' doesn't exist or isn't readable"
exit 1
fi
lcp_file=`realpath $1`
script_dir="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
quicklisp_install_dir="$HOME/quicklisp"
if [[ -v QUICKLISP_HOME ]]; then
quicklisp_install_dir="${QUICKLISP_HOME}"
fi
slk_serialize=""
if [[ "$2" == "SLK_SERIALIZE" ]]; then
slk_serialize=":slk-serialize t"
fi
echo \
"
(load \"${quicklisp_install_dir}/setup.lisp\")
(ql:quickload :lcp :silent t)
(lcp:process-file \"$lcp_file\" $slk_serialize)
" | sbcl --script
filename=`basename $lcp_file .lcp`
hpp_file="$(dirname $lcp_file)/$filename.hpp"
clang-format -style=file -i $hpp_file
if [[ -w "$lcp_file.cpp" ]]; then
clang-format -style=file -i "$lcp_file.cpp"
fi