File tree Expand file tree Collapse file tree 2 files changed +30
-1
lines changed Expand file tree Collapse file tree 2 files changed +30
-1
lines changed Original file line number Diff line number Diff line change @@ -14,6 +14,28 @@ defmodule Mix.Gleam do
1414 end
1515 end
1616
17+ def available? do
18+ case version_cmd ( ) do
19+ { :ok , _ } -> true
20+ { :error , _ } -> false
21+ end
22+ end
23+
24+ defp version_cmd do
25+ try do
26+ case System . cmd ( "gleam" , [ "--version" ] ) do
27+ { output , 0 } -> { :ok , output }
28+ { _output , error_code } -> { :error , error_code }
29+ end
30+ rescue
31+ error in ErlangError ->
32+ case error do
33+ % ErlangError { original: :enoent } -> { :error , :enoent }
34+ _ -> raise error
35+ end
36+ end
37+ end
38+
1739 defp parse_config ( config ) do
1840 dependencies =
1941 config
Original file line number Diff line number Diff line change @@ -300,7 +300,14 @@ defmodule Mix.Tasks.Deps.Compile do
300300 true
301301 end
302302
303- defp do_gleam ( % Mix.Dep { opts: opts } = dep , config ) do
303+ defp do_gleam ( % Mix.Dep { app: app , opts: opts } = dep , config ) do
304+ if not Mix.Gleam . available? ( ) do
305+ Mix . raise (
306+ "Could not find gleam binary, which is needed to build dependency #{ inspect ( app ) } \n " <>
307+ "Please head to https://gleam.run/getting-started/installing/ and install it."
308+ )
309+ end
310+
304311 lib = Path . join ( Mix.Project . build_path ( ) , "lib" )
305312 out = opts [ :build ]
306313 package = opts [ :dest ]
You can’t perform that action at this time.
0 commit comments