@@ -30,7 +30,7 @@ defmodule Mix.Gleam do
30
30
deps: deps ++ dev_deps
31
31
}
32
32
|> maybe_gleam_version ( json )
33
- |> maybe_erlang_opts ( json )
33
+ |> maybe_erlang_opts ( json [ "erlang" ] )
34
34
rescue
35
35
KeyError ->
36
36
Mix . raise ( "Command \" gleam export package-information\" unexpected format: \n " <> json )
@@ -45,7 +45,7 @@ defmodule Mix.Gleam do
45
45
{ dep , version , opts }
46
46
47
47
% { "path" => path } ->
48
- { dep , Keyword . merge ( opts , path: Path . expand ( path ) ) }
48
+ { dep , Keyword . merge ( opts , path: path ) }
49
49
50
50
% { "git" => git , "ref" => ref } ->
51
51
{ dep , git: git , ref: ref }
@@ -67,17 +67,24 @@ defmodule Mix.Gleam do
67
67
end
68
68
end
69
69
70
- defp maybe_erlang_opts ( config , json ) do
71
- config =
72
- case get_in ( json , [ "erlang" , "application_start_module" ] ) do
73
- nil -> config
74
- mod -> Map . put ( config , :mod , mod )
75
- end
70
+ defp maybe_erlang_opts ( config , nil ) , do: config
76
71
77
- case get_in ( json , [ "erlang" , "extra_applications" ] ) do
78
- nil -> config
79
- extra_applications -> Map . put ( config , :extra_applications , extra_applications )
80
- end
72
+ defp maybe_erlang_opts ( config , opts ) do
73
+ application =
74
+ opts
75
+ |> Enum . filter ( fn { _ , value } -> value != nil end )
76
+ |> Enum . map ( fn
77
+ { "application_start_module" , module } when is_binary ( module ) ->
78
+ { :mod , { String . to_atom ( module ) , [ ] } }
79
+
80
+ { "extra_applications" , applications } when is_list ( applications ) ->
81
+ { :extra_applications , Enum . map ( applications , & String . to_atom / 1 ) }
82
+
83
+ { key , value } ->
84
+ IO . warn ( "Gleam [erlang] option not supported\n #{ key } : #{ inspect ( value ) } " )
85
+ end )
86
+
87
+ Map . put ( config , :application , application )
81
88
end
82
89
83
90
def require! ( ) do
0 commit comments