Skip to content

Commit

Permalink
fix: suppress module conflict warning when running upgrade_igniter
Browse files Browse the repository at this point in the history
  • Loading branch information
zachallaun committed Nov 6, 2024
1 parent b5df895 commit 0f81bee
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion lib/mix/tasks/igniter.upgrade_igniter.ex
Original file line number Diff line number Diff line change
Expand Up @@ -76,10 +76,20 @@ defmodule Mix.Tasks.Igniter.UpgradeIgniter do
end

defp igniter2_to_igniter1(igniter, _opts) do
Igniter.Mix.Task.module_info()[:compile][:source] |> List.to_string() |> Code.compile_file()
ignore_module_conflict(fn ->
Igniter.Mix.Task.module_info()[:compile][:source] |> List.to_string() |> Code.compile_file()
end)

Igniter.update_all_elixir_files(igniter, fn zipper ->
Igniter.Upgrades.Igniter.rewrite_deprecated_igniter_callback(zipper)
end)
end

defp ignore_module_conflict(fun) when is_function(fun, 0) do
original_compiler_opts = Code.compiler_options()
Code.put_compiler_option(:ignore_module_conflict, true)
result = fun.()
Code.compiler_options(original_compiler_opts)
result
end
end

0 comments on commit 0f81bee

Please sign in to comment.