Skip to content

Commit 13eab25

Browse files
author
José Valim
committed
Rename fetched to loaded and add a manifest_path
1 parent 2854fec commit 13eab25

30 files changed

+130
-92
lines changed

lib/mix/lib/mix/deps.ex

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -35,13 +35,13 @@ defmodule Mix.Deps do
3535
3636
Inside Mix, those dependencies are converted to a `Mix.Dep` record.
3737
This module provides conveniences to work with those dependencies
38-
and the dependencies are usually in two specific states: fetched and
39-
unfetched.
38+
and the dependencies are usually in two specific states: loaded and
39+
unloaded.
4040
41-
When a dependency is unfetched, it means Mix only parsed its specification
42-
and made no attempt to actually fetch the dependency or validate its
43-
status. When the dependency is fetched, it means Mix attempted to fetch
44-
and validate it, the status is set in the status field.
41+
When a dependency is unloaded, it means Mix only parsed its specification
42+
and made no attempt to actually load the dependency or validate its
43+
status. When the dependency is loaded, it means Mix attempted to fetch,
44+
load and validate it, the status is set in the status field.
4545
4646
## Mix options
4747
@@ -80,7 +80,7 @@ defmodule Mix.Deps do
8080
Returns all children dependencies for the current project,
8181
as well as the defined apps in case of umbrella projects.
8282
The children dependencies returned by this function were
83-
not fetched yet.
83+
not loaded yet.
8484

8585
## Exceptions
8686

@@ -90,28 +90,28 @@ defmodule Mix.Deps do
9090
defdelegate children(), to: Mix.Deps.Retriever
9191
9292
@doc """
93-
Returns fetched dependencies recursively as a `Mix.Dep` record.
93+
Returns loaded dependencies recursively as a `Mix.Dep` record.
9494

9595
## Exceptions
9696

9797
This function raises an exception if any of the dependencies
9898
provided in the project are in the wrong format.
9999
"""
100-
def fetched do
100+
def loaded do
101101
{ deps, _ } = Mix.Deps.Converger.all(nil, fn(dep, acc) -> { dep, acc } end)
102102
Mix.Deps.Converger.topsort(deps)
103103
end
104104
105105
@doc """
106-
Receives a list of dependency names and returns fetched dependency
106+
Receives a list of dependency names and returns loaded dependency
107107
records. Logs a message if the dependency could not be found.
108108

109109
## Exceptions
110110

111111
This function raises an exception if any of the dependencies
112112
provided in the project are in the wrong format.
113113
"""
114-
def fetched_by_name(given, all_deps // fetched) do
114+
def loaded_by_name(given, all_deps // loaded) do
115115
# Ensure all apps are atoms
116116
apps = to_app_names(given)
117117
@@ -130,7 +130,7 @@ defmodule Mix.Deps do
130130
end
131131

132132
@doc """
133-
Maps and reduces over all unfetched dependencies, one by one.
133+
Maps and reduces over all unloaded dependencies, one by one.
134134
135135
This is useful in case you want to retrieve the dependency
136136
tree for a project but process and change them along the way.
@@ -145,7 +145,7 @@ defmodule Mix.Deps do
145145
This function raises an exception if any of the dependencies
146146
provided in the project are in the wrong format.
147147
"""
148-
def unfetched(acc, callback) do
148+
def unloaded(acc, callback) do
149149
{ deps, acc } = Mix.Deps.Converger.all(acc, callback)
150150
{ Mix.Deps.Converger.topsort(deps), acc }
151151
end
@@ -159,10 +159,10 @@ defmodule Mix.Deps do
159159
This function raises an exception if any of the dependencies
160160
provided in the project are in the wrong format.
161161
"""
162-
def unfetched_by_name(given, acc, callback) do
162+
def unloaded_by_name(given, acc, callback) do
163163
names = to_app_names(given)
164164

165-
unfetched(acc, fn(dep, acc) ->
165+
unloaded(acc, fn(dep, acc) ->
166166
if dep.app in names do
167167
callback.(dep, acc)
168168
else
@@ -177,7 +177,7 @@ defmodule Mix.Deps do
177177
project onto the project stack.
178178
179179
This function only works for mix dependencies.
180-
It is expected a fetched dependency as argument.
180+
It is expected a loaded dependency as argument.
181181
"""
182182
def in_dependency(dep, post_config // [], fun)
183183

@@ -339,7 +339,7 @@ defmodule Mix.Deps do
339339

340340
@doc """
341341
Returns all load paths for the dependency.
342-
Expects a fetched dependency.
342+
Expects a loaded dependency.
343343
"""
344344
def load_paths(Mix.Dep[manager: :mix, opts: opts]) do
345345
[Path.join(opts[:build], "ebin")]
@@ -388,7 +388,7 @@ defmodule Mix.Deps do
388388
@doc false
389389
# Called by deps.get and deps.update
390390
def finalize(all_deps, apps, lock, opts) do
391-
deps = fetched_by_name(apps, all_deps)
391+
deps = loaded_by_name(apps, all_deps)
392392
393393
# Do not attempt to compile dependencies that are not available.
394394
# mix deps.check at the end will emit proper status in case they failed.

lib/mix/lib/mix/deps/converger.ex

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -95,9 +95,9 @@ defmodule Mix.Deps.Converger do
9595
{ dep, rest } = callback.(dep, rest)
9696

9797
# After we invoke the callback (which may actually check out the
98-
# dependency), we fetch the dependency including its latest info
98+
# dependency), we load the dependency including its latest info
9999
# and children information.
100-
{ dep, children } = Mix.Deps.Retriever.fetch(dep, config)
100+
{ dep, children } = Mix.Deps.Retriever.load(dep, config)
101101
children = reject_non_fullfilled_optional(children, current_breadths)
102102
dep = dep.deps(Enum.map(children, &(&1.app)))
103103

lib/mix/lib/mix/deps/lock.ex

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,16 +10,16 @@ defmodule Mix.Deps.Lock do
1010
Returns the manifest file for dependencies.
1111
"""
1212
def manifest do
13-
Path.join(Mix.Project.compile_path, @manifest)
13+
Path.join(Mix.Project.manifest_path, @manifest)
1414
end
1515

1616
@doc """
1717
Touches the manifest timestamp and updates the elixir version.
1818
"""
1919
def touch do
20-
compile_path = Mix.Project.compile_path
21-
File.mkdir_p!(compile_path)
22-
File.write!(Path.join(compile_path, @manifest), System.version)
20+
manifest_path = Mix.Project.manifest_path
21+
File.mkdir_p!(manifest_path)
22+
File.write!(Path.join(manifest_path, @manifest), System.version)
2323
end
2424

2525
@doc """

lib/mix/lib/mix/deps/retriever.ex

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,14 +13,14 @@ defmodule Mix.Deps.Retriever do
1313
scms = Mix.SCM.available
1414
from = Path.absname("mix.exs")
1515
Enum.map(Mix.project[:deps] || [], &to_dep(&1, scms, from)) ++
16-
Mix.Deps.Umbrella.unfetched
16+
Mix.Deps.Umbrella.unloaded
1717
end
1818

1919
@doc """
20-
Fetches the given dependency information, including its
20+
Loads the given dependency information, including its
2121
latest status and children.
2222
"""
23-
def fetch(dep, config) do
23+
def load(dep, config) do
2424
Mix.Dep[manager: manager, scm: scm, opts: opts] = dep
2525
dep = dep.status(scm_status(scm, opts))
2626
dest = opts[:dest]

lib/mix/lib/mix/deps/umbrella.ex

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@ defmodule Mix.Deps.Umbrella do
22
@moduledoc false
33

44
@doc """
5-
Gets all umbrella dependencies in unfetched format.
5+
Gets all umbrella dependencies in unloaded format.
66
"""
7-
def unfetched do
7+
def unloaded do
88
config = Mix.project
99

1010
if apps_path = config[:apps_path] do
@@ -21,14 +21,14 @@ defmodule Mix.Deps.Umbrella do
2121
end
2222

2323
@doc """
24-
Gets all umbrella dependencies in fetched format.
24+
Gets all umbrella dependencies in the loaded format.
2525
"""
26-
def fetched do
27-
deps = unfetched
26+
def loaded do
27+
deps = unloaded
2828
apps = Enum.map(deps, &(&1.app))
2929

3030
Enum.map(deps, fn(umbrella_dep) ->
31-
{ umbrella_dep, deps } = Mix.Deps.Retriever.fetch(umbrella_dep, [])
31+
{ umbrella_dep, deps } = Mix.Deps.Retriever.load(umbrella_dep, [])
3232
deps = lc Mix.Dep[] = dep inlist deps,
3333
Mix.Deps.available?(dep),
3434
dep.app in apps,

lib/mix/lib/mix/project.ex

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -192,6 +192,23 @@ defmodule Mix.Project do
192192
config[:build_path] || Path.expand("_build")
193193
end
194194

195+
@doc """
196+
The path to store manifests. By default they are
197+
stored in the same app path but it may be changed
198+
in future releases.
199+
200+
The returned path will be expanded.
201+
202+
## Examples
203+
204+
Mix.Project.manifest_path
205+
#=> "/path/to/project/_build/lib/app"
206+
207+
"""
208+
def manifest_path(config // config()) do
209+
app_path(config)
210+
end
211+
195212
@doc """
196213
Returns the library path inside the build.
197214
The returned path will be expanded.

lib/mix/lib/mix/task.ex

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -211,7 +211,7 @@ defmodule Mix.Task do
211211
recursive = recursive(module)
212212

213213
if umbrella? && recursive && Mix.ProjectStack.enable_recursion do
214-
res = lc Mix.Dep[app: app, opts: opts] inlist Mix.Deps.Umbrella.fetched do
214+
res = lc Mix.Dep[app: app, opts: opts] inlist Mix.Deps.Umbrella.loaded do
215215
Mix.Project.in_project(app, opts[:path], fun)
216216
end
217217
Mix.ProjectStack.disable_recursion

lib/mix/lib/mix/tasks/clean.ex

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,7 @@ defmodule Mix.Tasks.Clean do
2424
File.rm(manifest)
2525
end)
2626

27-
File.rm_rf(Mix.Project.compile_path)
28-
27+
File.rm_rf(Mix.Project.app_path)
2928
if opts[:all], do: Mix.Task.run("deps.clean", args)
3029
end
3130
end

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -261,7 +261,7 @@ defmodule Mix.Tasks.Compile.Elixir do
261261
Returns Elixir manifests.
262262
"""
263263
def manifests, do: [manifest]
264-
defp manifest, do: Path.join(Mix.Project.compile_path, @manifest)
264+
defp manifest, do: Path.join(Mix.Project.manifest_path, @manifest)
265265

266266
@doc """
267267
Compiles stale Elixir files.

lib/mix/lib/mix/tasks/compile.erlang.ex

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ defmodule Mix.Tasks.Compile.Erlang do
9696
Returns Erlang manifests.
9797
"""
9898
def manifests, do: [manifest]
99-
defp manifest, do: Path.join(Mix.Project.compile_path, @manifest)
99+
defp manifest, do: Path.join(Mix.Project.manifest_path, @manifest)
100100

101101
@doc """
102102
Extracts the extensions from the mappings, automatically
@@ -110,7 +110,7 @@ defmodule Mix.Tasks.Compile.Erlang do
110110
For example, a simple compiler for Lisp Flavored Erlang
111111
would be implemented like:
112112
113-
compile_mappings "ebin/.compile.lfe",
113+
compile_mappings ".compile.lfe",
114114
[{ "src", "ebin" }],
115115
:lfe, :beam, opts[:force], fn
116116
input, output ->

0 commit comments

Comments
 (0)