filmor / exerl

exerl
Apache License 2.0
11 stars 2 forks source link

Ensure that everything is compiled in the correct order #9

Open filmor opened 5 months ago

filmor commented 5 months ago

Currently, we seem to compile Erlang dependencies after all Elixir deps. This leads to compiler warnings as the modules that Elixir expects (in particular this happens with telemetry don't exist yet on the first compilation. It could also lead to errors if the Elixir code actually tried to use something from the Erlang dep (e.g. a header).

Related #14

belltoy commented 1 month ago

I also found that custom apps are not compiled in the correct order.

In the rebar_prv_compile.erl:

build_apps(DAGs, Apps, State) ->
    {Rebar3, Custom} = lists:partition(
        fun(AppInfo) ->
            Type = rebar_app_info:project_type(AppInfo),
            Type =:= rebar3 orelse Type =:= undefined
        end,
        Apps
    ),
    [build_custom_builder_app(AppInfo, State) || AppInfo <- Custom],
    build_rebar3_apps(DAGs, Rebar3, State).

The Custom apps separated from all Apps are not in the correct order. They can't even be separated. For example, a project depends on an Elixir app grpc, and the grpc depends on some Erlang apps like cowboy and others. In this case, neither the custom apps nor rebar3 apps will compile.