Skip to content

Commit

Permalink
WIP
Browse files Browse the repository at this point in the history
  • Loading branch information
amclain committed Aug 21, 2023
1 parent 6fd539f commit 7843b1a
Showing 1 changed file with 16 additions and 4 deletions.
20 changes: 16 additions & 4 deletions lib/mix/tasks/compiler.ex
Original file line number Diff line number Diff line change
Expand Up @@ -14,26 +14,38 @@ defmodule Mix.Tasks.Compile.Speck do
hashes = hashes(files)
manifest = load_manifest()

# files_to_clean =
# Enum.map(manifest, fn {_hash, file} -> file end) -- files

# IO.inspect files_to_clean, label: "files_to_clean"

modified_files =
hashes
|> Enum.reject(&Enum.member?(manifest, &1))
|> Enum.map(fn {_hash, file} -> file end)

Enum.each(modified_files, fn file ->
Enum.each(modified_files, fn {hash, file, _module} ->
Mix.Shell.IO.info "Compiling #{file}"

compile(file)
|> Enum.each(fn {module, bytecode} ->
file
|> compile()
|> Enum.map(fn {module, bytecode} ->
path = Path.join([Mix.Project.app_path, "ebin", "#{module}.beam"])

File.mkdir_p(Path.dirname(path))
File.write(path, bytecode)

{hash, file, module}
end)
end)

# --------------------------------------------------------------------------
# TODO: Clean removed & renamed files
# --------------------------------------------------------------------------

files
|> hashes()
|> save_manifest()
|> save_manifest()

:ok
end
Expand Down

0 comments on commit 7843b1a

Please sign in to comment.