File tree 2 files changed +30
-1
lines changed
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
14
14
end
15
15
end
16
16
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
+
17
39
defp parse_config ( config ) do
18
40
dependencies =
19
41
config
Original file line number Diff line number Diff line change @@ -300,7 +300,14 @@ defmodule Mix.Tasks.Deps.Compile do
300
300
true
301
301
end
302
302
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
+
304
311
lib = Path . join ( Mix.Project . build_path ( ) , "lib" )
305
312
out = opts [ :build ]
306
313
package = opts [ :dest ]
You can’t perform that action at this time.
0 commit comments