Brewery
Compiling Elixir code into standalone executables
I enjoy the Elixir language. It is based on Erlang VM which is used for servers and scaling horizontally. But, I still think the ideas inside Elixir and Erlang could be valuable outside of that scope, in things like applications.
This tool hooks into Mix by letting it compile your project to BEAM code, and then transforming the BEAM code to LLVM IR. It can shim bigger Erlang/Elixir APIs such as gen_tcp with a native alternative (called "Brewery Shims").
Installation
Add :brewery as a dependency in your mix.exs:
def deps do
[{:brewery, "~> 0.1.0"}]
endAnd also the application:
def application do
[extra_applications: [:brewery]]
endUsage
Brewery is configured through the mix.exs's project function in a brewery field
Here are some options you can specify:
:main_module: The module which Brewery compiles to an executable:out_file: Where Brewery outputs the file. Defaults to./_build/dev/lib/ModuleName.out
For example:
def project do
[app: :brewery_example,
version: "0.1.0",
# ...
# the brewery field:
brewery: [
main_module: BreweryExample,
out_file: "./brewery_example",
]]
endThen to compile your project you can run:
mix breweryLicense
MIT © Jamen Marz