Processing external libraries with rebar

I want to use some libs in my application, for example https://github.com/Panmind/erlang-ruby-marshal . This repo contains src-dir but does not have a .app file (because it is not an application), so I cannot use get-deps.

I tried a different approach by adding dir libs to sub_dirs and adding a repo as a submodule of git, but the armature will not compile any of its files. I think rebar only compiles otp applications, but not just .erl files that are not tied to the application.

How do you manage these dependencies? I would like to avoid copying files to my application directory, because I don’t think they are there, and I kind of like a git submodule that allows me to track the version of lib that I use.

+6
erlang dependency-management rebar
source share
4 answers

Recent reinforcement supports the raw parameter for dependencies. If this parameter is specific, the reinforcement does not require the dependency to have a standard Erlang / OTP layout, which assumes the presence of the files "src / dependency_name.app.src" or "ebin / dependency_name.app" (see more details here ).

For instance:

 {deps, [ {erlang_ruby_marshal, "", {git, "https://github.com/Panmind/erlang-ruby-marshal", {branch, master}}, [raw]} ]}. 

Please note that now the reinforcing bars will be able to extract it, but it still will not compile it. As other commentators noted, there is no reason why this dependency should not have a .app file. I would unlock the repository and add the .app file to it.

+3
source share

This article discusses the larger process of creating applications and releases with rebar.

In particular, I think this parameter in rebar.config might be what you are looking for. The only way I've found so far is to have one entry for each application:

 {sub_dirs, ["libs/app1", "libs/app2", ...]}. 

This requires a bit more manual work. Unfortunately, the fixture is very structured around the concept of only one application and needs some additional support to care for the repository with a bunch of equally worthwhile applications instead of a single application.

+2
source share

If you are using Linux, you can add the necessary modules as hard links to the src directory of your application.

This is far from optimal, but I still have to find a better way to do this.

+1
source share

Ask the Agner guys to add it to their package management system. In the process, they will create a plug and convert to make the project armature compatible. In addition, the initial maintainer may well integrate the changes.

0
source share

All Articles