I have a set of protobuf types, and I want to generate reasonML code for serialization. What I've found so far is ocaml-protoc which fails to install on my system. Using docker,
FROM ocaml/opam:alpine
RUN opam remote add dev git://github.com/mirage/mirage-dev
RUN opam depext -i mirage
RUN opam depext conf-m4.1
RUN yes | opam install ocaml-protoc
then running the command:
docker run \
--mount type=bind,source=$(PWD)/../src/proto,target=/home/opam/ocaml \
--mount type=bind,source="$(PWD)"/../../proto,target=/home/opam/proto \
-ti eb1b1ed36a35 \
ocaml-protoc -ml_out=/home/opam/ocaml /home/opam/proto/chat.proto > /dev/null"
I've been able to compile a set of ml/mli files. However these files depend on some uninstalled libs such as Pbrt
. Excerpt:
let rec decode_friend_event_etype d =
match Pbrt.Decoder.int_as_varint d with
| 0 -> (Chat_types.Arrival:Chat_types.friend_event_etype)
| 1 -> (Chat_types.Departure:Chat_types.friend_event_etype)
| _ -> Pbrt.Decoder.malformed_variant "friend_event_etype"
--------------^
Is there a clean way to solve this problem without installing any native libs? Whatever is included has to be provided source in order for bucklescript to be able to compile it into JS.
The solution that comes to mind were it available would be to generate the common dependencies (such as Pbrt) along with the proto implementations. Has anyone found a way to solve this problem?