christhekeele / matcha

🍵 First-class Elixir match specifications.
Other
89 stars 4 forks source link

Warnings on apps that don't depend on Mnesia #46

Closed axelson closed 1 year ago

axelson commented 1 year ago

If Matcha is used in an application or library that doesn't depend on Mnesia then there will be lots of warnings like this in the logs:

warning: :mnesia.select/3 defined in application :mnesia is used by the current application but the current application does not depend on :mnesia. To fix this, you must do one of:

  1. If :mnesia is part of Erlang/Elixir, you must include it under :extra_applications inside "def application" in your mix.exs

  2. If :mnesia is a dependency, make sure it is listed under "def deps" in your mix.exs

  3. In case you don't want to add a requirement to :mnesia, you may optionally skip this warning by adding [xref: [exclude: [:mnesia]]] to your "def project" in mix.exs

  lib/matcha/table/mnesia/select.ex:3: Matcha.Table.Mnesia.Select.all/3

Instead it would be nice if the mnesia support was optional in some way, likely either with conditional compilation or by breaking out the mnesia support into a separate package.

christhekeele commented 1 year ago

Good catch, I'll look into this when I get the chance!

christhekeele commented 1 year ago

@axelson This should be fixed in latest, and the next release! Thanks for the report.