File tree Expand file tree Collapse file tree 1 file changed +11
-8
lines changed Expand file tree Collapse file tree 1 file changed +11
-8
lines changed Original file line number Diff line number Diff line change @@ -600,26 +600,29 @@ defmodule Mix do
600
600
"""
601
601
@ doc since: "1.15.0"
602
602
def ensure_application! ( app ) when is_atom ( app ) do
603
- ensure_application! ( app , Mix.State . builtin_apps ( ) )
603
+ ensure_application! ( app , Mix.State . builtin_apps ( ) , [ ] )
604
604
:ok
605
605
end
606
606
607
- defp ensure_application! ( app , builtin_apps ) do
607
+ defp ensure_application! ( app , builtin_apps , optional ) do
608
608
case builtin_apps do
609
609
% { ^ app => path } ->
610
610
Code . prepend_path ( path , cache: true )
611
611
Application . load ( app )
612
+ optional = List . wrap ( Application . spec ( app , :optional_applications ) )
612
613
613
614
Application . spec ( app , :applications )
614
615
|> List . wrap ( )
615
- |> Enum . each ( & ensure_application! ( & 1 , builtin_apps ) )
616
+ |> Enum . each ( & ensure_application! ( & 1 , builtin_apps , optional ) )
616
617
617
618
% { } ->
618
- Mix . raise (
619
- "The application \" #{ app } \" could not be found. This may happen if your " <>
620
- "Operating System broke Erlang into multiple packages and may be fixed " <>
621
- "by installing the missing \" erlang-dev\" and \" erlang-#{ app } \" packages"
622
- )
619
+ unless app in optional do
620
+ Mix . raise (
621
+ "The application \" #{ app } \" could not be found. This may happen if your " <>
622
+ "Operating System broke Erlang into multiple packages and may be fixed " <>
623
+ "by installing the missing \" erlang-dev\" and \" erlang-#{ app } \" packages"
624
+ )
625
+ end
623
626
end
624
627
end
625
628
You can’t perform that action at this time.
0 commit comments