Skip to content

Commit 703c7df

Browse files
author
José Valim
committed
Ensure Mix properly recurs rebar subdirs, closes #1862
1 parent 082af1c commit 703c7df

File tree

3 files changed

+23
-1
lines changed

3 files changed

+23
-1
lines changed

lib/mix/lib/mix/rebar.ex

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,10 @@ defmodule Mix.Rebar do
6969
Runs `fun` for the given config and for each `sub_dirs` in the
7070
given rebar config.
7171
"""
72+
def recur([h|_] = config, fun) when is_integer(h) do
73+
recur(load_config(config), fun)
74+
end
75+
7276
def recur(config, fun) do
7377
subs = (config[:sub_dirs] || [])
7478
|> Enum.map(&Path.wildcard(&1))
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
{ sub_dirs, ["from_apps_another"] }.

lib/mix/test/mix/rebar_test.exs

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,10 +45,27 @@ defmodule Mix.RebarTest do
4545
Mix.Project.pop
4646
end
4747

48+
test "recurs over sub dirs" do
49+
path = MixTest.Case.fixture_path("rebar_dep")
50+
51+
File.cd! path, fn ->
52+
config = Mix.Rebar.load_config(path)
53+
54+
Mix.Rebar.recur(config, fn config ->
55+
if config[:sub_dirs] == ['from_apps_another'] do
56+
Process.put(:inside_apps_another, true)
57+
end
58+
end)
59+
end
60+
61+
unless Process.get(:inside_apps_another) do
62+
flunk "Expected inside_apps_another to return true"
63+
end
64+
end
65+
4866
test "get and compile dependencies for rebar" do
4967
# Use rebar from project root
5068
System.put_env("MIX_HOME", MixTest.Case.elixir_root)
51-
5269
Mix.Project.push(RebarAsDep)
5370

5471
in_tmp "get and compile dependencies for rebar", fn ->

0 commit comments

Comments
 (0)