View Source mix protobuf.generate (protobuf_generate v0.2.0)
Generate Elixir code from .proto files.
Arguments
file- One or more.protofiles to compile
Required options
--output-path- Path to output directory
Optional options
--include-path- Specify the directory in which to search for imports. Eqvivalent toprotoc-Iflag.--tranform-module- Module to do custom encoding/decoding for messages. SeeProtobuf.TransformModulefor details.--package-prefix- Prefix generated Elixir modules. For example prefix modules with:MyApp.Protosuse--package-prefix=my_app.protos.--generate-descriptors- Includes raw descriptors in the generated modules--one-file-per-module- Changes the way files are generated into directories. This option creates a file for each generated Elixir module.--include-documentation- Controls visibility of documentation of the generated modules. Settingtruewill not have@moduleoc false--plugin- If you write services in protobuf, you can generate gRPC code by passing--plugin=grpc.
Examples
$ mix protobuf.generate --output-path=./lib --include-path=./priv/protos helloworld.proto
$ mix protobuf.generate --include-path=priv/proto --include-path=deps/googleapis --generate-descriptors=true --output-path=./lib --plugin=ProtobufGenerate.Plugins.GRPC
google/api/annotations.proto google/api/http.proto helloworld.proto