@@ -6,8 +6,8 @@ defmodule Mix.Tasks.Deps.Compile do
6
6
@ moduledoc """
7
7
Compiles dependencies.
8
8
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.
11
11
12
12
This task attempts to detect if the project contains one of
13
13
the following files and act accordingly:
@@ -22,23 +22,31 @@ defmodule Mix.Tasks.Deps.Compile do
22
22
23
23
{:some_dependency, "0.1.0", compile: "command to compile"}
24
24
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`.
25
31
"""
26
32
27
33
import Mix.Dep , only: [ loaded: 1 , available?: 1 , loaded_by_name: 2 ,
28
34
format_dep: 1 , make?: 1 , mix?: 1 ]
29
35
36
+ @ switches [ include_children: :boolean ]
37
+
30
38
@ spec run ( OptionParser . argv ) :: :ok
31
39
def run ( args ) do
32
40
Mix.Project . get!
33
41
34
- case OptionParser . parse ( args ) do
42
+ case OptionParser . parse ( args , switches: @ switches ) do
35
43
{ _ , [ ] , _ } ->
36
- # Because this command is invoked explicitly with
44
+ # Because this command may be invoked explicitly with
37
45
# deps.compile, we simply try to compile any available
38
46
# dependency.
39
47
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 ) )
42
50
end
43
51
end
44
52
@@ -47,7 +55,7 @@ defmodule Mix.Tasks.Deps.Compile do
47
55
shell = Mix . shell
48
56
config = Mix.Project . deps_config
49
57
50
- Mix.Task . run "deps.loadpaths "
58
+ Mix.Task . run "deps.precompile "
51
59
52
60
compiled =
53
61
Enum . map ( deps , fn % Mix.Dep { app: app , status: status , opts: opts , scm: scm } = dep ->
0 commit comments