Closed ghost closed 4 years ago
Really appreciate the repo, thank you, will work on this tonight (evening coming up in my timezone)
I suspect the the compiler isn't picking up the module dependency. So while I work on this may I suggest you try adding require Demo.Web
to the top of lib/demo_web/router.ex
? That will force the compiler to compile Demo.Web
first.
The difference is that in :dev
mode, Plug.init/1
is called lazily at runtime. In :prod
and I assume :test
it is called at compile time. Therefore Demo.Cldr
needs to be compiled before the router compilation and the compiler isn't detecting that dependency.
Validated. In router.ex
:
defmodule DemoWeb.Router do
use DemoWeb, :router
# Adding the require forces the compiler
# to process this module now
require Demo.Cldr
pipeline :browser do
plug :accepts, ["html"]
plug :fetch_session
...
Then compile:
kip@Kips-iMac-Pro cldr-demo % MIX_ENV=test mix compile
Compiling 16 files (.ex)
16:56:00.929 [info] Downloaded locale "de"
Generating Demo.Cldr for 4 locales named ["de", "en", "en-001", "root"] with a default locale named "de"
Generated demo app
I'm not sure why the compiler isn't identifying the dependency earlier. Will investigate.
I have submitted this issue.
On Josés advice I've take another route that does not require changing your code. It is now on hex as ex_cldr version 2.14.1. The changelog entry is:
Cldr.Plug.SetLocale
. Thanks to @syfgkjasdkn. Closes #135.% mix deps.update ex_cldr
% MIX_ENV=test mix compile
All should be good now. I will close this issue, let me know if you see other issues. And thanks for the report.
@kipcole9 thank you!
fwiw I had issue https://github.com/elixir-cldr/cldr/issues/126 on 2.14.0 and needed to move/copy the MyApp.Cldr module into the top of the router.ex file to compile in prod (leading to slow recompile issues in dev..)
2.14.1 fixed it🎉
@petermm, happy to hear it helped you too! Please don't hesitate to file an issue any time if something seems awry. I try hard to be responsive and fix bugs. I hate bugs. And I don't want there to be a poor experience using these libs.
Hello, I had the same issue as reported by one of my user of Kandesk https://github.com/seb3s/kandesk/issues/4 I tried upgrading to the latest version but it still fails cldr_utils 2.14.0 ex_cldr 2.18.2 ex_cldr_calendars 1.12.0 ex_cldr_currencies 2.8.0 ex_cldr_dates_times 2.6.3 ex_cldr_numbers 2.16.1
I put some logger and see I get 14:01:53.264 [info] Module Elixir.KandeskWeb.Cldr, Cldr error: :unavailable which https://hexdocs.pm/elixir/Code.html#ensure_compiled/1 indicates is a deadlock compilation.
My config : Erlang/OTP 22 [erts-10.7] [source] [64-bit] [smp:12:12] [ds:12:12:10] [async-threads:1] [hipe] Interactive Elixir (1.10.0) - press Ctrl+C to exit (type h() ENTER for help)
Maybe I did something wrong in the configuration. All code is currently available at kandesk. Hope this helps
Sébastien.
Repro: https://github.com/syfgkjasdkn/cldr-demo
Continued from https://github.com/elixir-cldr/cldr/issues/126
mix compile
works fine, butMIX_ENV=test mix compile
fails with