Specifying app startup order with erlang.mk

2019-08-10 07:48发布

问题:

I'm trying to covert over from an antiquated unmaintained build tool to erlang.mk. I have a release created using erlang.mk, but it fails when starting up, I believe because apps are starting up in the wrong order. How do I specify the startup order of the apps? I would have thought that it would start up apps in the same order as specified in the LOCAL_DEPS variable of the Makefile, but that doesn't seem to be happening. I've looked everywhere I can in the docs, plus googled, but haven't been able to find anything.

回答1:

The order doesn't depend on erlang.mk but on the Erlang VM itself when it's starting the applications. When systools is starting a specific application it reads the .app file to check which application should have been started beforehand and starts them. Only when all the prerequisite applications have been started successfully the requested application is started. See the description of the app file.

Example from here:

{application, humbundee,
 [{description, "Humble Bundle downloader written in Erlang"},
  {vsn, "0.0.1"},
  {modules,
   [
    =MODULES=
   ]},
  {registered, [hbd_sup, hbd_get_sup]},
  {applications, [kernel, stdlib, sasl, lager]},
  {mod, {hbd_app, []}}
 ]}.

This says that kernel, stdlib, sasl, and lager must be started before humbundee could be started.



回答2:

It is based on .app file applications list. Each application and its dependents are started before continuing to the next one.