summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/rebar_app_discover.erl6
-rw-r--r--src/rebar_app_info.erl22
-rw-r--r--src/rebar_prv_install_deps.erl21
-rw-r--r--src/rebar_utils.erl4
4 files changed, 24 insertions, 29 deletions
diff --git a/src/rebar_app_discover.erl b/src/rebar_app_discover.erl
index 7713ee6..a4cfe4c 100644
--- a/src/rebar_app_discover.erl
+++ b/src/rebar_app_discover.erl
@@ -55,7 +55,7 @@ find_apps(LibDirs, Validate) ->
find_app(AppDir, Validate)
end, all_app_dirs(LibDirs)).
--spec find_app(list(), boolean()) -> rebar_app_info:t() | false.
+-spec find_app(file:filename_all(), valid | invalid | all) -> {true, rebar_app_info:t()} | false.
find_app(AppDir, Validate) ->
AppFile = filelib:wildcard(filename:join([AppDir, "ebin", "*.app"])),
AppSrcFile = filelib:wildcard(filename:join([AppDir, "src", "*.app.src"])),
@@ -140,7 +140,7 @@ validate_application_info(AppInfo) ->
false
end.
--spec get_modules_list(file:name(), proplists:proplist()) ->
+-spec get_modules_list(file:filename_all(), proplists:proplist()) ->
{ok, list()} |
{warning, Reason::term()} |
{error, Reason::term()}.
@@ -152,7 +152,7 @@ get_modules_list(AppFile, AppDetail) ->
{ok, ModulesList}
end.
--spec has_all_beams(file:name(), list()) -> boolean().
+-spec has_all_beams(file:filename_all(), list()) -> boolean().
has_all_beams(EbinDir, [Module | ModuleList]) ->
BeamFile = filename:join([EbinDir,
ec_cnv:to_list(Module) ++ ".beam"]),
diff --git a/src/rebar_app_info.erl b/src/rebar_app_info.erl
index be35f79..ac668e2 100644
--- a/src/rebar_app_info.erl
+++ b/src/rebar_app_info.erl
@@ -33,9 +33,9 @@
-export_type([t/0]).
-record(app_info_t, {name :: binary(),
- app_file_src :: file:name() | undefined,
- app_file :: file:name(),
- config :: rebar_config:config() | undefined,
+ app_file_src :: file:filename_all() | undefined,
+ app_file :: file:filename_all() | undefined,
+ config :: rebar_state:t() | undefined,
original_vsn :: string() | undefined,
app_details=[] :: list(),
deps=[] :: list(),
@@ -87,7 +87,7 @@ new(AppName, Vsn, Dir, Deps) ->
deps=Deps}}.
%% @doc discover a complete version of the app info with all fields set.
--spec discover(file:name()) -> {ok, t()} | not_found.
+-spec discover(file:filename_all()) -> {ok, t()} | not_found.
discover(Dir) ->
case rebar_app_discover:find_app(Dir, all) of
{true, AppInfo} ->
@@ -104,15 +104,15 @@ name(#app_info_t{name=Name}) ->
name(AppInfo=#app_info_t{}, AppName) ->
AppInfo#app_info_t{name=ec_cnv:to_binary(AppName)}.
--spec config(t()) -> rebar_config:confg().
+-spec config(t()) -> rebar_state:t().
config(#app_info_t{config=Config}) ->
Config.
--spec config(t(), rebar_config:confg()) -> t().
+-spec config(t(), rebar_state:t()) -> t().
config(AppInfo=#app_info_t{}, Config) ->
AppInfo#app_info_t{config=Config}.
--spec app_file_src(t()) -> file:name().
+-spec app_file_src(t()) -> file:filename_all() | undefined.
app_file_src(#app_info_t{app_file_src=undefined, dir=Dir, name=Name}) ->
AppFileSrc = filename:join([ec_cnv:to_list(Dir), "src", ec_cnv:to_list(Name)++".app.src"]),
case filelib:is_file(AppFileSrc) of
@@ -124,11 +124,11 @@ app_file_src(#app_info_t{app_file_src=undefined, dir=Dir, name=Name}) ->
app_file_src(#app_info_t{app_file_src=AppFileSrc}) ->
ec_cnv:to_list(AppFileSrc).
--spec app_file_src(t(), file:name()) -> t().
+-spec app_file_src(t(), file:filename_all()) -> t().
app_file_src(AppInfo=#app_info_t{}, AppFileSrc) ->
AppInfo#app_info_t{app_file_src=ec_cnv:to_list(AppFileSrc)}.
--spec app_file(t()) -> file:name().
+-spec app_file(t()) -> file:filename_all() | undefined.
app_file(#app_info_t{app_file=undefined, dir=Dir, name=Name}) ->
AppFile = filename:join([ec_cnv:to_list(Dir), "ebin", ec_cnv:to_list(Name)++".app"]),
case filelib:is_file(AppFile) of
@@ -140,9 +140,9 @@ app_file(#app_info_t{app_file=undefined, dir=Dir, name=Name}) ->
app_file(#app_info_t{app_file=AppFile}) ->
AppFile.
--spec app_file(t(), file:name()) -> t().
+-spec app_file(t(), file:filename_all()) -> t().
app_file(AppInfo=#app_info_t{}, AppFile) ->
- AppInfo#app_info_t{app_file=ec_cnv:to_list(AppFile)}.
+ AppInfo#app_info_t{app_file=AppFile}.
-spec app_details(t()) -> list().
app_details(#app_info_t{app_details=AppDetails}) ->
diff --git a/src/rebar_prv_install_deps.erl b/src/rebar_prv_install_deps.erl
index daae204..9180cc4 100644
--- a/src/rebar_prv_install_deps.erl
+++ b/src/rebar_prv_install_deps.erl
@@ -114,11 +114,10 @@ handle_deps(State, Deps, Update) ->
%% Find binary deps needed
{ok, S} = rlx_depsolver:solve(Graph, BinaryDeps1),
%% Create app_info record for each binary dep
- lists:map(fun({Name, Vsn}) ->
+ lists:map(fun(Pkg) ->
AppInfo = package_to_app(DepsDir
,Packages
- ,Name
- ,Vsn),
+ ,Pkg),
maybe_fetch(AppInfo, Update),
AppInfo
end, S)
@@ -127,7 +126,7 @@ handle_deps(State, Deps, Update) ->
AllDeps = lists:keymerge(2
,rebar_state:src_apps(State2)
,Solved),
- io:format("All ~p~n", [AllDeps]),
+
%% Sort all apps to build order
State3 = rebar_state:set(State2, all_deps, AllDeps),
{ok, State3}.
@@ -141,15 +140,11 @@ handle_deps(State, Deps, Update) ->
is_valid(App) ->
rebar_app_info:valid(App).
--spec package_to_app(file:filename_all(), dict:dict(), rlx_depsolver:name(), rlx_depsolver:vsn()) -> rebar_app_info:t().
-package_to_app(DepsDir, Packages, Name, Vsn) ->
- FmtVsn = case Vsn of
- 'NO_VSN' ->
- <<"NO_VSN">>;
- _ ->
- iolist_to_binary(rlx_depsolver:format_version(Vsn))
- end,
-
+-spec package_to_app(file:filename_all(), dict:dict(),
+ rlx_depsolver:pkg()) -> rebar_app_info:t().
+package_to_app(DepsDir, Packages, Pkg={_, Vsn}) ->
+ Name = ec_cnv:to_binary(rlx_depsolver:dep_pkg(Pkg)),
+ FmtVsn = iolist_to_binary(rlx_depsolver:format_version(Vsn)),
{ok, P} = dict:find({Name, FmtVsn}, Packages),
PkgDeps = proplists:get_value(<<"deps">>, P),
Link = proplists:get_value(<<"link">>, P),
diff --git a/src/rebar_utils.erl b/src/rebar_utils.erl
index 742cad2..5397aa8 100644
--- a/src/rebar_utils.erl
+++ b/src/rebar_utils.erl
@@ -325,7 +325,7 @@ delayed_halt(Code) ->
end.
%% @doc Return list of erl_opts
--spec erl_opts(rebar_state:config()) -> list().
+-spec erl_opts(rebar_state:t()) -> list().
erl_opts(Config) ->
RawErlOpts = filter_defines(rebar_state:get(Config, erl_opts, []), []),
Defines = [{d, list_to_atom(D)} ||
@@ -359,7 +359,7 @@ processing_base_dir(State, Dir) ->
%% points to the rebar executable used to execute the currently running
%% command. The environment is not modified if rebar was invoked
%% programmatically.
--spec patch_env(rebar_state:config(), [{string(), string()}])
+-spec patch_env(rebar_state:t(), [{string(), string()}])
-> [{string(), string()}].
patch_env(Config, []) ->
%% If we reached an empty list, the env did not contain the REBAR variable.