We have a large umbrella application where we updated a dependency and the release failed due to duplicated module warnings we didn’t see until it was too late.
mix distillery.release --app andi --env=prod
...
==> Release failed, during .boot generation:
Duplicated modules:
'Elixir.Brook.Serializer.Protocol.MapSet' specified in andi and brook_serializer
'Elixir.Brook.Deserializer.Protocol.MapSet' specified in andi and brook_serializer
Is there a way to check specifically for duplicated protocol implementations using mix, and without incurring the time cost of running a mix distillery.release
? We have several other warnings for code generated by other libraries (macros from retry
for example) we don’t control that make using --warning-as-errors
unviable.
Here is something we taped together to catch it, but we’re interested in any better ideas.
Mix.Tasks.Compile.Elixir.run(["--force"])
|> elem(1)
|> Enum.filter(fn warning ->
warning
|> inspect() # this is always a good idea
|> String.downcase()
|> String.contains?("redefining module")
end)