Mix.Project
A module that provides conveniences for defining and working with projects.
In order to configure Mix, a developer needs to use
Mix.Project in a module and define a function named
project that returns a keyword list with configuration.
defmodule MyApp do
use Mix.Project
def project do
[
app: :my_app,
vsn: "0.6.0"
]
end
end
After being defined, the configuration for this project can be read
as Mix.project/0. Notice that Mix.project/0 won't fail if a
project is not defined; this allows many mix tasks to work
even without a project.
In case the developer needs a project or wants to access a special
function in the project, he/she can call Mix.Project.get!/0
which fails with Mix.NoProjectError in case a project is not
defined.
Summary
| app_path(config \\ config()) | Returns the application path inside the build. The returned path will be expanded |
| build_path(config \\ config()) | Returns the build path for this project. The returned path will be expanded |
| build_structure(config \\ config(), opts \\ []) | Builds the project structure for the current application |
| compile_path(config \\ config()) | Returns the paths this project compiles to. The returned path will be expanded |
| config() | Returns the project configuration for the current environment. This configuration is cached once the project is pushed into the stack |
| config_files() | Returns a list of project configuration files as known by this project. This function is usually used in compilation tasks to trigger a full recompilation whenever such configuration files change |
| deps_path(config \\ config()) | Returns the path to store dependencies for this project. The returned path will be expanded |
| get!() | Same as |
| get() | Retrieves the current project, |
| in_project(app, path, post_config \\ [], fun) | Runs the given |
| load_paths() | Returns all load paths for this project |
| manifest_path(config \\ config()) | The path to store manifests. By default they are stored in the same app path but it may be changed in future releases |
| umbrella?() | Returns |
Functions
Returns the application path inside the build. The returned path will be expanded.
Examples
Mix.Project.app_path
#=> "/path/to/project/_build/shared/lib/app"
Returns the build path for this project. The returned path will be expanded.
Examples
Mix.Project.build_path
#=> "/path/to/project/_build/shared"
If :buildperenvironment is set to true, it will create a new build per environment:
Mix.env
#=> :dev
Mix.Project.build_path
#=> "/path/to/project/_build/dev"
Builds the project structure for the current application.
Options
:symlink_ebin- Symlink ebin instead of copying it
Returns the paths this project compiles to. The returned path will be expanded.
Examples
Mix.Project.compile_path
#=> "/path/to/project/_build/shared/lib/app/priv"
Returns the project configuration for the current environment. This configuration is cached once the project is pushed into the stack.
Returns a list of project configuration files as known by this project. This function is usually used in compilation tasks to trigger a full recompilation whenever such configuration files change.
By default it includes the mix.exs file and the lock manifest.
Returns the path to store dependencies for this project. The returned path will be expanded.
Examples
Mix.Project.deps_path
#=> "/path/to/project/deps"
Retrieves the current project, nil if there is no
current project (i.e. there is no mixfile in the current
project).
If you expect a project to be defined, i.e. it is a
requirement of the current task, you should call
get!/0 instead.
Same as get/0, but raises an exception if there is no current project.
This is usually called by tasks that need additional
functions on the project to be defined. Since such
tasks usually depend on a project being defined, this
function raises Mix.NoProjectError in case no project
is available.
Runs the given fun inside the given project by changing
the current working directory and loading the given project
onto the project stack.
The path to store manifests. By default they are stored in the same app path but it may be changed in future releases.
The returned path will be expanded.
Examples
Mix.Project.manifest_path
#=> "/path/to/project/_build/shared/lib/app"