rebar_app_info (rebar v0.0.0+build.5492.ref67808dff)

View Source

Summary

Functions

adds a new profile with its own config to the app data

returns the information stored in the app's app file, or if none, from the .app.src file.

stores the information that would be returned from the app file, when reading from app_details/1.

finds the .app file for an app, if any.

sets the .app file for an app.

finds the .app.src file for an app, if any.

sets the .app.src file for an app. An app without such a file can explicitly be set with undefined.

finds the .app.src.script file for an app, if any.

sets the .app.src.script file for an app. An app without such a file can explicitly be set with undefined.

returns the list of applications the app depends on.

sets the list of applications the app depends on. Should be obtained from the app file.

given a set of override rules, modify the app info accordingly

applies and merges the profile configuration in the specified order of profiles (or for a single profile) and returns an app info record with the resulting configuration

get the dictionary of options under the default profile. Represents a root set prior to applying other profiles.

set the dictionary of options under the default profile. Useful when re-applying profile.

returns the level the app has in the lock files or in the dep tree.

sets the level the app has in the lock files or in the dep tree.

returns the list of dependencies

sets the list of dependencies.

returns the directory that contains the app.

sets the directory that contains the app.

discover a complete version of the app info with all fields set.

gets the directory where ebin files for the app should go

sets the directory where beam files should go

returns the directory to fetch the dep source to

returns the directory to fetch the dep source to

look up a value in the dictionary of options; fails if the key for it does not exist.

look up a value in the dictionary of options; returns a Default value otherwise.

checks whether all the build artifacts for an app to be considered valid are present.

returns the list of included_applications the app depends on.

sets the list of applications the app depends on. Should be obtained from the app file.

returns whether the app source exists in the deps dir

sets whether the app's source is available only set if the app's source is found in the expected dep directory

returns whether the app is a checkout app or not

sets whether the app is a checkout app or not

returns the lock status for the app

sets the lock status for the app

get the name of the app.

set the name of the app.

Build a new, empty, app info value. This is not of a lot of use and you probably won't be doing this much.

Build a new app info value with only the app name set.

Build a new app info value with only the name and version set.

build a complete version of the app info with all fields set.

build a complete version of the app info with all fields set.

build a complete version of the app info with all fields set.

returns the list of optional_applications the app depends on.

sets the list of optional applications the app depends on. Should be obtained from the app file.

get the dictionary of options for the app.

set the dictionary of options for the app.

returns the original version of the app (unevaluated if asking for a semver)

stores the original version of the app (unevaluated if asking for a semver)

returns the directory where build artifacts for the app should go

sets the directory where build artifacts for the app should go

returns the app's parent in the dep tree.

sets the app's parent.

gets the directory where private files for the app should go

returns the list of active profiles

sets the list of active profiles

sets a given value in the dictionary of options for the app.

finds the source specification for the app

sets the source specification for the app

update current app info opts by merging in a new dict of opts

update the opts based on the contents of a config file for the app

update the opts based on new deps, usually from an app's hex registry metadata

returns whether the app is valid (built) or not

sets whether the app is valid (built) or not. If left unset, rebar3 will do the detection of the status itself. Explicitly setting the value to undefined can force a re-evaluation.

checks whether the app can be built with the current Erlang/OTP version. If the check fails, the function raises an exception and displays an error.

returns the version of the app after evaluation

sets the evaluated vsn of the app

Types

app_vsn/0

-type app_vsn() :: binary() | string() | {git, short} | {git, long}.

project_type/0

-type project_type() :: rebar3 | mix | undefined.

rebar_dict/0

-type rebar_dict() :: dict:dict().

t/0

-type t() ::
          #app_info_t{name :: binary() | undefined,
                      app_file_src :: file:filename_all() | undefined,
                      app_file_src_script :: file:filename_all() | undefined,
                      app_file :: file:filename_all() | undefined,
                      original_vsn :: app_vsn() | undefined,
                      vsn :: app_vsn() | undefined,
                      parent :: binary() | root,
                      app_details :: list(),
                      applications :: list(),
                      included_applications :: [atom()],
                      optional_applications :: [atom()],
                      deps :: list(),
                      profiles :: [atom()],
                      default :: rebar_dict(),
                      opts :: rebar_dict(),
                      dep_level :: integer(),
                      fetch_dir :: file:name(),
                      dir :: file:name(),
                      out_dir :: file:name(),
                      ebin_dir :: file:name(),
                      source :: string() | tuple() | checkout | undefined,
                      is_lock :: boolean(),
                      is_checkout :: boolean(),
                      valid :: boolean() | undefined,
                      project_type :: project_type(),
                      is_available :: boolean()}.

Functions

add_to_profile(AppInfo, Profile, KVs)

-spec add_to_profile(t(), atom(), [{_, _}]) -> t().

adds a new profile with its own config to the app data

app_details(AppInfo)

-spec app_details(t()) -> list().

returns the information stored in the app's app file, or if none, from the .app.src file.

app_details(AppInfo, AppDetails)

-spec app_details(t(), list()) -> t().

stores the information that would be returned from the app file, when reading from app_details/1.

app_file(App_info_t)

-spec app_file(t()) -> file:filename_all() | undefined.

finds the .app file for an app, if any.

app_file(AppInfo, AppFile)

-spec app_file(t(), file:filename_all() | undefined) -> t().

sets the .app file for an app.

app_file_src(App_info_t)

-spec app_file_src(t()) -> file:filename_all() | undefined.

finds the .app.src file for an app, if any.

app_file_src(AppInfo, AppFileSrc)

-spec app_file_src(t(), file:filename_all() | undefined) -> t().

sets the .app.src file for an app. An app without such a file can explicitly be set with undefined.

app_file_src_script(App_info_t)

-spec app_file_src_script(t()) -> file:filename_all() | undefined.

finds the .app.src.script file for an app, if any.

app_file_src_script(AppInfo, AppFileSrcScript)

-spec app_file_src_script(t(), file:filename_all()) -> t().

sets the .app.src.script file for an app. An app without such a file can explicitly be set with undefined.

app_to_map(App_info_t)

-spec app_to_map(t()) ->
                    #{name := atom(),
                      vsn := app_vsn(),
                      applications := [atom()],
                      included_applications := [atom()],
                      optional_applications := [atom()],
                      dir := file:name(),
                      out_dir := file:name(),
                      ebin_dir := file:name(),
                      link := false}.

applications(App_info_t)

-spec applications(t()) -> list().

returns the list of applications the app depends on.

applications(AppInfo, Applications)

-spec applications(t(), list()) -> t().

sets the list of applications the app depends on. Should be obtained from the app file.

apply_overrides(Overrides, AppInfo)

-spec apply_overrides(list(), t()) -> t().

given a set of override rules, modify the app info accordingly

apply_profiles(AppInfo, Profile)

-spec apply_profiles(t(), atom() | [atom(), ...]) -> t().

applies and merges the profile configuration in the specified order of profiles (or for a single profile) and returns an app info record with the resulting configuration

default(App_info_t)

-spec default(t()) -> rebar_dict().

get the dictionary of options under the default profile. Represents a root set prior to applying other profiles.

default(AppInfo, Default)

-spec default(t(), rebar_dict()) -> t().

set the dictionary of options under the default profile. Useful when re-applying profile.

dep_level(App_info_t)

-spec dep_level(t()) -> non_neg_integer().

returns the level the app has in the lock files or in the dep tree.

dep_level(AppInfo, Level)

-spec dep_level(t(), non_neg_integer()) -> t().

sets the level the app has in the lock files or in the dep tree.

deps(App_info_t)

-spec deps(t()) -> list().

returns the list of dependencies

deps(AppInfo, Deps)

-spec deps(t(), list()) -> t().

sets the list of dependencies.

dir(App_info_t)

-spec dir(t()) -> file:name().

returns the directory that contains the app.

dir(AppInfo, Dir)

-spec dir(t(), file:name()) -> t().

sets the directory that contains the app.

discover(Dir, State)

-spec discover(file:filename_all(), rebar_state:t()) -> {ok, t()} | not_found.

discover a complete version of the app info with all fields set.

ebin_dir(App_info_t)

-spec ebin_dir(t()) -> file:name().

gets the directory where ebin files for the app should go

ebin_dir(AppInfo, EbinDir)

-spec ebin_dir(t(), file:name()) -> t().

sets the directory where beam files should go

fetch_dir(App_info_t)

-spec fetch_dir(t()) -> file:name().

returns the directory to fetch the dep source to

fetch_dir(AppInfo, FetchDir)

-spec fetch_dir(t(), file:name()) -> t().

returns the directory to fetch the dep source to

get(AppInfo, Key)

-spec get(t(), term()) -> term().

look up a value in the dictionary of options; fails if the key for it does not exist.

get(AppInfo, Key, Default)

-spec get(t(), term(), term()) -> term().

look up a value in the dictionary of options; returns a Default value otherwise.

has_all_artifacts(App_info_t)

-spec has_all_artifacts(#app_info_t{name :: binary() | undefined,
                                    app_file_src :: file:filename_all() | undefined,
                                    app_file_src_script :: file:filename_all() | undefined,
                                    app_file :: file:filename_all() | undefined,
                                    original_vsn :: app_vsn() | undefined,
                                    vsn :: app_vsn() | undefined,
                                    parent :: binary() | root,
                                    app_details :: list(),
                                    applications :: list(),
                                    included_applications :: [atom()],
                                    optional_applications :: [atom()],
                                    deps :: list(),
                                    profiles :: [atom()],
                                    default :: rebar_dict(),
                                    opts :: rebar_dict(),
                                    dep_level :: integer(),
                                    fetch_dir :: file:name(),
                                    dir :: file:name(),
                                    out_dir :: file:name(),
                                    ebin_dir :: file:name(),
                                    source :: string() | tuple() | checkout | undefined,
                                    is_lock :: boolean(),
                                    is_checkout :: boolean(),
                                    valid :: boolean() | undefined,
                                    project_type :: project_type(),
                                    is_available :: boolean()}) ->
                           true | {false, file:filename()}.

checks whether all the build artifacts for an app to be considered valid are present.

included_applications(App_info_t)

-spec included_applications(t()) -> list().

returns the list of included_applications the app depends on.

included_applications(AppInfo, Applications)

-spec included_applications(t(), list()) -> t().

sets the list of applications the app depends on. Should be obtained from the app file.

is_available(App_info_t)

-spec is_available(t()) -> boolean().

returns whether the app source exists in the deps dir

is_available(AppInfo, IsAvailable)

-spec is_available(t(), boolean()) -> t().

sets whether the app's source is available only set if the app's source is found in the expected dep directory

is_checkout(App_info_t)

-spec is_checkout(t()) -> boolean().

returns whether the app is a checkout app or not

is_checkout(AppInfo, IsCheckout)

-spec is_checkout(t(), boolean()) -> t().

sets whether the app is a checkout app or not

is_lock(App_info_t)

-spec is_lock(t()) -> boolean().

returns the lock status for the app

is_lock(AppInfo, IsLock)

-spec is_lock(t(), boolean()) -> t().

sets the lock status for the app

name(App_info_t)

-spec name(t()) -> binary().

get the name of the app.

name(AppInfo, AppName)

-spec name(t(), atom() | binary() | string()) -> t().

set the name of the app.

new()

-spec new() -> t().

Build a new, empty, app info value. This is not of a lot of use and you probably won't be doing this much.

new(AppName)

-spec new(atom() | binary() | string()) -> {ok, t()}.

Build a new app info value with only the app name set.

new(AppName, Vsn)

-spec new(atom() | binary() | string(), app_vsn()) -> {ok, t()}.

Build a new app info value with only the name and version set.

new(AppName, Vsn, Dir)

-spec new(atom() | binary() | string(), app_vsn(), file:name()) -> {ok, t()}.

build a complete version of the app info with all fields set.

new(AppName, Vsn, Dir, Deps)

-spec new(atom() | binary() | string(), app_vsn(), file:name(), list()) -> {ok, t()}.

build a complete version of the app info with all fields set.

new(Parent, AppName, Vsn, Dir, Deps)

-spec new(atom() | binary(), atom() | binary() | string(), app_vsn(), file:name(), list()) -> {ok, t()}.

build a complete version of the app info with all fields set.

optional_applications(App_info_t)

-spec optional_applications(t()) -> list().

returns the list of optional_applications the app depends on.

optional_applications(AppInfo, Applications)

-spec optional_applications(t(), list()) -> t().

sets the list of optional applications the app depends on. Should be obtained from the app file.

opts(App_info_t)

-spec opts(t()) -> rebar_dict().

get the dictionary of options for the app.

opts(AppInfo, Opts)

-spec opts(t(), rebar_dict()) -> t().

set the dictionary of options for the app.

original_vsn(App_info_t)

-spec original_vsn(t()) -> app_vsn().

returns the original version of the app (unevaluated if asking for a semver)

original_vsn(AppInfo, Vsn)

-spec original_vsn(t(), app_vsn()) -> t().

stores the original version of the app (unevaluated if asking for a semver)

out_dir(App_info_t)

-spec out_dir(t()) -> file:name().

returns the directory where build artifacts for the app should go

out_dir(AppInfo, OutDir)

-spec out_dir(t(), file:name()) -> t().

sets the directory where build artifacts for the app should go

parent(App_info_t)

-spec parent(t()) -> root | binary().

returns the app's parent in the dep tree.

parent(AppInfo, Parent)

-spec parent(t(), binary() | root) -> t().

sets the app's parent.

priv_dir(App_info_t)

-spec priv_dir(t()) -> file:name().

gets the directory where private files for the app should go

profiles(App_info_t)

-spec profiles(t()) -> list().

returns the list of active profiles

profiles(AppInfo, Profiles)

-spec profiles(t(), list()) -> t().

sets the list of active profiles

project_type(App_info_t)

-spec project_type(t()) -> atom().

project_type(AppInfo, ProjectType)

-spec project_type(t(), atom()) -> t().

set(AppInfo, Key, Value)

-spec set(t(), any(), any()) -> t().

sets a given value in the dictionary of options for the app.

source(App_info_t)

-spec source(t()) -> string() | tuple().

finds the source specification for the app

source(AppInfo, Source)

-spec source(t(), string() | tuple() | checkout | undefined) -> t().

sets the source specification for the app

update_opts(AppInfo, Opts)

-spec update_opts(t(), rebar_dict()) -> t().

update current app info opts by merging in a new dict of opts

update_opts(AppInfo, Opts, Config)

-spec update_opts(t(), rebar_dict(), [any()]) -> t().

update the opts based on the contents of a config file for the app

update_opts_deps(AppInfo, Deps)

-spec update_opts_deps(t(), [any()]) -> t().

update the opts based on new deps, usually from an app's hex registry metadata

valid(AppInfo)

-spec valid(t()) -> boolean().

returns whether the app is valid (built) or not

valid(AppInfo, Valid)

-spec valid(t(), boolean() | undefined) -> t().

sets whether the app is valid (built) or not. If left unset, rebar3 will do the detection of the status itself. Explicitly setting the value to undefined can force a re-evaluation.

verify_otp_vsn(AppInfo)

-spec verify_otp_vsn(t()) -> ok | no_return().

checks whether the app can be built with the current Erlang/OTP version. If the check fails, the function raises an exception and displays an error.

vsn(App_info_t)

-spec vsn(t()) -> app_vsn().

returns the version of the app after evaluation

vsn(AppInfo, Vsn)

-spec vsn(t(), app_vsn()) -> t().

sets the evaluated vsn of the app