-
Notifications
You must be signed in to change notification settings - Fork 70
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
call out ecto optional dependency #164
call out ecto optional dependency #164
Conversation
Under elixir 1.15 code paths are pruned much more precisely when compiling deps. When a top-level project calls out ecto and geo_postgis, elixir will see the lack of an ecto dependency here and possibly compile geo_postgis before ecto is built. if Code.ensure_loaded?(Ecto.Type) do defmodule Geo.PostGIS.Geometry do would sometimes leave out Geo.PostGis.Geometry in elixir 1.15 and you'd get compile errors like the following in your application compile: module Geo.PostGIS.Geometry is not available or is yet to be defined This change calls out this optional ecto dependency. This can be reproduced very reliably by running: - mix compile - mix deps.compile --force geo_postgis - mix compile --force
Before:
After:
|
With the Postgrex upgrade to 0.17.3 I'm consistently getting the following error:
And no error with code from this PR. |
@bryanjos it would be great to get this merged and released. Is there anything we can do to help? |
@aeruder Thanks so much for this. I'm trying to figure out how to communicate the change to users... in my testing, I think what folks will need after taking the patch is: mix deps.clean geo_postgis ecto && mix deps.get The annoying thing is that in my testing, if I go back to the old version (for instance, because I was switching branches to a commit before the update), I have to run that again or else get the same error:
I think the best thing we can do is communicate that this is a one-time pain for users on Elixir v1.15, and you should just update all your branches at once. 😅 Does that sound right to you? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Works in my testing (with the above caveat that users will need to clean their deps when they update). I'm gonna merge as-is, update the documentation, and cut a release soon to try to get ahead of the Elixir 1.15 upgrade pain for folks as much as possible.
Nice job @aeruder! In this case the Elixir v1.15 actually helped you find a bug. Without listing Ecto as an optional dependency, there was no guarantee Ecto would be compiled before geo_postgis. So this bug always existed depending on the order of your deps. Elixir v1.15 made the bug consistently reproducible. :) |
Yea, 1.15 has a method to making it reproducible (recompiling geo_postgis separately), but if you run |
Ah, excellent. I will investigate this! |
Under elixir 1.15 code paths are pruned much more precisely when compiling deps. When a top-level project calls out ecto and geo_postgis, elixir will see the lack of an ecto dependency here and possibly compile geo_postgis before ecto is built.
would sometimes leave out Geo.PostGis.Geometry in elixir 1.15 and you'd get compile errors like the following in your application compile:
This change calls out this optional ecto dependency. This can be reproduced very reliably by running: