Skip to content

Commit

Permalink
Fix builds using mix as a build tool
Browse files Browse the repository at this point in the history
This subtly changes the default config to a rebar3 style config that can
be used by non-rebar build tools like mix. Only on a positive test for
rebar2 do we avoid adding the port_compiler plugin and related options.
  • Loading branch information
davisp committed Feb 23, 2022
1 parent b5f3d08 commit e93c208
Showing 1 changed file with 12 additions and 3 deletions.
15 changes: 12 additions & 3 deletions rebar.config.script
Expand Up @@ -38,11 +38,20 @@ Config2 = case os:type() of
Config1
end,

IsRebar3 = code:which(rebar3) /= non_existing,
case IsRebar3 of
IsRebar2 = case lists:keyfind(rebar, 1, application:loaded_applications()) of
{rebar, _Desc, Vsn} ->
case string:split(Vsn, ".") of
["2" | _] -> true;
_ -> false
end;
false ->
Config2;
false
end,

case IsRebar2 of
true ->
Config2;
false ->
Config2 ++ [
{plugins, [{pc, "~> 1.0"}]},
{artifacts, ["priv/jiffy.so"]},
Expand Down

0 comments on commit e93c208

Please sign in to comment.