@@ -374,13 +374,17 @@ defmodule Mix.Dep.Loader do
374374 from = Path . join ( opts [ :dest ] , "gleam.toml" )
375375 deps = Enum . map ( config [ :deps ] , & to_dep ( & 1 , from , _manager = nil , locked? ) )
376376
377- properties = [
378- { :vsn , to_charlist ( config [ :version ] ) } ,
379- { :mod , { String . to_atom ( config [ :mod ] ) , [ ] } }
380- ]
377+ properties =
378+ [ { :vsn , to_charlist ( config [ :version ] ) } ]
379+ |> gleam_mod ( config )
380+ |> gleam_applications ( config )
381381
382382 contents = :io_lib . format ( "~p.~n" , [ { :application , dep . app , properties } ] )
383383
384+ [ opts [ :build ] , "ebin" ]
385+ |> Path . join ( )
386+ |> File . mkdir_p! ( )
387+
384388 [ opts [ :build ] , "ebin" , "#{ dep . app } .app" ]
385389 |> Path . join ( )
386390 |> File . write! ( IO . chardata_to_string ( contents ) )
@@ -393,6 +397,24 @@ defmodule Mix.Dep.Loader do
393397 { dep , Enum . map ( children , & to_dep ( & 1 , opts [ :dest ] , _manager = nil , locked? ) ) }
394398 end
395399
400+ defp gleam_mod ( properties , config ) do
401+ case config [ :mod ] do
402+ nil -> properties
403+ mod -> [ { :mod , { String . to_atom ( mod ) , [ ] } } | properties ]
404+ end
405+ end
406+
407+ defp gleam_applications ( properties , config ) do
408+ case config [ :extra_applications ] do
409+ nil ->
410+ properties
411+
412+ applications ->
413+ applications = Enum . map ( applications , & String . to_atom / 1 )
414+ [ { :applications , applications } | properties ]
415+ end
416+ end
417+
396418 defp mix_children ( config , locked? , opts ) do
397419 from = Mix.Project . project_file ( )
398420
0 commit comments