我想在我的应用程序中使用一些libs,例如。该仓库包含一个src dir,但没有.App文件(因为它不是应用程序),因此我不能使用get-deps。
我尝试了另一种方法,在sub_dirs中添加了 libs dir,并添加了repo作为git subpodule,但是rebar不会编译其任何文件。我想钢筋仅编译OTP应用程序,而不仅仅是与应用程序无关的.ERL文件。
您如何管理这种依赖性?我想避免将文件复制到我的应用程序dir,因为我认为它们不属于那里,而且我有点喜欢Git子模块方法,这使我可以跟踪我正在使用的LIB版本。
I want to use some libs in my application, like https://github.com/Panmind/erlang-ruby-marshal. That repo holds an src dir, but has no .app file (because it's not an application), so I can't use get-deps.
I tried another approach, adding a libs dir in sub_dirs and added the repo as a git submodule, but rebar won't compile any of its files. I guess that rebar only compiles otp applications, but not just .erl files that aren't tied to an application.
How do you manage those kind of dependencies? I would like to avoid copying the files to my app dir, because I don't think they belong there, and I kind of like the git submodule approach, that allows me to keep track of the lib version I am using.
发布评论
评论(4)
最近的 rebar 支持依赖项的
raw
选项。当此选项是特定的时,rebar 不要求依赖项具有标准的 Erlang/OTP 布局,该布局假定存在“src/dependency_name.app.src”或“ebin/dependency_name.app”文件(请参阅更多详细信息 此处)。例如:
请注意,rebar 现在可以获取它,但仍然无法编译它。正如其他评论者指出的那样,这个依赖项没有理由不应该有
.app
文件。我将分叉存储库并向其中添加.app
文件。Recent rebar supports
raw
option for dependencies. When this option is specific, rebar does not require the dependency to have a standard Erlang/OTP layout which assumes the presence of either "src/dependency_name.app.src" or "ebin/dependency_name.app" files (see more details here).For example:
Note that rebar will now be able to fetch it, but it still won't compile it. As other commenters pointed out, there's no reason why this dependency should not have an
.app
file. I would fork the repository and add the.app
file to it.本文介绍了更大的创建过程带有钢筋的应用程序和版本。
更具体地说,我认为
rebar.config
中的这个选项可能就是您正在寻找的。到目前为止,我发现的唯一方法是为每个应用程序创建一个条目:这需要更多的手动工作。不幸的是,rebar 的结构非常围绕一个应用程序的概念,并且需要一些更好的支持来维护具有一堆同等价值的应用程序而不是单个应用程序的存储库。
This article goes through the bigger process of creating applications and releases with rebar.
More specifically, I think this option in
rebar.config
might be what you're looking for. The only way I've found so far is to have one entry for each application:This requires a bit more manual work. Unfortunately rebar is very structured around the concept of one app only, and would need some better support for caring for a repository with a bunch of equally worth applications instead of a single application.
如果您使用的是 Linux,则可以将所需的模块作为硬链接添加到应用程序的 src 目录中。
这远非最佳,但我还没有找到更好的方法来做到这一点。
If you are using Linux, you can add the required modules as hard links, into the src directory of your application.
This is far from optimal but I have yet to find a better way to do this.
请 Agner 的人将其添加到他们的包管理系统中。在此过程中,他们将创建一个分叉并进行转换以使项目钢筋兼容。此外,原始维护者很可能会整合这些更改。
Ask the Agner guys to add it to their package management system. In the process they will create a fork and convert to make the project rebar compatible. Also, the original maintainer will quite possibly integrate the changes.