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
16
16
17
17
* `--no-deps-check` - does not check or compile deps, only load available ones
18
18
* `--no-compile` - does not compile dependencies
19
+ * `--no-load-deps` - do not load deps from the code path
19
20
20
21
"""
21
22
@@ -26,14 +27,16 @@ defmodule Mix.Tasks.Deps.Loadpaths do
26
27
deps_check ( all , "--no-compile" in args )
27
28
end
28
29
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
35
37
36
- prune_deps ( load_paths , "--no-deps-check" in args )
38
+ prune_deps ( load_paths , "--no-deps-check" in args )
39
+ end
37
40
end
38
41
39
42
# 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
242
242
end )
243
243
end
244
244
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
+
245
275
## deps.unlock
246
276
247
277
test "unlocks all deps" , context do
You can’t perform that action at this time.
0 commit comments