Hierarchical in-umbrella applications?

205 views
Skip to first unread message

vadim

unread,
Jan 22, 2016, 12:35:01 AM1/22/16
to elixir-lang-core
I looked for way to better organize in-umbrella apps. They are wonderful tool of Elixir! However, when we have two dozens and counting, a simple hierarchy would help.

I tried two approaches:

1) Specifying `apps_path=umbrella/**`.

2) Creating `mix.exs` file like

```
defmodule MyApp.Intermediate.Mixfile do
   def project do
     app_path: ".",
   end

   def application, do: []
end
```

and placing its children in subdirs of `intermediate`

Both approaches failed, but somewhat unconvincingly :-) More precisely, to my surprise `mix` found all node applications. It failed when it started to compare paths.

Is there something that I missing?

I am looking for something like

```
mix.exs
umbrella/
   aaa/
     mix.exs
   bbb/
     mix.exs
   nest-ccc/
      ddd/
         mix.exs
      eee
          mix.exs
   nest-fff/
      ggg/
         mix.exs
```

It is also worth noting, that expected dependency rules can be roughly like this (to prevent unexpected behavior):
1) no generalized round deps (so if ddd in nest-ccc depends on aaa or ggg, neither aaa, nor ggg can depend on ddd, or eee -- any app in the same nest)
2) the unnested umbrella is treated as a nest.

While writing the post I realized that possible model for nested umbrella applications can be copied from Googles Bazel (http://bazel.io/) . Google used Basel / Blaze internally for years, and it worked just superbly.

José Valim

unread,
Jan 22, 2016, 2:54:53 AM1/22/16
to elixir-l...@googlegroups.com
Maybe you need something more specific for 1):

    apps_path: "apps/{foo,bar,nest/*,bat}"

Another alternative is to have another actual umbrella application inside nest, but that means you will have umbrella/apps/nest/apps. Maybe apps_path: "." would work but consider also giving the "apps" option in case Mix requires you to be explicit and not confuse files with umbrella apps.


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-core" group.
To unsubscribe from this group and stop receiving emails from it, send an email to elixir-lang-co...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/elixir-lang-core/59f25536-2139-44b6-8440-77238502e14a%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

vadim

unread,
Jan 22, 2016, 10:22:36 AM1/22/16
to elixir-lang-core, jose....@plataformatec.com.br
Mind if I post a PR to https://github.com/josevalim/umbrella_sample to demonstrate the issue (actually, I would appreciate a chance to demonstrate both approaches)?

/v

José Valim

unread,
Jan 22, 2016, 10:27:49 AM1/22/16
to vadim, elixir-lang-core
Please do send them!

I think it is worth saying that, opposite to the other umbrella features, those are low priority. So once we find out what the issue is, I would appreciate pull requests. I am glad to help with guidance, of course. :)



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

vadim

unread,
Jan 23, 2016, 8:05:07 PM1/23/16
to elixir-lang-core, vadim....@moz.com, jose....@plataformatec.com.br
I cannot reproduce the issue with most recent Elixir 1.2.1 . It is possible it was limited to pre 1.2. 

Thank you.

/vadim
Reply all
Reply to author
Forward
0 new messages