summaryrefslogtreecommitdiff
path: root/lib/mix/lib/mix/project_stack.ex
diff options
context:
space:
mode:
Diffstat (limited to 'lib/mix/lib/mix/project_stack.ex')
-rw-r--r--lib/mix/lib/mix/project_stack.ex25
1 files changed, 21 insertions, 4 deletions
diff --git a/lib/mix/lib/mix/project_stack.ex b/lib/mix/lib/mix/project_stack.ex
index 6b2b79414..d13b23e3b 100644
--- a/lib/mix/lib/mix/project_stack.ex
+++ b/lib/mix/lib/mix/project_stack.ex
@@ -76,17 +76,27 @@ defmodule Mix.ProjectStack do
end)
end
+ # We include the year 2000 as a minimum value in case we don't
+ # have any config files, which would return 0 and then trigger
+ # any stale sources.
+ @minimum_mtime 946_684_800
+
@spec config_mtime() :: integer
def config_mtime() do
mtime_or_files =
get_stack(fn
[%{config_mtime: nil, config_files: files} | _] -> files
[%{config_mtime: mtime} | _] -> mtime
- [] -> 0
+ [] -> @minimum_mtime
end)
if is_list(mtime_or_files) do
- mtime = mtime_or_files |> Enum.map(&Mix.Utils.last_modified/1) |> Enum.max()
+ mtime =
+ mtime_or_files
+ |> Enum.map(&Mix.Utils.last_modified/1)
+ |> Enum.max()
+ |> max(@minimum_mtime)
+
update_stack(fn [h | t] -> {mtime, [%{h | config_mtime: mtime} | t]} end)
else
mtime_or_files
@@ -119,6 +129,14 @@ defmodule Mix.ProjectStack do
end)
end
+ @spec project_file() :: binary | nil
+ def project_file() do
+ get_stack(fn
+ [h | _] -> h.file
+ [] -> nil
+ end)
+ end
+
@spec compile_env([term] | :unset) :: [term] | :unset
def compile_env(compile_env) do
update_stack(fn
@@ -214,7 +232,6 @@ defmodule Mix.ProjectStack do
# because we don't need to print anything unless another
# project takes ahold of the shell.
io_done? = stack == []
-
config = Keyword.merge(config, post_config)
manifest_file = Path.join(Mix.Project.manifest_path(config), @manifest)
parent_config = peek_config_files(config[:inherit_parent_config_files], stack)
@@ -227,7 +244,7 @@ defmodule Mix.ProjectStack do
recursing?: false,
io_done: io_done?,
config_apps: [],
- config_files: [manifest_file, file | parent_config],
+ config_files: [manifest_file | parent_config],
config_mtime: nil,
after_compiler: %{},
compile_env: :unset