lrascao / rebar3_gpb_plugin

A rebar3 plugin for automatically compiling .proto files using the gpb protobuf compiler
MIT License
54 stars 37 forks source link

gpb_plugin uses function that was not exported: gpb_parse:fetch_imports #125

Closed balusu-murali closed 4 years ago

balusu-murali commented 4 years ago

I am trying to use the gpb plugin with rebar3 to compile some protobufs in my erlang project. I get the following error and the compilation files. Turns, out the plugin actually uses a function that is not exported from gpb_parse.. specifically line: 165 in rebar3_gpb_compiler.erl calls gpb_parse:fetch_imports.

This function is no longer exported in the gpb project and is only present in gpb_parse_old.erl file. I tried changing the line to use gpb_parse_old module and then the compilation works fine. I wanted to check if there is a better way to solve this? Please let me know.. I can then send out a pull request to fix this issue.

@tomas-abrahamsson @lrascao any thoughts?

Stacktrace:

===> Uncaught error in rebar_core. Run with DEBUG=1 to see stacktrace or consult rebar3.crashdump
===> Uncaught error: undef
===> Stack trace to the error location:
[{gpb_parse,fetch_imports,
            [[{proto_defs_version,1},
              {file,{"auth","auth.proto"}},
              .....
              .....
               [{field,version,1,2,string,optional,[]},
{erl_opts, [
                {field,expires_in_seconds,2,3,int64,optional,[]}]},
              {proto3_msgs,[]}]],
            []},
 {rebar3_gpb_compiler,filter_included_proto,3,
                      [{file,"_build/default/plugins/rebar3_gpb_plugin/src/rebar3_gpb_compiler.erl"},
                       {line,165}]},
 {lists,filtermap,2,[{file,"lists.erl"},{line,1317}]},
 {rebar3_gpb_compiler,compile,4,
                      [{file,"_build/default/plugins/rebar3_gpb_plugin/src/rebar3_gpb_compiler.erl"},
                       {line,128}]},
 {rebar3_gpb_compiler,compile,2,
                      [{file,"_build/default/plugins/rebar3_gpb_plugin/src/rebar3_gpb_compiler.erl"},
                       {line,68}]},
 {lists,foreach,2,[{file,"lists.erl"},{line,1338}]},
 {rebar3_gpb_prv_compile,do,1,
                         [{file,"_build/default/plugins/rebar3_gpb_plugin/src/rebar3_gpb_prv_compile.erl"},
                          {line,47}]},
 {rebar_core,do,2,
             [{file,"/tmp/cirrus-ci-build/src/rebar_core.erl"},{line,154}]}]
===> When submitting a bug report, please include the output of `rebar3 report "your command"`
make: *** [src] Error 1
lrascao commented 4 years ago

can you please try out 2.16.1? it should fix the issue

balusu-murali commented 4 years ago

yes, that works well. thank you for getting back quickly.