Skip to content

Commit 3c3c989

Browse files
author
José Valim
committed
Merge pull request #1408 from meh/mix-leex-yecc
Delete files in the manifest instead of removing the loadpath
2 parents 27b4ebe + 977ec32 commit 3c3c989

File tree

2 files changed

+17
-4
lines changed

2 files changed

+17
-4
lines changed

lib/mix/lib/mix/tasks/compile.elixir.ex

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -103,17 +103,19 @@ defmodule Mix.Tasks.Compile.Elixir do
103103
end
104104

105105
defp compile_files(false, project, compile_path, to_compile, _stale, opts) do
106-
Code.delete_path compile_path
106+
Mix.Utils.read_manifest Path.join(compile_path, @manifest), fn file ->
107+
Path.join(compile_path, file) <> ".beam" |> File.rm
108+
end
109+
107110
set_compiler_opts(project, opts, [])
108111

109112
{ _current, to_remove } =
110-
Mix.Utils.manifest Path.join(compile_path, @manifest), fn ->
113+
Mix.Utils.update_manifest Path.join(compile_path, @manifest), fn ->
111114
compiled = compile_files to_compile, compile_path
112115
lc { mod, _ } inlist compiled, do: atom_to_binary(mod)
113116
end
114117

115118
lc f inlist to_remove, do: File.rm(Path.join(compile_path, f) <> ".beam")
116-
Code.prepend_path compile_path
117119
end
118120

119121
defp set_compiler_opts(project, opts, extra) do

lib/mix/lib/mix/utils.ex

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,14 +105,25 @@ defmodule Mix.Utils do
105105
end
106106
end
107107

108+
@doc """
109+
Read the manifest.
110+
"""
111+
def read_manifest(file, fun) do
112+
if File.exists?(file) do
113+
Enum.each File.stream!(file), fn file ->
114+
fun.(String.rstrip(file, ?\n))
115+
end
116+
end
117+
end
118+
108119
@doc """
109120
Generates a manifest containing all files generated
110121
during a given compilation step. It receives the manifest
111122
file name and a function to execute. The result of the
112123
function is compared to the manifest in order do detect
113124
the files removed from the manifest file.
114125
"""
115-
def manifest(file, fun) do
126+
def update_manifest(file, fun) do
116127
old =
117128
case File.read(file) do
118129
{ :ok, contents } -> String.split(contents, "\n")

0 commit comments

Comments
 (0)