Skip to content

Commit cfdcf68

Browse files
author
José Valim
committed
Do not access compile_path for umbrellas
1 parent 572726c commit cfdcf68

File tree

4 files changed

+17
-10
lines changed

4 files changed

+17
-10
lines changed

lib/mix/lib/mix/project.ex

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -232,12 +232,15 @@ defmodule Mix.Project do
232232
233233
"""
234234
def app_path(config // config()) do
235-
config[:app_path] || if app = config[:app] do
236-
Path.join([build_path(config), "lib", app])
237-
else
238-
raise Mix.Error, message: "Cannot access build without an application name, " <>
239-
"please ensure you are in a directory with a mix.exs file and it defines " <>
240-
"an :app name under the project configuration"
235+
config[:app_path] || cond do
236+
app = config[:app] ->
237+
Path.join([build_path(config), "lib", app])
238+
config[:apps_path] ->
239+
raise "Trying to access app_path for an umbrella project but umbrellas have no app"
240+
true ->
241+
raise Mix.Error, message: "Cannot access build without an application name, " <>
242+
"please ensure you are in a directory with a mix.exs file and it defines " <>
243+
"an :app name under the project configuration"
241244
end
242245
end
243246

lib/mix/lib/mix/tasks/deps.check.ex

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ defmodule Mix.Tasks.Deps.Check do
4343
paths = Mix.Project.build_path(config)
4444
|> Path.join("lib/*/ebin")
4545
|> Path.wildcard
46-
|> List.delete(Mix.Project.compile_path(config))
46+
|> List.delete(not Mix.Project.umbrella? && Mix.Project.compile_path(config))
4747

4848
to_prune = Enum.reduce(all, paths, &(&2 -- Mix.Deps.load_paths(&1)))
4949

lib/mix/lib/mix/tasks/deps.compile.ex

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ defmodule Mix.Tasks.Deps.Compile do
7272
compiled
7373
end
7474

75-
if Enum.any?(compiled), do: Mix.Deps.Lock.touch
75+
if not Mix.Project.umbrella? && Enum.any?(compiled), do: Mix.Deps.Lock.touch
7676
end
7777

7878
defp check_unavailable!(app, { :unavailable, _ }) do

lib/mix/test/mix/umbrella_test.exs

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ Code.require_file "../test_helper.exs", __DIR__
33
defmodule Mix.UmbrellaTest do
44
use MixTest.Case
55

6-
test "compile umbrella" do
6+
test "compiles umbrella" do
77
in_fixture "umbrella_dep/deps/umbrella", fn ->
88
Mix.Project.in_project(:umbrella, ".", fn _ ->
99
Mix.Task.run "compile"
@@ -22,12 +22,16 @@ defmodule Mix.UmbrellaTest do
2222
end
2323
end
2424

25-
test "dependency in umbrella" do
25+
test "dependencies in umbrella" do
2626
in_fixture "umbrella_dep/deps/umbrella", fn ->
2727
Mix.Project.in_project(:umbrella, ".", fn _ ->
2828
Mix.Task.run "deps"
2929
assert_received { :mix_shell, :info, ["* bar (apps/bar)"] }
3030
assert_received { :mix_shell, :info, ["* foo (apps/foo)"] }
31+
32+
# Ensure we can't compile and run checks
33+
Mix.Task.run "deps.compile"
34+
Mix.Task.run "deps.check"
3135
end)
3236
end
3337
end

0 commit comments

Comments
 (0)