File tree Expand file tree Collapse file tree 2 files changed +40
-7
lines changed Expand file tree Collapse file tree 2 files changed +40
-7
lines changed Original file line number Diff line number Diff line change @@ -16,6 +16,7 @@ defmodule Mix.Tasks.Deps.Loadpaths do
1616
1717 * `--no-deps-check` - does not check or compile deps, only load available ones
1818 * `--no-compile` - does not compile dependencies
19+ * `--no-load-deps` - do not load deps from the code path
1920
2021 """
2122
@@ -26,14 +27,16 @@ defmodule Mix.Tasks.Deps.Loadpaths do
2627 deps_check ( all , "--no-compile" in args )
2728 end
2829
29- load_paths =
30- for dep <- all ,
31- path <- Mix.Dep . load_paths ( dep ) do
32- _ = Code . prepend_path ( path )
33- path
34- end
30+ unless "--no-load-deps" in args do
31+ load_paths =
32+ for dep <- all ,
33+ path <- Mix.Dep . load_paths ( dep ) do
34+ _ = Code . prepend_path ( path )
35+ path
36+ end
3537
36- prune_deps ( load_paths , "--no-deps-check" in args )
38+ prune_deps ( load_paths , "--no-deps-check" in args )
39+ end
3740 end
3841
3942 # If the build is per environment, we should be able to look
Original file line number Diff line number Diff line change @@ -242,6 +242,36 @@ defmodule Mix.Tasks.DepsTest do
242242 end )
243243 end
244244
245+ test "does not load or prune builds with --no-load-deps" do
246+ Mix.Project . push ( SuccessfulDepsApp )
247+
248+ in_fixture ( "deps_status" , fn ->
249+ # Start from scratch!
250+ File . rm_rf ( "_build" )
251+
252+ Mix.Tasks.Deps.Compile . run ( [ ] )
253+ Mix.Tasks.Deps.Loadpaths . run ( [ ] )
254+ assert File . exists? ( "_build/dev/lib/ok/ebin/ok.app" )
255+ assert File . exists? ( "_build/dev/lib/ok/priv/sample" )
256+
257+ Mix.Tasks.Compile . run ( [ ] )
258+ assert to_charlist ( Path . expand ( "_build/dev/lib/ok/ebin/" ) ) in :code . get_path ( )
259+ assert File . exists? ( "_build/dev/lib/sample/ebin/sample.app" )
260+
261+ # Remove the deps without build_path
262+ Mix.ProjectStack . post_config ( deps: [ ] )
263+ Mix.ProjectStack . clear_cache ( )
264+ Mix.Project . pop ( )
265+ Mix.Project . push ( SuccessfulDepsApp )
266+ Code . delete_path ( "_build/dev/lib/ok/ebin" )
267+
268+ Mix.Tasks.Deps.Loadpaths . run ( [ "--no-load-deps" ] )
269+ refute to_charlist ( Path . expand ( "_build/dev/lib/ok/ebin/" ) ) in :code . get_path ( )
270+ assert File . exists? ( "_build/dev/lib/ok/ebin/ok.app" )
271+ assert File . exists? ( "_build/dev/lib/sample/ebin/sample.app" )
272+ end )
273+ end
274+
245275 ## deps.unlock
246276
247277 test "unlocks all deps" , context do
You can’t perform that action at this time.
0 commit comments