Compile erlang dependency (fwknop) that is inside a subfolder of github repo

erlang
mix

#1

i’m trying to reuse an erlang implementation of a library that implements multiple language clients on their repo (eg /erlang, /perl, /python). Inside the erlang path, there is a rebar.config file

How am I supposed to include it and compile it?
To test it in my local computer, i did::

   {:fwknop_src, git: "https://github.com/mrash/fwknop.git", branch: "master", compile: false, app: false},
   {:fwknop, path: "deps/fwknop_src/erlang", runtime: false},

and it works.
then, i also tried moving it to the root, and it also works.

The problem is, none of this approaches work when going to prod.
Is there any way to configure mix to cope with the subpath?
if there is none, then i’m left with one of the following options

  1. Open a PR asking the fwknop to move the rebar.config file to the root. Looking at the repo, and the multiple implementations they have it’s unlikely that they will pollute the root directory. And in any case, i couldn’t find the right config for it, even setting src_dirs fails when compiling
  2. Create a new repo with a copy of the erlang folder
  3. Migrate the library to elixir, and publish it on it’s own repo.

None of this 3 options are really appealing. Therefore, if mix could be configured, then I would go with that one. If not, i would probably go with migrating it to elixir


#2

The git source knows the :sparse option, perhaps that’s what you need?

:sparse - checkout a single directory inside the Git repository and use it as your Mix dependency. Search “sparse git checkouts” for more information.


#3

This could probably work with the sparse: ... option for deps.

{:fwknop, git: "https://github.com/mrash/fwknop.git", branch: "master", sparse: "erlang"}

We use it to pull in separate apps from a utility repo that we have. Note that in those cases it’ll pull once for each entry.


#4

ohh man!!! completely missed this!!!
i think I was reading the docs around path, and missed the git config. this is awesome

thank you for your help @gonz and @NobbZ !! you rock