Giter Club home page Giter Club logo

protoc-gen-erlang's Introduction

This is a plug module for google’s protoc to produce erlang code. Currently it’s only tested on Ubuntu 10.10 using libprotoc 2.4.1 and Erlang R14, but there’s nothing in any of it that should preclude different versions or compilation on Windows.

Features

  • Nested messages and enums within Erlang.
  • Default values.
  • Encoding and decoding packed repeated fields.
  • Supports all protobuf language specs.
  • Triq based testing.

Installation

Install development versions of protoc. I compiled from source. The makefile shows how to compile and run the code.

Key points:

  • protoc-gen-erlang and protoc have to be in the path.
  • —erlang-out should point the base directory of a standard OTP app and will create files in include, src, and optionally test.
  • —erlang-out=triq_tests:$DIR will create triq based tests to check round trip encode/decode of messages, as well as exported domain functions for every message type.
  • Generated code is dependent on http://github.com/TensorWrench/libprotobuf.git
  • Optional tests are dependent upon http://github.com/krestenkrab/triq.git

The erl_protobuf_test module contains a sampling of .proto files. Adding any .proto file to it will add it to the test suite.

protoc-gen-erlang's People

Contributors

nialscorva avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

protoc-gen-erlang's Issues

Record dependencies do not compile correctly

If you have nested protobuff messages in your proto file, this will create nested records in an erlang header file.

Unfortunately, the header file will not compile if records that have nested records come before the dependent records.

I have gotten around this by writing a script to reorder the header file. However, it would make more sense to have this taken into consideration in the original output.

Place unknown tag/value combinations in an "overflow" variable.

Extensions and newer versions of a protocol can introduce tags that aren't known to the generated code. This will currently break as none of the callback function variants will match.

decode_foo should store these tags should be stored in an array similar to decode/1 attached to a field named '__extensions' in the generated record.

encode_foo should write these fields to the end of the encoded message to preserve logical round trip equivalence.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.