From the mix deps documentation:
:runtime- whether the dependency is part of runtime applications. If the:applicationskey is not provided indef applicationin your mix.exs file, Mix will automatically included all dependencies as a runtime application, except ifruntime: falseis given. Defaults to true.
According to mix compile.app docs:
:applications- all applications your application depends on at runtime. By default, this list is automatically inferred from your dependencies. Mix and other tools use the application list in order to start your dependencies before starting the application itself.
Does this mean that adding runtime: false to a dependency would make it not started as part of the application's supervision tree, but its functions would be available at compile-time?
Like you mentioned, that's exactly the case. Marking a dependency runtime: false will not start it as part of the application supervision tree when your main application is started.
Before Elixir 1.4 we had to individually specify the applications that needed to be started by putting them in applications:
def application do
[applications: [:logger, :bamboo]]
end
Now we use extra_applications instead and mark the specific dependencies runtime: false to remove them from the applications list at runtime.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With