Skip to content

Conversation

@josevalim
Copy link
Member

@josevalim josevalim commented Nov 21, 2016

Before merging this, we need to validate two design decisions:

  1. The list of applications is built per environment. This means test only dependencies, such as {:meck, "> 0.0.0", only: :test}, will be added to the list of applications when compiled for test (and only for test). This means :meck no longer needs to be started manually.

  2. To disable a dependency from being added to the list of applications, we can pass the runtime: false to the dependency. Such as {:mech, "> 0.0.0", only: :test, runtime: false}. This will disable it from being added to any environment, specially test in this case. Is :runtime the best name here?

The reason I decided to go with 1. is because inflecting the list of dependencies becomes hard otherwise. For example, if we decide to only include the list of production dependencies, what would happen if a dependency is runs only in production? Then the application would never boot for dev and test. Then you could say: well, maybe we should add only production dependencies that also belong to the current environment. Which means we would have per-environment behaviour anyway so I decided to go all the way by including all deps in the current environment because it is simpler (simpler to explain, understand and code).

Thoughts?

@whatyouhide
Copy link
Member

whatyouhide commented Nov 21, 2016

About the :runtime name, I'm not sure I'm a fan (yet 😛). It has to convey that the application is not added to the list of applications, and maybe something like in_applications: true | false could make sense? Not sure.

Also, I have a question: what happens if I want to use :included_applications? That is, I want an app to end up in my release but I want to start it manually?

Edit: I also left a few comments regarding formatting and other silly things in the documentation :)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Missing final period.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The other items on the list do not have a final period.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we add a test here for validation of :extra_applications as well? We have it for all other options, it may be weird to skip this one. 😕

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Instead of "if the dependency ...", we could have "whether the dependency ...".

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Say what about the weather?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Backticks around true :)

@josevalim
Copy link
Member Author

something like in_applications: true | false could make sense?

The reason I am not a fan of in_applications: true is because it is the indirect behaviour. The reason you add an application or not to :applications is if you need it at runtime or not. So it feels the option should reflect the final behaviour and not the intermediate one.

Good call about :included_applications, I will address that.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The other items on the list do not have a final period.

Then no final period here 😄

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

On this list there is a final period on the items. I am just keeping it consistent with the surrounding lists (although Elixir is not consistent).

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, alrighty sorry for the noise then!

@josevalim josevalim force-pushed the jv-app-inflect branch 2 times, most recently from d3a3e4b to 50478ae Compare November 21, 2016 10:54
@fishcakez
Copy link
Member

I don't like :runtime because many of OTP's apps have a :runtime_dependencies key, which might become confusing if/when it becomes more documented/adopted. Why not start: true | false?

@michalmuskala
Copy link
Member

I like the start suggestion. The start: true/false could be extended to start: :permanent/transient/temporary for even more control.

@josevalim
Copy link
Member Author

:start it is.

@fishcakez
Copy link
Member

@michalmuskala how would we control the start type of project or extra applications? If we want to go this route then we'll need to build on proposal.

@josevalim
Copy link
Member Author

Actually, :start is not good because you can have an application that you want included in a release but not started. However, this option is doing both: it is not including it in the release and not starting it.

@josevalim josevalim merged commit 75e2ee0 into master Nov 21, 2016
@josevalim
Copy link
Member Author

❤️ 💚 💙 💛 💜

@josevalim josevalim deleted the jv-app-inflect branch November 21, 2016 14:21
@whatyouhide
Copy link
Member

This is awesome, great work @josevalim!

@fishcakez
Copy link
Member

I don't like :runtime because many of OTP's apps have a :runtime_dependencies key, which might become confusing if/when it becomes more documented/adopted

As discussed on irc even if this did become mainstream it would not be confusing.

{:applications, value} ->
unless is_list(value) and Enum.all?(value, &is_atom(&1)) do
Mix.raise "Application dependencies (:applications) should be a list of atoms, got: #{inspect value}"
Mix.raise "Application applications (:applications) should be a list of atoms, got: #{inspect value}"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"Application applications"?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

And above "Application extra applications".

al2o3cr added a commit to al2o3cr/email_checker that referenced this pull request Mar 7, 2023
Since elixir-lang/elixir#5473 in Elixir 1.4, the `applications` key is automatically populated by Mix based on `deps` - but ONLY if it's not manually specified in `mix.exs`.

Adding an explicit `applications` key leads to user confusion, since other dependencies that were expecting to be automatically started won't be.

Also updates the example version to match the latest release.
maennchen pushed a commit to maennchen/email_checker that referenced this pull request Mar 7, 2023
Since elixir-lang/elixir#5473 in Elixir 1.4, the `applications` key is automatically populated by Mix based on `deps` - but ONLY if it's not manually specified in `mix.exs`.

Adding an explicit `applications` key leads to user confusion, since other dependencies that were expecting to be automatically started won't be.

Also updates the example version to match the latest release.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

6 participants