rebar/rebar — pull request #203 by tomas-abrahamsson (2013-12-22 00:41:25+00:00)
Title: Pluggable proto compilers gpb

Hi, this pull request adds support for the `gpb` (https://github.com/tomas-abrahamsson/gpb) as a compiler for Google protocol buffers (`*.proto` files). A new config option, `proto_compiler`, is used to select which compiler to use, the `protobuffs` is the default, for backwards compatibility reasons.

The pull request is divided into two commits: the first commit introduces a plugin mechanism for protocol buffer compilers and the `protobuffs` compiler is turned into a plugin, the second commit adds a plugin for the `gpb` protocol buffer compiler.

Such a plugin is a module that implements the functions `proto_compile/3`, `proto_clean/3`, `proto_info/2` and `key/0`. This is very similar to how other compiler modules are plugged in, but on a sub-level.

I couldn't find any other rebar compiler that supported alternative implementations, from which I could borrow ideas, so I had to find some sensible way to go. Hope this is reasonable.

BRs
Tomas