Skip to content

Commit

Permalink
Fix compilation and use on Elixir 1.16 (#14)
Browse files Browse the repository at this point in the history
  • Loading branch information
fhunleth authored Sep 25, 2024
1 parent 798f700 commit 9156ccc
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion lib/sbom.ex
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ defmodule SBoM do
Mix.Project.get!()

{deps, not_ok} =
Mix.Dep.load_on_environment(env: environment)
load_env_deps(env: environment)
|> Enum.split_with(&ok?/1)

case not_ok do
Expand All @@ -35,6 +35,17 @@ defmodule SBoM do
end
end

if Version.match?(System.version(), ">= 1.16.0") do
defp load_env_deps(options) do
Mix.Dep.Converger.converge(options)
end
else
defp load_env_deps(options) do
# Removed in Elixir >= 1.16.0
Mix.Dep.load_on_environment(options)
end
end

defp ok?(dep) do
Mix.Dep.ok?(dep) || Mix.Dep.compilable?(dep)
end
Expand Down

0 comments on commit 9156ccc

Please sign in to comment.