I know that the support for loading code from archive files is experimental.
An archive file for an application can, for example, be created like this:
zip:create("mnesia-4.4.7.ez",
["mnesia-4.4.7"],
[{cwd, code:lib_dir()},
{compress, all},
{uncompress,[".beam",".app"]}]).
But is there any way create ".ez" file using rebar3 conveniently?
I don't see anything built into rebar yet, but you can use this rebar3 plugin to add a custom rebar3 archive
command. Here's the basic steps.
{plugins, [
{rebar3_archive_plugin, {git, "git@github.com:deadtrickster/rebar3_archive_plugin.git", {branch, "master"}}}
]}.
rebar3 archive
Alternatively, you could add the rebar3_archive_plugin
entry to the rebar.config of each app that needs to be archived. For my personal build machine I prefer the first approach because it works for all apps. However, the alternate approach may be preferable if you are trying to do this from an automated build system or the main rebar.config file isn't in your control.