-
-
Notifications
You must be signed in to change notification settings - Fork 20
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
simplify build command logic by just removing optional argument
- Loading branch information
1 parent
e27dac4
commit 0efe0e1
Showing
1 changed file
with
1 addition
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |