Skip to content

Commit 10612dd

Browse files
author
José Valim
committed
Always rebuild structures on Windows
Signed-off-by: José Valim <[email protected]>
1 parent cbcbbcf commit 10612dd

File tree

3 files changed

+17
-5
lines changed

3 files changed

+17
-5
lines changed

lib/mix/lib/mix/compilers/elixir.ex

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,19 @@ defmodule Mix.Compilers.Elixir do
5252
removed != [] ->
5353
write_manifest(manifest, entries ++ skip_entries)
5454
:ok
55+
File.exists?(Mix.Project.app_path) ->
56+
# If we have an app path but a noop result, we rebuild
57+
# the structure because priv/include needs to be recopied when
58+
# symlink is not available. We do this in the Elixir compiler
59+
# instead of the main compiler one because other compilers may
60+
# return :ok, saying they did some work, but they may have not
61+
# built a structure at all.
62+
#
63+
# This implies the Elixir compiler is somewhat required, even
64+
# for Erlang projects, which is an ok assumption to make (we
65+
# ship with both Elixir and Erlang compilers by default).
66+
Mix.Project.build_structure()
67+
:noop
5568
true ->
5669
:noop
5770
end

lib/mix/lib/mix/tasks/compile.app.ex

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,9 @@ defmodule Mix.Tasks.Compile.App do
9999
properties = ensure_correct_properties(app, config, properties)
100100
contents = {:application, app, properties}
101101

102-
Mix.Project.build_structure(config)
102+
# There are no modules, we assume no structure was built.
103+
# If it was built, it doesn't matter, we just rebuild it.
104+
if mods == [], do: Mix.Project.build_structure(config)
103105
File.write!(target, :io_lib.format("~p.", [contents]))
104106

105107
Mix.shell.info "Generated #{app}.app"

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

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -64,10 +64,7 @@ defmodule Mix.Tasks.Deps.Compile do
6464
"(pass :compile as an option to customize compilation, set it to false to do nothing)"
6565
end
6666

67-
# Always build the structure even for Mix projects
68-
# because if nothing was compiled, we need to re-copy
69-
# priv/include when symlinks are not available.
70-
build_structure(dep, config)
67+
unless mix?(dep), do: build_structure(dep, config)
7168
touch_fetchable(scm, opts[:build])
7269
compiled
7370
end)

0 commit comments

Comments
 (0)