File tree Expand file tree Collapse file tree 2 files changed +33
-0
lines changed
Expand file tree Collapse file tree 2 files changed +33
-0
lines changed Original file line number Diff line number Diff line change @@ -202,6 +202,14 @@ defmodule Mix.Dep.Loader do
202202 )
203203 end
204204
205+ project_app = Mix.Project . config ( ) [ :app ]
206+
207+ if project_app && project_app == app do
208+ Mix . shell ( ) . error (
209+ "warning: the application name #{ inspect ( app ) } is the same as one of its dependencies"
210+ )
211+ end
212+
205213 % Mix.Dep {
206214 scm: scm ,
207215 app: app ,
Original file line number Diff line number Diff line change @@ -922,6 +922,31 @@ defmodule Mix.Tasks.DepsTest do
922922 end )
923923 end
924924
925+ defmodule AppNameClashesWithDep do
926+ def project do
927+ [
928+ app: :ok ,
929+ version: "0.1.0" ,
930+ deps: [
931+ { :ok , "0.1.0" , path: "deps/ok" }
932+ ]
933+ ]
934+ end
935+ end
936+
937+ test "warns when project app name matches a dependency" do
938+ in_fixture ( "deps_status" , fn ->
939+ Mix.Project . push ( AppNameClashesWithDep )
940+
941+ Mix.Tasks.Deps.Get . run ( [ ] )
942+
943+ msg =
944+ "warning: the application name :ok is the same as one of its dependencies"
945+
946+ assert_received { :mix_shell , :error , [ ^ msg ] }
947+ end )
948+ end
949+
925950 ## deps.clean
926951
927952 defmodule CleanDepsApp do
You can’t perform that action at this time.
0 commit comments