Parcourir la source

fixed up a few unknown types

pull/3/head
Tristan Sloughter il y a 10 ans
Parent
révision
ffe8924f3b
4 fichiers modifiés avec 24 ajouts et 29 suppressions
  1. +3
    -3
      src/rebar_app_discover.erl
  2. +11
    -11
      src/rebar_app_info.erl
  3. +8
    -13
      src/rebar_prv_install_deps.erl
  4. +2
    -2
      src/rebar_utils.erl

+ 3
- 3
src/rebar_app_discover.erl Voir le fichier

@ -55,7 +55,7 @@ find_apps(LibDirs, Validate) ->
find_app(AppDir, Validate) find_app(AppDir, Validate)
end, all_app_dirs(LibDirs)). 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) -> find_app(AppDir, Validate) ->
AppFile = filelib:wildcard(filename:join([AppDir, "ebin", "*.app"])), AppFile = filelib:wildcard(filename:join([AppDir, "ebin", "*.app"])),
AppSrcFile = filelib:wildcard(filename:join([AppDir, "src", "*.app.src"])), AppSrcFile = filelib:wildcard(filename:join([AppDir, "src", "*.app.src"])),
@ -140,7 +140,7 @@ validate_application_info(AppInfo) ->
false false
end. end.
-spec get_modules_list(file:name(), proplists:proplist()) ->
-spec get_modules_list(file:filename_all(), proplists:proplist()) ->
{ok, list()} | {ok, list()} |
{warning, Reason::term()} | {warning, Reason::term()} |
{error, Reason::term()}. {error, Reason::term()}.
@ -152,7 +152,7 @@ get_modules_list(AppFile, AppDetail) ->
{ok, ModulesList} {ok, ModulesList}
end. end.
-spec has_all_beams(file:name(), list()) -> boolean().
-spec has_all_beams(file:filename_all(), list()) -> boolean().
has_all_beams(EbinDir, [Module | ModuleList]) -> has_all_beams(EbinDir, [Module | ModuleList]) ->
BeamFile = filename:join([EbinDir, BeamFile = filename:join([EbinDir,
ec_cnv:to_list(Module) ++ ".beam"]), ec_cnv:to_list(Module) ++ ".beam"]),

+ 11
- 11
src/rebar_app_info.erl Voir le fichier

@ -33,9 +33,9 @@
-export_type([t/0]). -export_type([t/0]).
-record(app_info_t, {name :: binary(), -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, original_vsn :: string() | undefined,
app_details=[] :: list(), app_details=[] :: list(),
deps=[] :: list(), deps=[] :: list(),
@ -87,7 +87,7 @@ new(AppName, Vsn, Dir, Deps) ->
deps=Deps}}. deps=Deps}}.
%% @doc discover a complete version of the app info with all fields set. %% @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) -> discover(Dir) ->
case rebar_app_discover:find_app(Dir, all) of case rebar_app_discover:find_app(Dir, all) of
{true, AppInfo} -> {true, AppInfo} ->
@ -104,15 +104,15 @@ name(#app_info_t{name=Name}) ->
name(AppInfo=#app_info_t{}, AppName) -> name(AppInfo=#app_info_t{}, AppName) ->
AppInfo#app_info_t{name=ec_cnv:to_binary(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(#app_info_t{config=Config}) ->
Config. Config.
-spec config(t(), rebar_config:confg()) -> t().
-spec config(t(), rebar_state:t()) -> t().
config(AppInfo=#app_info_t{}, Config) -> config(AppInfo=#app_info_t{}, Config) ->
AppInfo#app_info_t{config=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}) -> 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"]), AppFileSrc = filename:join([ec_cnv:to_list(Dir), "src", ec_cnv:to_list(Name)++".app.src"]),
case filelib:is_file(AppFileSrc) of 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}) -> app_file_src(#app_info_t{app_file_src=AppFileSrc}) ->
ec_cnv:to_list(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) -> app_file_src(AppInfo=#app_info_t{}, AppFileSrc) ->
AppInfo#app_info_t{app_file_src=ec_cnv:to_list(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}) -> 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"]), AppFile = filename:join([ec_cnv:to_list(Dir), "ebin", ec_cnv:to_list(Name)++".app"]),
case filelib:is_file(AppFile) of 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}) -> app_file(#app_info_t{app_file=AppFile}) ->
AppFile. AppFile.
-spec app_file(t(), file:name()) -> t().
-spec app_file(t(), file:filename_all()) -> t().
app_file(AppInfo=#app_info_t{}, AppFile) -> 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(). -spec app_details(t()) -> list().
app_details(#app_info_t{app_details=AppDetails}) -> app_details(#app_info_t{app_details=AppDetails}) ->

+ 8
- 13
src/rebar_prv_install_deps.erl Voir le fichier

@ -114,11 +114,10 @@ handle_deps(State, Deps, Update) ->
%% Find binary deps needed %% Find binary deps needed
{ok, S} = rlx_depsolver:solve(Graph, BinaryDeps1), {ok, S} = rlx_depsolver:solve(Graph, BinaryDeps1),
%% Create app_info record for each binary dep %% Create app_info record for each binary dep
lists:map(fun({Name, Vsn}) ->
lists:map(fun(Pkg) ->
AppInfo = package_to_app(DepsDir AppInfo = package_to_app(DepsDir
,Packages ,Packages
,Name
,Vsn),
,Pkg),
maybe_fetch(AppInfo, Update), maybe_fetch(AppInfo, Update),
AppInfo AppInfo
end, S) end, S)
@ -127,7 +126,7 @@ handle_deps(State, Deps, Update) ->
AllDeps = lists:keymerge(2 AllDeps = lists:keymerge(2
,rebar_state:src_apps(State2) ,rebar_state:src_apps(State2)
,Solved), ,Solved),
io:format("All ~p~n", [AllDeps]),
%% Sort all apps to build order %% Sort all apps to build order
State3 = rebar_state:set(State2, all_deps, AllDeps), State3 = rebar_state:set(State2, all_deps, AllDeps),
{ok, State3}. {ok, State3}.
@ -141,15 +140,11 @@ handle_deps(State, Deps, Update) ->
is_valid(App) -> is_valid(App) ->
rebar_app_info: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), {ok, P} = dict:find({Name, FmtVsn}, Packages),
PkgDeps = proplists:get_value(<<"deps">>, P), PkgDeps = proplists:get_value(<<"deps">>, P),
Link = proplists:get_value(<<"link">>, P), Link = proplists:get_value(<<"link">>, P),

+ 2
- 2
src/rebar_utils.erl Voir le fichier

@ -325,7 +325,7 @@ delayed_halt(Code) ->
end. end.
%% @doc Return list of erl_opts %% @doc Return list of erl_opts
-spec erl_opts(rebar_state:config()) -> list().
-spec erl_opts(rebar_state:t()) -> list().
erl_opts(Config) -> erl_opts(Config) ->
RawErlOpts = filter_defines(rebar_state:get(Config, erl_opts, []), []), RawErlOpts = filter_defines(rebar_state:get(Config, erl_opts, []), []),
Defines = [{d, list_to_atom(D)} || 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 %% points to the rebar executable used to execute the currently running
%% command. The environment is not modified if rebar was invoked %% command. The environment is not modified if rebar was invoked
%% programmatically. %% programmatically.
-spec patch_env(rebar_state:config(), [{string(), string()}])
-spec patch_env(rebar_state:t(), [{string(), string()}])
-> [{string(), string()}]. -> [{string(), string()}].
patch_env(Config, []) -> patch_env(Config, []) ->
%% If we reached an empty list, the env did not contain the REBAR variable. %% If we reached an empty list, the env did not contain the REBAR variable.

Chargement…
Annuler
Enregistrer