-
Notifications
You must be signed in to change notification settings - Fork 510
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
Package dependencies are always treated as global #1137
Comments
There are no "per-app dependencies" because this is Erlang. Sub-app's like |
When we mention project-local, it isn't app-local. It is for the whole project. The idea of a 'global' dependency would refer to cross-project dependencies (much like plugins can be global -- they work everywhere on your OS). If the dependency is declared for You should call rebar3 from the top-level of the project and get a single You should not call So when you get:
The behaviour is correct because that's the union of all rebar.config files in the project's applications. There is no possible 'grouping per application' since there is no way to have duplicate or disjoint dependencies running at once in a VM (aside from hot code loading, but we can't use that as a feature). |
declaring dependencies in the individual apps as opposed to the root config is important for being able to publish individual apps to package managers like hex |
Maybe this was the behavior by design and I'm just trying to map my previous experience from different languages, but I still can't wrap my head around it. Consider an example use case. I build a web service and a command line tool that prepares some assets for this web service. Since they both share a common library for reading/writing the assets it is natural to keep them all in a single repository/source tree. So I would end up with 3 applications:
Naturally I don't want unnecessary deps hanging around. When building a release for But when I build an
JVM doesn't tolerate different versions of the same libraries being in the CLASSPATH, but somehow it is possible to achieve separate dependencies for separate sub-apps with maven. As I said maybe I am mapping my previous experience from different languages to Erlang and I try to do something stupid. But for other people like me, it would be nice to have a line or two explaining why it happens this way and what is the Erlang way of doing what I want. |
The dependencies of applications for purposes of inclusion inside releases and scripts of all kinds should be defined by what is declared within the .app.src file's |
Ok, point taken. Thanks for explanations. May I suggest to add a couple of lines to the docs making it more explicit to others coming from different backgrounds? I suppose that would help understanding the way rebar works.
Please, see the example project in rebar-1137.tar.gz. |
I have exactly the same situation and I'm a little bit confused about how to configure my project properly to include needed dependencies for CLI. In my case escriptize ignores dependencies from app.src, but includes all the deps from all rebar config files. |
That may be a bug with the escriptize command then. |
Looks like this is indeed not the case with
This way all the |
Yeah I think it would be less confusing to open up an issue about escriptize not fetching the right dependency chains rather than in here. |
Thank you for the response, I've created a separate issue. What about this one? Do you consider the docs incomplete? If so, could you please label it as a documentation bug. This way I could refer to the documentation in other issues and claim that the declared and actual behaviors differ :) |
Given a quote from Dependencies: Declaring dependencies
It is not obvious that:
{apps,lib}/*/rebar.config
even though it is not documented, but these would be treated as if they were specified in the top-levelrebar.config
anyways.Consider an example:
One would expect that:
foo
is a package dependency that is used only inmyapp
;bar
is a package dependency that is used only inmylib
;baz
is a global package dependency and is used in bothmyapp
andmylib
.This behavior is intuitive, but wrong (at least in rebar 3.0.0). This can be confirmed by running
rebar3 deps
:The output of the command above suggests that package dependencies aren't grouped per application. The other commands treat package dependencies the same way, at least
escriptize
would putbar
intomyapp
script even though it doesn't seem to depend on it.The situation is worsened by the fact that source dependencies are treated in a different way.
It would be nice if this behavior would be described in more details in the documentation. It would be even better if rebar would issue a warning that
deps
found in{apps,lib}/*/rebar.config
are treated as global ones.Alternatively per app dependencies could be implemented instead. To my mind this would be the ideal scenario.
Either way or another I think a little more explanation is needed in the docs.
The text was updated successfully, but these errors were encountered: