Created
July 29, 2012 02:53
-
-
Save bookshelfdave/3195858 to your computer and use it in GitHub Desktop.
R O C
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
git clone [email protected]:basho/riak_pb.git | |
cd src | |
rm -f *.proto | |
rm -f *.piqi | |
rm -f *.cm* | |
cp ../riak_pb/src/*.proto ./ | |
piqi of-proto riak.proto | |
piqi of-proto riak_kv.proto | |
piqi of-proto riak_search.proto | |
cat riak.piqi.additions >> riak.proto.piqi | |
# rename done to isdone. "done" is a keyword in OCaml | |
sed -i.orig -e"s/\.name done/\.name isdone \.proto-name \"done\""/ riak_kv.proto.piqi | |
piqic ocaml --pp riak.proto.piqi | |
piqic ocaml --pp riak_kv.proto.piqi | |
piqic ocaml --pp riak_search.proto.piqi | |
ocamlfind ocamlc -package piqi.runtime -c riak_piqi.ml | |
ocamlfind ocamlc -package piqi.runtime -c riak_kv_piqi.ml | |
ocamlfind ocamlc -package piqi.runtime -c riak_search_piqi.ml | |
ocamlfind ocamlc -o foo -package Unix -package piqi.runtime -linkpkg riak_piqi.cmo riak.ml |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
(piqi author here) There's a better way to handle names that conflict with OCaml keywords. Instead of using sed, you can add an extension module named
riak_kv.ocaml.piqi
with the following lines:This module will be included automatically by
piqic ocaml
and it will add OCaml-specific names to the existing definitions.The complete example is available here. Note that it requires the latest version from "dev" branch.