@@ -6,8 +6,8 @@ defmodule Mix.Tasks.Deps.Compile do
66 @ moduledoc """
77 Compiles dependencies.
88
9- By default, compile all dependencies. A list of dependencies can
10- be given to force the compilation of specific dependencies.
9+ By default, compile all dependencies. A list of dependencies
10+ can be given to force the compilation of specific dependencies.
1111
1212 This task attempts to detect if the project contains one of
1313 the following files and act accordingly:
@@ -22,23 +22,31 @@ defmodule Mix.Tasks.Deps.Compile do
2222
2323 {:some_dependency, "0.1.0", compile: "command to compile"}
2424
25+ If a list of dependencies is given, Mix will attempt to compile
26+ them as is. For example, if project `a` depends on `b`, calling
27+ `mix deps.compile a` will compile `a` even if `b` is out of
28+ date. This is to allow parts of the dependency tree to be
29+ recompiled without propagating those changes upstream. To ensure
30+ `b` is included in the compilation step, pass `--include-children`.
2531 """
2632
2733 import Mix.Dep , only: [ loaded: 1 , available?: 1 , loaded_by_name: 2 ,
2834 format_dep: 1 , make?: 1 , mix?: 1 ]
2935
36+ @ switches [ include_children: :boolean ]
37+
3038 @ spec run ( OptionParser . argv ) :: :ok
3139 def run ( args ) do
3240 Mix.Project . get!
3341
34- case OptionParser . parse ( args ) do
42+ case OptionParser . parse ( args , switches: @ switches ) do
3543 { _ , [ ] , _ } ->
36- # Because this command is invoked explicitly with
44+ # Because this command may be invoked explicitly with
3745 # deps.compile, we simply try to compile any available
3846 # dependency.
3947 compile ( Enum . filter ( loaded ( env: Mix . env ) , & available? / 1 ) )
40- { _ , tail , _ } ->
41- compile ( loaded_by_name ( tail , env: Mix . env ) )
48+ { opts , tail , _ } ->
49+ compile ( loaded_by_name ( tail , [ env: Mix . env ] ++ opts ) )
4250 end
4351 end
4452
@@ -47,7 +55,7 @@ defmodule Mix.Tasks.Deps.Compile do
4755 shell = Mix . shell
4856 config = Mix.Project . deps_config
4957
50- Mix.Task . run "deps.loadpaths "
58+ Mix.Task . run "deps.precompile "
5159
5260 compiled =
5361 Enum . map ( deps , fn % Mix.Dep { app: app , status: status , opts: opts , scm: scm } = dep ->
0 commit comments