-
Notifications
You must be signed in to change notification settings - Fork 3.5k
Automatically inflect the list of applications, closes #5249 #5473
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
Conversation
|
About the Also, I have a question: what happens if I want to use Edit: I also left a few comments regarding formatting and other silly things in the documentation :) |
lib/mix/lib/mix/tasks/compile.app.ex
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Missing final period.
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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. 😕
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes.
lib/mix/lib/mix/tasks/deps.ex
Outdated
There was a problem hiding this comment.
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 ...".
There was a problem hiding this comment.
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?
lib/mix/lib/mix/tasks/deps.ex
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Backticks around true :)
The reason I am not a fan of Good call about |
4dec71c to
3a11a9c
Compare
lib/mix/lib/mix/tasks/compile.app.ex
Outdated
There was a problem hiding this comment.
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 😄
There was a problem hiding this comment.
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).
There was a problem hiding this comment.
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!
d3a3e4b to
50478ae
Compare
|
I don't like |
|
I like the |
|
|
|
@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. |
|
Actually, |
|
❤️ 💚 💙 💛 💜 |
|
This is awesome, great work @josevalim! |
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}" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"Application applications"?
There was a problem hiding this comment.
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".
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.
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.
Before merging this, we need to validate two design decisions:
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:meckno longer needs to be started manually.To disable a dependency from being added to the list of applications, we can pass the
runtime: falseto 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:runtimethe 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?