zx_rebar_plugin/README.md
2025-11-27 23:04:35 +01:00

49 lines
1.5 KiB
Markdown

zx_rebar_plugin
=====
**Copyright** (c) 2025 QPQ AG
A rebar plugin for assisting `rebar3`-enabled applications that also support `zx`.
Build
-----
$ rebar3 compile
Use
---
Add the plugin to your rebar config:
{plugins, [
{zx_rebar_plugin, {git, "https://git.qpq.swiss/QPQ-AG/zx_rebar_plugin.git", {tag, "0.1.0"}}}
]}.
In order to add `zx` as a dependency:
{deps, [
...,
{zx, {zx, "https://gitlab.com/zxq9/zx", {ref, "2a0437f4"}, "0.14.0"}}
]}.
The third element (e.g. `"0.14.0"`) is the application version of `zx`.
Note that the given version must be reachable through the specified commit reference.
Currently, this plugin only registers a resource callback that fetches and organizes
the `zx` application as a `rebar3` dependency.
In the future, we may add utility commands to simplify creation of `zx` packages from
within `rebar3`.
Technicalities
--------------
The `zx` git repository has an organization that isn't directly rebar3 compatible,
and the source is found under e.g. `zomp/lib/otpr/zx/0.14.0`. While `rebar3`
supports a `git_subdir` fetch method, it makes assumptions about the path that won't
work with `zx`. The resource plugin also ensures that there is a `rebar.config` file
(generating one if necessary).
While `zx` relies on `make all` for the compilation, `rebar3` lacks support for this,
and instead uses the `erlc` compiler. At the moment, this isn't a problem, and if it
should become one later, this plugin can be extended to adapt.