Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support for umbrella projects #1

Open
JonGretar opened this issue Jul 17, 2014 · 13 comments
Open

Support for umbrella projects #1

JonGretar opened this issue Jul 17, 2014 · 13 comments

Comments

@JonGretar
Copy link
Contributor

It would be nice to support Umbrella projects somehow.

It currently does not work because Mix.Project.load_paths returns [] in umbrella projects:
https://github.com/elixir-lang/elixir/blob/master/lib/mix/lib/mix/project.ex#L323

@wkhere
Copy link
Owner

wkhere commented Jul 17, 2014

Hi!

First, thx for your interest in this piece of code.

Now I need to admit I have zero experience with umbrella projects, so for here & now you seem to be more qualified to come up w/ any hints of how to do it correctly :)

Also if you have some public and practical umbrella project, pls refer to it, it'd be better for me than inventing an artificial example when I'd find some time to tackle this.

cheers
Wojtek

@JonGretar
Copy link
Contributor Author

I created a pull request from what I had hacked together locally. This works from what I have tested although I wonder if there is a more graceful way. But support for this seems to be lacking in Mix.

I retrieve a list of projects using Mix.Dep.Umbrella.loaded/0 and use Application.app_dir/2 to build a path to the beam files. Using Mix.Project.load_paths/1 seems no to work as I can not find a way to get the project config for the child projects.

The Elixir Getting Started guide has a nice walktrough of Umbrella projects here.

I also found 2 git repos that have example of umbrella projects:

@wkhere
Copy link
Owner

wkhere commented Jul 18, 2014

Thank you! :) It looks cool. Just merged into master.

I will play with it over the weekend and then probably publish this change to hex.

@wkhere
Copy link
Owner

wkhere commented Jul 18, 2014

What is intended use of Reprise reloader here? In the umbrella project or in the subproject under umbrella?

If it is the former case, Application.app_dir(d.app, "ebin") returns a subdir of _build in the upper / umbrella directory, so the proposed commit seems wrong, because there's no such directory.

If it's the latter case, Mix.Project.umbrella? returns false and your fix is not used.

I'm reverting this commit from master.

Do you have an actual example on how do you intend to use Reprise in umbrella projects and how does it work for you? :)

cheers

@wkhere
Copy link
Owner

wkhere commented Jul 21, 2014

Closed for no information on what use case you actually had in mind.

Thanks for the refactoring idea w/ iterate_beams(), though.

@JonGretar
Copy link
Contributor Author

The _build dir should not be empty. The umbrella compiles all it's sub applications into there before starting the app.

@JonGretar
Copy link
Contributor Author

I am building a rather large applications. It makes sense for me to split up to multiple Elixir apps inside a larger umbrella project. This is similar how Riak is built using riak_core, riak_cv, riak_pipe etc.

Each sub-app is really useless on it's own but together they build a whole. They are compiled, run and used for a relase using the umbrella project that has no code of it's own.

@wkhere wkhere reopened this Jul 23, 2014
@wkhere wkhere removed the invalid label Jul 23, 2014
@wkhere
Copy link
Owner

wkhere commented Jul 23, 2014

Well then, the umbrella app builds all the subapps in its own _build dir, that's sth I didn't have a chance to know :).

Still I have only a rough idea how do you use Reprise in your umbrella app :) Does it go as a subapp or as a dep of a subapp? And so on, the further I go into the area which is new for me, the more questions.

To cut off all those questions please provide a minimal example - I mean some public repo - of your umbrella app using Reprise - so it can be cloned and used as a test case. Sounds like you exactly know what you want to do with umbrella stuff - then you certainly can see that your knowledge is much more advanced than going through examples from Getting Started guide, which you proposed before. That will be much better and time-saving test case.

@wkhere
Copy link
Owner

wkhere commented Sep 13, 2014

ping!

Meaning - could you clarify at least some of my questions? Then I'd add your code back and play with it a bit

@JonGretar
Copy link
Contributor Author

Sorry. Been busy with getting married and traveling. 😄
I'll write a simple example asap.

However it's pretty simple. There are 2 or more apps in the umbrella. And I would like to reload the code from all those sub-apps.

Right now it will not work because Reprise loads data from Mix.Project.load_paths and that does not work as this is data about the umbrella root Mix file that has no code or load_paths by itself. That's why I load the app list from Mix.Dep.Umbrella.loaded and find the load paths from that list.

Basically. All i want to do is to load compiled code from one or all apps in an umbrella. 😉 Is there a way of doing this that I'm missing?

@JonGretar
Copy link
Contributor Author

Noticed something that might be the source of some confusion..

If it is the former case, Application.app_dir(d.app, "ebin") returns a subdir of _build in the upper / umbrella directory, so the proposed commit seems wrong, because there's no such directory.
If it's the latter case, Mix.Project.umbrella? returns false and your fix is not used.

Did you start the app in a app folder (ie. /apps/kv_server instead of /).
One should start the app in the umbrella folder. That builds all the apps into _build/dev/lib/APPNAME/ebin/ and then starts all apps under the umbrella.

@wkhere
Copy link
Owner

wkhere commented Sep 22, 2014

Thanks for the response!
And congratulations on being married - it's a wonderful thing! :DD

I guess I will find a time to check what you said later in a week, now will have some business traveling next few days

@wkhere
Copy link
Owner

wkhere commented Jun 8, 2015

Jon,
That was long, but.. is it possible for you to check if recent @yrashk changes wrt to umbrella projects fix your case as well? Reprise 0.4.0

TIA

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants