Skip to content

Commit

Permalink
fix IO.Util.staleness when all target(s) or dependencies(s) were absent
Browse files Browse the repository at this point in the history
  • Loading branch information
breunigs committed Jul 27, 2024
1 parent f979cf7 commit c0bea10
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions lib/util/io_util.ex
Original file line number Diff line number Diff line change
Expand Up @@ -112,10 +112,10 @@ defmodule Util.IO do
dep = Path.relative_to_cwd(dep_mod.newest.path)

cond do
target_mod == nil ->
target_mod.oldest == nil ->
{true, "target #{Path.relative_to_cwd(target)} doesn't exist"}

dep_mod == nil ->
dep_mod.newest == nil ->
deps = dependencies |> Enum.map(&Path.relative_to_cwd/1) |> Enum.join(", ")
{false, "none of the dependencies (#{deps}) exist"}

Expand All @@ -127,7 +127,9 @@ defmodule Util.IO do
end
end

defp modification_times(paths) do
@typep file_time :: %{path: binary(), mtime: integer()} | nil
@spec modification_times(binary() | [binary()]) :: %{oldest: file_time(), newest: file_time()}
def modification_times(paths) do
paths
|> List.wrap()
|> Parallel.flat_map(&include_descendants/1)
Expand Down

0 comments on commit c0bea10

Please sign in to comment.