有没有办法使用rebar3在erlang中创建”.ez”文件?

huangapple go评论93阅读模式
英文:

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 命令。以下是基本步骤。

  1. 更新你的 ~/.config/rebar3/rebar.config 文件,如下所示(我展示了 git 的示例,但它也是十六进制的)。
{plugins, [
  {rebar3_archive_plugin, {git, "git@github.com:deadtrickster/rebar3_archive_plugin.git", {branch, "master"}}}
]}.
  1. 进入你想要存档的应用程序目录,然后运行 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.

  1. 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"}}}
]}.
  1. 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.

huangapple
  • 本文由 发表于 2023年1月9日 00:07:19
  • 转载请务必保留本文链接:https://go.coder-hub.com/75049300.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定