英文:
Is there any way create ".ez" file using rebar3 in erlang?
问题
例如,可以像这样创建一个应用程序的存档文件:
zip:create("mnesia-4.4.7.ez",
["mnesia-4.4.7"],
[{cwd, code:lib_dir()},
{compress, all},
{uncompress,[".beam",".app"]}]).
但是否有一种方便的方法可以使用rebar3创建“.ez”文件呢?
英文:
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?
答案1
得分: 2
我看不到 rebar 中已经内置了任何功能,但你可以使用这个 rebar3 插件 来添加一个自定义的 rebar3 archive
命令。以下是基本步骤。
- 更新你的
~/.config/rebar3/rebar.config
文件,如下所示(我展示了 git 的示例,但它也是十六进制的)。
{plugins, [
{rebar3_archive_plugin, {git, "git@github.com:deadtrickster/rebar3_archive_plugin.git", {branch, "master"}}}
]}.
- 进入你想要存档的应用程序目录,然后运行
rebar3 archive
命令。
或者,你可以将 rebar3_archive_plugin
条目添加到每个需要进行存档的应用程序的 rebar.config
文件中。对于我的个人构建机器,我更喜欢第一种方法,因为它适用于所有应用程序。然而,如果你正在尝试从自动化构建系统或者主要的 rebar.config
文件不在你的控制下的情况下进行此操作,替代方法可能更可取。
英文:
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.
- Update your ~/.config/rebar3/rebar.config file as shown below (I showed git below but its in hex too).
{plugins, [
{rebar3_archive_plugin, {git, "git@github.com:deadtrickster/rebar3_archive_plugin.git", {branch, "master"}}}
]}.
- Cd to the app directory that you want to archive and run
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.
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论