Rebar3 gpb plugin

Build Status

A rebar3 plugin for automatically compiling .proto files using the gpb protobuf compiler

Build

$ rebar3 compile

Use

Add the plugin to your rebar config:

{erl_opts, [{i, "./_build/default/plugins/gpb/include"}]}.

{plugins, [
    { rebar3_gpb_plugin, "2.13.0" }
]}.

Configure gpb options (example below), full list can consulted on gpb’s project pagegpb_compile:file/2:

{gpb_opts, [
    {i, "path/to/proto_dir"} | {i, {deps, "relative/path/from/deps/to/proto_dir"}},
    {f, ["desired_proto_file1.proto"]},
    {module_name_suffix, "_pb"},
    %{o, "path/to/out_dir"},    %% both .erl and .hrl are generated here
    {o_erl, "path/to/out_src"},
    {o_hrl, "path/to/out_include"},
    {strings_as_binaries, true},
    type_specs]}.

The i, o_erl and o_hrl option values are relative to the app’s location. Default values are:

Plugin specific options (can be used together the gpb ones):

{gpb_opts, [
    {recursive, boolean()},
    {ipath, "path/to/another/proto_dir"} | {ipath, {deps, "path/from/deps/dir/to/another/proto/dir"}}
]}.