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.io.Bytes.

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



See also

* https://code.google.com/p/protobuf/ - Official Google Protocol Buffers page
* https://github.com/Atry/protoc-gen-haxe - another haxe implementation from original "protoc-gen-as3" author 
* https://code.google.com/p/protoc-gen-as3/ - ActionScript 3 protoc plugin
* https://github.com/david-alexander/protobuf-haxe - 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 https://bitbucket.org/nitrobin/protohx
     $ haxelib git protohx https://github.com/nitrobin/protohx
2) install protoc into system PATH
   * Windows: 
       Download https://protobuf.googlecode.com/files/protoc-2.5.0-win32.zip
       Unpack and add protoc.exe location to system %PATH%
   * Ubuntu:
       $ sudo aptitude install protobuf-compiler
   * Other:
       Download source code from https://code.google.com/p/protobuf/downloads/list
       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: 
    * https://github.com/nitrobin/protohx
    * https://bitbucket.org/nitrobin/protohx

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)