Using apps inside umbrella as deps of app outside umbrella

I have an umbrella app with three subapps inside it:

:umbrella_app

  • :app_a
  • :app_b
  • :app_c

I have a separate app (different repo, NOT an umbrella app) in a different repo:

:other_app

I’d like “other_app” to depend on and load the “app_c” subapp of “umbrella_app”.

If I list “umbrella_app” as a dependency of “other_app”, then at “other_app” runtime it cannot find “umbrella_app.app” (because there IS no .app file for the overall umbrella).

If I list “app_c” as a dependency of “other_app” but list as its source the git repo that contains it and the overall umbrella, then at runtime, I get an error that says “app_c lists itself as a dependency”.

Is there a way to depend on “umbrella_app” so that its subapps get built and loaded along with “other_app” and “other_app” can use “app_c”?

Thanks – Michael

2 Likes

An obvious approach is to pull “app_c” outside the umbrella and have both the umbrella and “other_app” depend on it. But in my environment, there is some overhead in growing the number of repos and maintaining them over time.

So, given that we already have “app_c” in the umbrella and inside a repo, I’d still like to see if it’s possible to have “other_app” depend on “app_c” without having to pull it out to it’s own place.

1 Like

Did You try to use the path option in deps? It seems You can depend of anything in your filesystem, as long as You can get a valid path. Something like this…

  defp deps do
    [
      ...
      {:app_c, path: "../path/to/app_c"},
    ]
  end
2 Likes

@kokolegorille,

Had not considered that option, but it worked great. Thanks!

Would still love to see a solution that wouldn’t require manually cloning the sister repo, but would let mix do the work.

{:app_c, git: umbrella_app_repo_url, sparse: "apps/app_c"}

This will pull in only :app_c from the umbrella, no manual cloning required.

6 Likes