Description
When a project uses other tool for build and is not rebar3
discoverable prior to compilation (E.g.: rabbitmq_common), we could use pre hooks to compile it and also to generate the .app.src
, .app
files.
The following rebar.config
still fails though:
{deps, [{rabbit_common, {git, "https://github.com/rabbitmq/rabbitmq-common.git", {ref, "9719670db30"}}}]}.
{overrides, [{override, rabbit_common, [{pre_hooks, [{compile, "make"}]}]}]}.
with error:
===> Dependency failure: source for rabbit_common does not contain a recognizable project and can not be built
The above error is from 3.7.5.
3.6.2 fails as well:
===> Dependency failure: Application rabbit_common not found at the top level of directory ...
Fetching the dependency calls rebar_app_discover:find_app/3
here:
https://github.com/erlang/rebar3/blob/3.7.5/src/rebar_fetch.erl#L33
which expects the .app.src
or .app
file to be present which in this case are generated by make
.
If we could tell rebar3
not fail so quickly here:
https://github.com/erlang/rebar3/blob/3.7.5/src/rebar_fetch.erl#L36
maybe by replacing the throw
https://github.com/erlang/rebar3/blob/3.7.5/src/rebar_fetch.erl#L37
with rebar_app_info:is_available(AppInfo1, true)
we might have a solution.
case rebar_app_discover:find_app(AppInfo1, AppDir, all) of
{true, AppInfo2} ->
rebar_app_info:is_available(AppInfo2, true);
false ->
- throw(?PRV_ERROR({dep_app_not_found, rebar_app_info:name(AppInfo1)}))
+ rebar_app_info:is_available(AppInfo1, true)
end;
This solves the problem but I am unsure about the consequences. Should be a rebar_app_discover:find_app/3
call between prehook of compile
and compile
to double check for the "app.src" later?