sezaru
How to fix Elixir's 1.11 application boundaries?
Elixir’s new version has a new compiler check specified here: link
After upgrading Elixir, now I receive a lot of these compiler warnings, some are related to my project dependencies and are easy to fix, but how do I fix the ones that are triggering because of a dependency of a library that is not mine?
I know that the obvious answer would be a PR (I already submitted some), but still, there is some libraries that are simply dead or very rarely maintained, meaning that even if I send a PR, there is no telling when this PR would be accepted, merged and a new version created.
So, is there any way to at least silence these warnings for a specific library dependency?
Also, how do you handle the case of optional dependencies?
For example, Tesla library has the gun library as an optional dependency: {:gun, "~> 1.3", optional: true},.
Should the library dev still add :gun to its :extra_applications?
If I add :gun to its :extra_applications, it fix the issue, but only if I use :gun dependency in my app, if I don’t use it, I was getting this error: ** (Mix) Could not start application gun: could not find application file: gun.app
Adding :gun to my app (the one that depends on Tesla) to :extra_applications doesn’t seems to affect the warning, I still get it.
So, what is the correct way to handle these warnings?
I would also recommend an official blog post or some documentation on the matter so users not aware of it (specially new users) will not be bombarded by warnings and not know what to do.
Most Liked
josevalim
josevalim
Tesla should pick option 3 in the warning and add xref: [exclude: [:gun, Mint]], since :gun and Mint, etc is optional for them.
Adding :gun to your deps won’t solve it, as this is strictly a problem for when Tesla is compiled.
EDIT: This answer is wrong, please see comments below.
josevalim
Good question, you are correct. Mix should be respecting optional deps. The bug is that Tesla is listing :applications explicitly and it does not include gun, mint, etc in the prod environment.







