@@ -73,6 +73,18 @@ defmodule Mix.Tasks.DepsTest do
7373 end
7474 end
7575
76+ defmodule FetchableGitRepoDepApp do
77+ def project do
78+ [
79+ app: :git_sample ,
80+ version: "0.1.0" ,
81+ deps: [
82+ { :git_repo , "0.1.0" , git: MixTest.Case . fixture_path ( "git_repo" ) }
83+ ]
84+ ]
85+ end
86+ end
87+
7688 ## deps
7789
7890 test "prints list of dependencies and their status alphabetically" do
@@ -910,7 +922,51 @@ defmodule Mix.Tasks.DepsTest do
910922 assert Application . spec ( :raw_repo , :vsn )
911923 end )
912924 after
913- Application . delete_env ( :raw_repo , :compile_env , persistent: true )
925+ Application . delete_env ( :anyapp , :anything , persistent: true )
926+ end
927+
928+ test "recompiles fetchable dependencies when compile env changed" do
929+ in_fixture ( "deps_status" , fn ->
930+ File . mkdir_p! ( "config" )
931+ File . write! ( "config/config.exs" , "import Config\n " )
932+
933+ Mix.Project . push ( FetchableGitRepoDepApp )
934+ Mix.Tasks.Deps.Get . run ( [ ] )
935+
936+ File . write! ( "deps/git_repo/lib/git_repo.ex" , """
937+ Application.compile_env(:anyapp, :anything)
938+
939+ defmodule GitRepo do
940+ def hello do
941+ "World"
942+ end
943+ end
944+ """ )
945+
946+ Mix.Tasks.Loadconfig . load_compile ( "config/config.exs" )
947+ Mix.Task . run ( "compile" , [ ] )
948+ assert Application . spec ( :git_repo , :vsn )
949+
950+ File . write! ( "config/config.exs" , """
951+ import Config
952+ config :anyapp, :anything, :anyvalue
953+ """ )
954+
955+ Application . unload ( :git_repo )
956+ Mix.ProjectStack . pop ( )
957+ Mix.Task . clear ( )
958+ Mix.Project . push ( FetchableGitRepoDepApp )
959+ purge ( [ GitRepo ] )
960+ Mix.Tasks.Loadconfig . load_compile ( "config/config.exs" )
961+
962+ Mix.Task . run ( "compile" , [ ] )
963+
964+ assert_receive { :mix_shell , :info , [ "Generated git_repo app" ] }
965+ assert Application . spec ( :git_repo , :vsn )
966+ end )
967+ after
968+ Application . delete_env ( :anyapp , :anything , persistent: true )
969+ purge ( [ GitRepo , GitRepo.MixProject ] )
914970 end
915971
916972 test "does not compile deps that have explicit option" do
0 commit comments