Run mix task for selected application(s) only in umbrella project

459 views
Skip to first unread message

Hubert Łępicki

unread,
Jun 20, 2016, 10:50:19 AM6/20/16
to elixir-lang-talk
Hey, so I have an umbrella app, that has 3 apps in it. apps/a, apps/b and apps/c, with their names :a, :b, and :c. There are some deps between the apps but I have dealt with that.

Currently I can either run the mix task from the umbrella root, and it's being run recursively. Or I can cd to one of the app directories and run the task from within.

There is a slight drawback, however, to the 2nd approach: the task I run from within apps/a directory triggers the app in subdirectory to be recompiled, which slightly annoys me every time. 

Is there a way to specify which apps I want to run the task in, without changing working directory to the apps/a or apps/b directory first?

José Valim

unread,
Jun 20, 2016, 11:31:52 AM6/20/16
to elixir-l...@googlegroups.com
There is a slight drawback, however, to the 2nd approach: the task I run from within apps/a directory triggers the app in subdirectory to be recompiled, which slightly annoys me every time. 

I am a bit confused. If the app in subdirectory is being recompiled, it is because it must be recompiled. Unless the issue is that it is being compiled multiple times OR it is recompiling :c, that none of :a or :b depend on.



José Valim
Skype: jv.ptec
Founder and Director of R&D

--
You received this message because you are subscribed to the Google Groups "elixir-lang-talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to elixir-lang-ta...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/elixir-lang-talk/feebd739-75bc-4bbc-acfc-e65228d4995b%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

hubert....@amberbit.com

unread,
Jun 20, 2016, 11:38:53 AM6/20/16
to elixir-lang-talk
Then maybe there is something wrong with my set up of umbrella project. Look at this:

➜  foo git:(master) mix phoenix.server
[info] Running FooAdmin.Endpoint with Cowboy using http://localhost:5000
[...]
➜  cd apps/bar
➜  bar git:(master) mix phoenix.server
Unchecked dependencies for environment dev:
* bankster (Hex package)
  the dependency is not available, run "mix deps.get"
* quantum (Hex package)
  the dependency is not available, run "mix deps.get"
** (Mix) Can't continue due to errors on dependencies
➜  bar git:(master) mix deps.get
Running dependency resolution
* Getting bankster (Hex package)
  Using locally cached package
* Getting quantum (Hex package)
  Using locally cached package
* Getting timex (Hex package)
  Using locally cached package
* Getting tzdata (Hex package)
  Using locally cached package
* Getting combine (Hex package)
  Using locally cached package
➜  bar git:(master) mix phoenix.server
==> idna (compile)
==> bankster
Compiled lib/bankster/bic.ex
Compiled lib/bankster.ex
Compiled lib/bankster/iban.ex
Generated bankster app
[...]

Looks like if I aim in foo/apps/bar, the project is recompiled to local _build directory. While I am in umbrella root, it is recompiled to _build directory over there.

Analogous situation is with deps, they need to be fetched again when I cd to foo/apps/bar from umbrella root.

--
You received this message because you are subscribed to a topic in the Google Groups "elixir-lang-talk" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/elixir-lang-talk/ljjIObR6nGg/unsubscribe.
To unsubscribe from this group and all its topics, send an email to elixir-lang-ta...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/elixir-lang-talk/CAGnRm4LWVcYyTAtd6uScovuWyoWc_QMfNSr-BUDCzWEUYx8TSg%40mail.gmail.com.

For more options, visit https://groups.google.com/d/optout.



--
Hubert Łępicki
phone: +48 694 161 264
email/Google+: hubert....@amberbit.com
Skype: hubert.lepicki

AmberBit Sp. z o. o.
ul. Hetmańska 42 lok. 205
15-727 Białystok

AmberBit Sp. z o. o. jest wpisana do Rejestru Przedsiębiorców Krajowego Rejestru Sądowego prowadzonego przez Sąd Rejonowy w Białymstoku, XII Wydział Gospodarczy Krajowego Rejestru Sądowego. Kapitał zakładowy 20 000,00 zł opłacony w całości.
EU VAT: PL5423228204, NIP: 5423228204, KRS: 0000439100, REGON: 200741641

hubert....@amberbit.com

unread,
Jun 20, 2016, 11:46:05 AM6/20/16
to elixir-lang-talk
OK, I found it.

I did not have the proper paths specified in local mix.exs files in subdirectories. Those things help:

     build_path: "../../_build",
     config_path: "../../config/config.exs",
     deps_path: "../../deps",
     lockfile: "../../mix.lock",


The original question remains: can I do run task for specific app from umbrella root?

José Valim

unread,
Jun 20, 2016, 11:46:10 AM6/20/16
to elixir-l...@googlegroups.com
That sounds like it. Can you please post all 4 mix.exs files in a gist (including the umbrella root one)? I am suspecting they are using different style of configs.



José Valim
Skype: jv.ptec
Founder and Director of R&D

On Mon, Jun 20, 2016 at 5:38 PM, hubert....@amberbit.com <hubert....@amberbit.com> wrote:

José Valim

unread,
Jun 20, 2016, 11:48:51 AM6/20/16
to elixir-l...@googlegroups.com
The original question remains: can I do run task for specific app from umbrella root?

"cd apps/APP && mix TASK" is all we have so far.

hubert....@amberbit.com

unread,
Jun 20, 2016, 11:51:27 AM6/20/16
to elixir-lang-talk
Alright, thank you so much <3

--
You received this message because you are subscribed to a topic in the Google Groups "elixir-lang-talk" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/elixir-lang-talk/ljjIObR6nGg/unsubscribe.
To unsubscribe from this group and all its topics, send an email to elixir-lang-ta...@googlegroups.com.

For more options, visit https://groups.google.com/d/optout.
Reply all
Reply to author
Forward
0 new messages