Protohx is crossplatform implementation of "Google's Protocol Buffers" for haxe 3.
Switch branches/tags
Nothing to show
Clone or download
nitrobin version 0.4.6
Latest commit 128a0b4 Oct 19, 2015
Failed to load latest commit information.
protohx Fix for hxcpp target Jul 10, 2015
samples Fix for hxcpp target Jul 10, 2015
tools version 0.4.6 Oct 19, 2015
.gitattributes windows fix Nov 17, 2013
.hgignore wf May 5, 2014
LICENSE First release. Version 0.1 Mar 9, 2013 edited online with Bitbucket Jun 28, 2015
haxelib.json version 0.4.6 Oct 19, 2015
run.n update run.n May 5, 2015

Protohx is crossplatform implementation of "Google's Protocol Buffers" for haxe 3.

This is partial port of ActionScript3 protoc plugin "protoc-gen-as3" for haxe. Currently implemented only basic functionality: read/write messages from/to

haxe 3 compatible. Core functionality doesn't depend on third-party libraries.



See also

* - Official Google Protocol Buffers page
* - another haxe implementation from original "protoc-gen-as3" author 
* - ActionScript 3 protoc plugin
* - another haxe implementation (GPL)

Supported Features

This functionality ported from "protoc-gen-as3"

* All basic types  (int, int64, string, bytes, bool)
* Nested messages
* Enumerations (as integer)
* Packed and non-packed repeated fields
* Extensions (converted to optional fields)

Tested targets

* flash
* neko 2.0
* cpp (linux32, win32, android)
* js
* php
* java
* as3

System requirements

* haxe 3.1.3
* neko 2.0
* protoc 2.5.0
* java 1.7
* ant (for build plugin from sources)

How to install

1) install protohx
     $ haxelib install protohx
     $ haxelib hg protohx
     $ haxelib git protohx
2) install protoc into system PATH
   * Windows: 
       Unpack and add protoc.exe location to system %PATH%
   * Ubuntu:
       $ sudo aptitude install protobuf-compiler
   * Other:
       Download source code from
       Unpack and make && make install.
   * NOTE:
       You also can set custom protoc executable with "setup-protoc"
           $ haxelib run protohx setup-protoc PROTOC_2_5_0_PATH 
       For example:
           $ haxelib run protohx setup-protoc /home/user/opt/protobuf-2.5.0/src/protoc

How to use

1) create empty json config file in project directory with "config"
    $ haxelib run protohx config protohx.json
    Change and save protohx.json 
    // File: samples/test-core/protohx.json
        "protoPath": "proto",
        "protoFiles": [
        "cleanOut": true,
        "haxeOut": "out/src-gen",
        "javaOut": null
        protoPath - base path for import directive in proto files;
        protoFiles - list of files for code generation;
        haxeOut/javaOut - path for generated sources (add it in project classpath);
        cleanOut - if 'true' clean output directories before code generation.

2) write proto files
3) genearate haxe sources:
      $ haxelib run protohx generate protohx.json
4) add "out/src-gen" (see param: haxeOut) directory in project classpath


Protohx project urls: 

This project consists from follow parts:
    * tools/plugin - protoc plugin for generating haxe sources;
    * tools/run - haxelib runner. Generate haxe and a java sources by json config in project directory;
    * protohx - library sources. Pure-haxe port of main parts originally ActionScrip3 code from protoc-gen-as3;
    * samples/01-core - unit tests;
    * samples/02-ipc - java-to-neko and neko-to-java intercommunication test.
        NOTE: Install protoc 2.5.0 via "haxelib run protohx setup-protoc PROTOC_2_5_0_PATH" before building java part of this test.
    * samples/03-network - complete client-server example.
       build/run node.js server:
            haxe build-server-js.hxml
       or neko serer:
            haxe build-server-neko.hxml
       and build/run flash client:
            haxe build-client-flash.hxml
            nme test (flash|linux|android)