espec icon indicating copy to clipboard operation
espec copied to clipboard

Making a standalone binary

Open lucaspiller opened this issue 11 years ago • 1 comments

I want to make a standalone binary so it is easier to use in other projects. I used rebar escriptize in c5f15ec5de2d4d5ed89743ab0432b19bd23f6956, which worked to generate a standalone binary, except that isn't enough.

The parse transform we have in include/espec.hrl also needs to be shared in the other projects, as spec files include it at the top.

We need to find a way to either not require this to be included and have the espec command do the work, or for the espec command to add this to the lib path before running specs (I guess it could write a temporary directory, then add that to the lib path).

lucaspiller avatar Apr 27 '13 10:04 lucaspiller

Ok, after lots of brain frying I think we can use epp:parse_file/3. It returns a list of tokens, that you can pass to compile:forms, which returns the binary code. It also takes a parameter of user defined macros (thats the only stuff we need in espec.hrl, the rest can be passed as compile time options).

However, I have no idea what format these take :smile: The docs aren't particularly helpful on this:

http://www.erlang.org/doc/man/epp.html#type-macros

lucaspiller avatar Apr 27 '13 11:04 lucaspiller