One common pattern when building Erlang applications is to have an umbrella directory that contains many applications. For example:
apps/
decoder/
lib/decoder.ex
mix.exs
encoder/
lib/encoder.ex
mix.exs
web/
lib/dynamo.ex
mix.exs
mix.exs
This proposal is to outline the details to support this kind of projects in Mix:
- The umbrella project does not actually have any compilable/running code
- Most mix commands executed at the umbrella project will just be executed recursively in the children applications. For example,
mix test will go to each child and execute its tests. Since the umbrella project does not contain any code, we don't need to worry about tasks having double semantics or supporting options like mix compile --recursive
- Dependencies in development will be per-application. This allows each application to run on its own without the knowledge of the parent application. I am aware that child applications may have common dependencies in between them and fetching it many times may be tiring. If this actually becomes an issue, it should be solved by having a local cache (~/.mix) and work transparently regardless if it is an umbrella project or not
- A handful of tasks may actually run in the umbrella application and not in the children ones. Tasks that come to mind are:
mix run and release related tasks. Since such tasks are rather the exception than the rule, they will need to be marked as non-recursive explicitly by setting @recursive false
- In order to configure a mix project to work as an umbrella, all that needs to be set is the
:apps_path configuration
- Differently from Rebar, configuration set in the parent project will not propagate to children. It is a goal to have children applications running and tested in isolation is such is desired.
One common pattern when building Erlang applications is to have an umbrella directory that contains many applications. For example:
This proposal is to outline the details to support this kind of projects in Mix:
mix testwill go to each child and execute its tests. Since the umbrella project does not contain any code, we don't need to worry about tasks having double semantics or supporting options likemix compile --recursivemix runand release related tasks. Since such tasks are rather the exception than the rule, they will need to be marked as non-recursive explicitly by setting@recursive false:apps_pathconfiguration