File tree Expand file tree Collapse file tree 2 files changed +34
-1
lines changed Expand file tree Collapse file tree 2 files changed +34
-1
lines changed Original file line number Diff line number Diff line change @@ -287,7 +287,7 @@ defmodule Mix.Dep.Loader do
287
287
end
288
288
end
289
289
290
- defp mix_dep ( % Mix.Dep { opts: opts } = dep , nil ) do
290
+ defp mix_dep ( % Mix.Dep { app: app , opts: opts } = dep , nil ) do
291
291
Mix.Dep . in_dependency ( dep , fn _ ->
292
292
opts =
293
293
if Mix.Project . umbrella? ( ) do
@@ -298,6 +298,17 @@ defmodule Mix.Dep.Loader do
298
298
299
299
child_opts =
300
300
if opts [ :from_umbrella ] do
301
+ config = Mix.Project . config ( )
302
+
303
+ if config [ :app ] != app do
304
+ Mix . raise (
305
+ "Umbrella app #{ inspect ( config [ :app ] ) } is located at " <>
306
+ "directory #{ Atom . to_string ( app ) } , and different names cause " <>
307
+ "a name mismatch that's not allowed. Please rename either " <>
308
+ "app's directory name or app's name in mix.exs to be equal."
309
+ )
310
+ end
311
+
301
312
[ ]
302
313
else
303
314
[ env: Keyword . fetch! ( opts , :env ) ]
Original file line number Diff line number Diff line change @@ -30,6 +30,28 @@ defmodule Mix.UmbrellaTest do
30
30
end )
31
31
end
32
32
33
+ test "umbrella app dir and the app name defined in mix.exs should be equal" do
34
+ in_fixture ( "umbrella_dep/deps/umbrella" , fn ->
35
+ Mix.Project . in_project ( :umbrella , "." , fn _ ->
36
+ File . write! ( "apps/bar/mix.exs" , """
37
+ defmodule Bar.MixProject do
38
+ use Mix.Project
39
+
40
+ def project do
41
+ [app: :baz,
42
+ version: "0.1.0",
43
+ deps: []]
44
+ end
45
+ end
46
+ """ )
47
+
48
+ assert_raise Mix.Error , ~r/ ^Umbrella app :baz is located at directory bar/ , fn ->
49
+ Mix.Task . run ( "deps" )
50
+ end
51
+ end )
52
+ end )
53
+ end
54
+
33
55
test "compiles umbrella" do
34
56
in_fixture ( "umbrella_dep/deps/umbrella" , fn ->
35
57
Mix.Project . in_project ( :umbrella , "." , fn _ ->
You can’t perform that action at this time.
0 commit comments