basho/erlang_protobuffs — pull request #69 by UglyTroLL (2014-08-14 02:14:00+00:00)
Title: Compile protobuf files with duplicate imports.

For example, a.proto imports 'b.proto' and 'c.proto' and b.proto imports 'c.proto' as well, which is a valid case. But when try to compile a.proto, the compiler will complain about something like '{32,erl_lint,{redefine_record,c}}' and '{26,erl_lint,{duplicated_export,{decode_c,1}}}' followed by compilation failure.
### e.g.
- a.proto
```
import "b.proto";
import "c.proto";

message A {
optional int32 aa = 1;
}
```
- b.proto
```
import "c.proto";

message B {
optional int32 bb = 1;
}
```
- c.proto
```
message C {
optional int32 cc = 1;
}
```
could not be compiled with error message:
```
=INFO REPORT==== 13-Aug-2014::18:16:02 ===
Writing header file to "a_pb.hrl"
** exception error: no match of right hand side value {error,[{"src/a_pb.erl",
[{32,erl_lint,{redefine_record,c}},
{32,erl_lint,{redefine_record,cc}},
{42,erl_lint,{redefine_function,{encode_c,1}}},
{42,erl_lint,{redefine_function,{encode_cc,1}}},
{110,erl_lint,{redefine_function,{decode_c,1}}},
{110,erl_lint,{redefine_function,{decode_cc,1}}},
{113,erl_lint,{redefine_function,{delimited_decode_c,1}}},
{113,erl_lint,
{redefine_function,{delimited_decode_cc,1}}}]}],
[{"src/a_pb.erl",
[{26,erl_lint,{duplicated_export,{decode_c,1}}},
{26,erl_lint,{duplicated_export,{decode_cc,1}}},
{26,erl_lint,{duplicated_export,{delimited_decode_c,1}}},
{26,erl_lint,{duplicated_export,{delimited_decode_cc,1}}},
{26,erl_lint,{duplicated_export,{encode_c,1}}},
{26,erl_lint,{duplicated_export,{encode_cc,1}}}]}]}
in function protobuffs_compile:output/4 (src/protobuffs_compile.erl, line 155)
```