erlef / rebar3_hex

Rebar3 Hex library
Apache License 2.0
101 stars 49 forks source link

Can't get dependency on elixir on erlang module from private repository #311

Closed jbdamiano closed 2 years ago

jbdamiano commented 2 years ago

I have an erlang module A published on a private repository my_repo This module A depends of module B from hexpm repository

When I perform mix deps.get it retrieves my_repo/A and try tro retrieve B from my_repo instead of hexpm

The generated metadata.config

{<<"requirements">>,
 [{<<"B">>,
   [{<<"app">>,<<"B">>},
    {<<"optional">>,false},
    {<<"requirement">>,<<"~>1.0.3">>}]}]}.

As the field {<<"repository">>,<<"hexpm">>}, is missing mix try to retrieve B from my_repo instead of hexpm.

Is it possible to add this field ?

jbdamiano commented 2 years ago

If in the file src/rebar3_hex_app.erl I change: [{N, [{<<"app">>, A}, {<<"optional">>, false}, {<<"requirement">>, V}]} | Acc]; to [{N, [{<<"app">>, A}, {<<"optional">>, false}, {<<"repository">>,<<"hexpm">>}, {<<"requirement">>, V}]} | Acc];

the mix deps.get is working correctly.

starbelly commented 2 years ago

This came up recently in regards to better support for organization on hex.pm. I think what you have is what I was thinking about as a simple solution for private package A depending on private package B and so on and so forth.

I haven't had time to do a PR for this and what's more give it a a lot of testing. Would you like to open a PR?

I'm not sure if this will work when both deps are fetched via rebar, but if it solves at least one problem that at least a step in the right direction.