Skip to content

Commit fe0d57c

Browse files
lukaszsamsonjosevalim
authored andcommitted
Allow to opt out of starting apps in Mix.install (#12766)
1 parent 727a958 commit fe0d57c

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

lib/mix/lib/mix.ex

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -674,6 +674,9 @@ defmodule Mix do
674674
* `:lockfile` (since v1.14.0) - path to a lockfile to be used as a basis of
675675
dependency resolution.
676676
677+
* `:start_applications` (since v1.15.3) - if `true`, ensures that installed app
678+
and its dependencies are started after install (Default: `true`)
679+
677680
## Examples
678681
679682
Installing `:decimal` and `:jason`:
@@ -794,6 +797,7 @@ defmodule Mix do
794797
config_path = expand_path(opts[:config_path], deps, :config_path, "config/config.exs")
795798
system_env = Keyword.get(opts, :system_env, [])
796799
consolidate_protocols? = Keyword.get(opts, :consolidate_protocols, true)
800+
start_applications? = Keyword.get(opts, :start_applications, true)
797801

798802
id =
799803
{deps, config, system_env, consolidate_protocols?}
@@ -893,9 +897,11 @@ defmodule Mix do
893897
end
894898
end)
895899

896-
for %{app: app, opts: opts} <- Mix.Dep.cached(),
897-
Keyword.get(opts, :runtime, true) and Keyword.get(opts, :app, true) do
898-
Application.ensure_all_started(app)
900+
if start_applications? do
901+
for %{app: app, opts: opts} <- Mix.Dep.cached(),
902+
Keyword.get(opts, :runtime, true) and Keyword.get(opts, :app, true) do
903+
Application.ensure_all_started(app)
904+
end
899905
end
900906

901907
Mix.State.put(:installed, id)

0 commit comments

Comments
 (0)