kip
ex_cldr Core Team
I have a dep that might need recompiling when the host app configuration changes. That requires a forced compile since by design deps aren’t automatically recompiled (which is the right strategy).
At the command line I can force recompile fine. But from IEx calling Mix.Task.run/2 I cannot. From the command line:
$ mix deps.compile ex_cldr --force
==> ex_cldr
Compiling 2 files (.erl)
Compiling 31 files (.ex)
Generating Cldr for 6 locales named ["en-001", "it", "pl", "root", "ru", ...] with a default locale named "en-001"
Generated ex_cldr app
From IEx shell:
$ iex -S mix
Erlang/OTP 20 [erts-9.2] [source] [64-bit] [smp:4:4] [ds:4:4:10] [async-threads:10] [hipe] [kernel-poll:false] [dtrace]
iex(1)> Mix.Task.run "deps.compile", [:ex_cldr, "--force"]
:ok
…but no compilation takes place.
Any advice on how I specify the args to Mix.Task.run/2 so that it force compiles would be most appreciated.
Trending in Questions
I’m working on a project that simulates the bumbl example in the programming phoenix book. It acts almost like an email client. We have a...
New
Hello,
I know there is an approach for handling lists that allows for optimized traversal, but I can’t recall the specific method (somet...
New
I’m seeing that a list inside a Kino.DataTable will be interpreted as a charlist, even if the Kino.configure() is set to charlists: :as_l...
New
So my question is quite simple and i have found no conclusive answer on forum, google or AI.
Should we use :erlang.float for Integer to ...
New
Documentation
While reading the Scoped Routes section, I noticed that the documentation currently refers to a problem without explainin...
New
Hi, I’ve just set up an application with ash_authentication. There is only magic link strategy for now, so there is no confirmation add o...
New
If a change or preparation module uses Ash.Changeset.get_argument/2 or Ash.Query.get_argument/2 (or any of the other get_argument functio...
New
Other Trending Topics
I am happy to introduce the very α version of the new programming language compiled to BEAM.
Welcome Cure.
It has literally three kille...
New
Hi there! We created Gust: A task orchestrator inspired by Airflow.
For those who have never heard about Aiflow, it’s a Python-based wor...
New
Beam Bots (or just BB for short) is a framework for building fault-tolerant robotics applications in Elixir using familiar OTP patterns. ...
New
Xamal is a deployment tool for Elixir apps that deploys native releases to bare metal servers over SSH. It’s a port of GitHub - basecamp/...
New
Corex is an accessible, unstyled UI component library for Phoenix that integrates Zag.js state machines using Vanilla JavaScript and Live...
New
With AI doing more of the implementation work, I’ve been wondering how much coding I should deliberately keep doing myself.
My main conc...
New
Categories:
Sub Categories:
Forums
Popular Tags
- #ecto
- #liveview
- #troubleshooting
- #learning-elixir
- #library
- #deployment
- #erlang
- #testing
- #genserver
- #mix
- #absinthe
- #remote-other
- #otp
- #plug
- #how-to-question
- #macros
- #postgres
- #elixirconf
- #channels
- #exunit
- #discussion
- #code-sync
- #podcasts
- #javascript
- #onsite
- #dialyzer
- #docker
- #authentication
- #umbrella
- #full-time-contract
- #podcasts-by-brainlid
- #ecto-query
- #ai
- #elixirconf-us
- #blog-post
- #elixir-ls
- #phoenix_html
- #iex
- #graphql
- #genstage
- #websockets
- #supervisor
- #advent-of-code
- #distillery
- #processes
- #api
- #forms
- #hex
- #security
- #metaprogramming











Showing Posts 1 to 10- Show Best Posts
- Show All (oldest first)
- Show All (newest first)
ericmj
This seems to be an Elixir bug. When the
--forceflag is given the compile task for the dependency should be reenabled, by default a task is called only once per project/dependency and in this case it seems to have been called earlier at some point.You have the same bug in your example, you should call
Mix.Task.rerunsince the task may have already run when mix was started.kip
@ericmj, thanks for your reply. I’ve tried a few combinations without success so far, including
reenabling,runningandrerunning. All seems to return:okwithout actually compiling. Anything else you might suggest>ericmj
After looking at this more closely we decided this is a wont fix in Elixir. Mix is not intended to be called from iex or inside of your application. The primary interface is the CLI and because of this tasks are allowed to only run once.
You have to compile the dependency from the command line and restart the application. An application shouldn’t be recompiled after it has started, since it can have new modules, changed environment, or even changed supervision tree. If you don’t want to restart your application it is safest to use the OTP application upgrade mechanisms.
kip
Thanks @ericmj. My IEx demo was an example only. My use case is actually in a Mix compiler.
I think that calling a Mix task from a Mix compiler would be a reasonable expectation? I can work around it if tasks aren’t intended to be called at compile time but it does seem a little strange to me.
ericmj
If it’s in a Mix compiler then it’s a different question :). But since you are doing something uncommon by compiling dependencies after the parent project some more details about your problem would be helpful. It is possible we can solve it another way than compiling deps after the parent, for example would it be possible for you to alias the
deps.compileordeps.precompiletasks to run your task before deps compilation? Can you elaborate on why the host app config changes in a compiler task?mayel
If anyone passing by needs to do something similar, I managed to get a mix task to recompile deps: https://github.com/bonfire-networks/bonfire-app/tree/main/lib/mix/tasks/localise (feedback welcome)
zachdaniel
I do in fact need to do this, but that link is broken for me @mayel
EDIT: I think I found its new location https://github.com/bonfire-networks/bonfire_common/blob/main/lib/mix_tasks/localise/localise_extract.ex
mayel
I haven’t looked at this in a while (or tried it with the last Elixir version) but hopefully it can help! There’s also this task: bonfire_common/lib/mix_tasks/extension/deps_compile.ex at main · bonfire-networks/bonfire_common · GitHub
zachdaniel
Trying to isolate what about this task is different from the standard mix task is proving a bit of a challenge
I feel like surely there must just be some kind of cache I can clear or some piece of state I can modify to make this work. Like before running
mix deps.compile ...mayel
Yeah I remember feeling the same but ended up with that less than ideal code by trial and error. Thinking about it fresh, I’m not sure why chaining
mix deps.clean --build dep1 dep2wouldn’t do the job? But maybe I’m not remembering some details.