Skip to content

Commit

Permalink
simplify build command logic by just removing optional argument
Browse files Browse the repository at this point in the history
  • Loading branch information
modellurgist authored and lpil committed Dec 9, 2021
1 parent e27dac4 commit 0efe0e1
Showing 1 changed file with 1 addition and 17 deletions.
18 changes: 1 addition & 17 deletions lib/mix/tasks/compiler/gleam.ex
Original file line number Diff line number Diff line change
@@ -1,26 +1,10 @@
defmodule Mix.Tasks.Compile.Gleam do
use Mix.Task.Compiler

@first_gleam_version_not_taking_build_arg "0.18.0-rc1"

def run(_args) do
case Mix.shell().cmd(build_command()) do
case Mix.shell().cmd("gleam build") do
0 -> {:ok, []}
status -> exit(status)
end
end

defp build_command do
if build_needs_arg?(),
do: "gleam build .",
else: "gleam build"
end

defp build_needs_arg? do
{cmd_output, 0} = System.cmd("gleam", ["-V"])
<<"gleam "::utf8, active_version::binary>> = String.trim(cmd_output)

comparison = Version.compare(active_version, @first_gleam_version_not_taking_build_arg)
comparison == :lt
end
end

0 comments on commit 0efe0e1

Please sign in to comment.