mirror of
https://github.com/correl/rebar.git
synced 2024-11-23 19:19:54 +00:00
Clean up specs
This commit is contained in:
parent
68f4743563
commit
6d75bfbeb0
7 changed files with 57 additions and 56 deletions
|
@ -1,6 +1,3 @@
|
||||||
-record(config, { dir,
|
|
||||||
opts }).
|
|
||||||
|
|
||||||
-define(FAIL, throw({error, failed})).
|
-define(FAIL, throw({error, failed})).
|
||||||
|
|
||||||
-define(ABORT(Str, Args), rebar_utils:abort(Str, Args)).
|
-define(ABORT(Str, Args), rebar_utils:abort(Str, Args)).
|
||||||
|
|
|
@ -36,18 +36,19 @@
|
||||||
%% Public API
|
%% Public API
|
||||||
%% ===================================================================
|
%% ===================================================================
|
||||||
|
|
||||||
-spec compile(Config::#config{}, AppFile::string()) -> 'ok'.
|
-spec compile(Config::rebar_config:config(), AppFile::file:filename()) -> 'ok'.
|
||||||
compile(Config, _AppFile) ->
|
compile(Config, _AppFile) ->
|
||||||
rebar_base_compiler:run(Config, filelib:wildcard("asn1/*.asn1"),
|
rebar_base_compiler:run(Config, filelib:wildcard("asn1/*.asn1"),
|
||||||
"asn1", ".asn1", "src", ".erl",
|
"asn1", ".asn1", "src", ".erl",
|
||||||
fun compile_asn1/3).
|
fun compile_asn1/3).
|
||||||
|
|
||||||
-spec clean(Config::#config{}, AppFile::string()) -> 'ok'.
|
-spec clean(Config::rebar_config:config(), AppFile::file:filename()) -> 'ok'.
|
||||||
clean(_Config, _AppFile) ->
|
clean(_Config, _AppFile) ->
|
||||||
rebar_file_utils:delete_each(asn_generated_files("asn1", "src")),
|
rebar_file_utils:delete_each(asn_generated_files("asn1", "src")),
|
||||||
ok.
|
ok.
|
||||||
|
|
||||||
-spec compile_asn1(string(), string(), #config{}) -> ok.
|
-spec compile_asn1(file:filename(), file:filename(),
|
||||||
|
rebar_config:config()) -> ok.
|
||||||
compile_asn1(Source, Target, Config) ->
|
compile_asn1(Source, Target, Config) ->
|
||||||
ok = rebar_utils:ensure_dir(Target),
|
ok = rebar_utils:ensure_dir(Target),
|
||||||
Opts = [{outdir, "src"}, noobj] ++ rebar_config:get(Config, asn1_opts, []),
|
Opts = [{outdir, "src"}, noobj] ++ rebar_config:get(Config, asn1_opts, []),
|
||||||
|
|
|
@ -35,6 +35,14 @@
|
||||||
|
|
||||||
-include("rebar.hrl").
|
-include("rebar.hrl").
|
||||||
|
|
||||||
|
-record(config, { dir :: file:filename(),
|
||||||
|
opts :: list() }).
|
||||||
|
|
||||||
|
%% Types that can be used from other modules -- alphabetically ordered.
|
||||||
|
-export_type([config/0]).
|
||||||
|
|
||||||
|
%% data types
|
||||||
|
-opaque config() :: #config{}.
|
||||||
|
|
||||||
%% ===================================================================
|
%% ===================================================================
|
||||||
%% Public API
|
%% Public API
|
||||||
|
|
|
@ -61,8 +61,7 @@
|
||||||
%% ===================================================================
|
%% ===================================================================
|
||||||
|
|
||||||
%% @doc Perform static analysis on the contents of the ebin directory.
|
%% @doc Perform static analysis on the contents of the ebin directory.
|
||||||
%% @spec dialyze(Config::#config{}, File::string()) -> ok
|
-spec dialyze(Config::rebar_config:config(), File::file:filename()) -> ok.
|
||||||
-spec dialyze(Config::#config{}, File::string()) -> ok.
|
|
||||||
dialyze(Config, File) ->
|
dialyze(Config, File) ->
|
||||||
Plt = existing_plt_path(Config, File),
|
Plt = existing_plt_path(Config, File),
|
||||||
case dialyzer:plt_info(Plt) of
|
case dialyzer:plt_info(Plt) of
|
||||||
|
@ -102,8 +101,7 @@ dialyze(Config, File) ->
|
||||||
ok.
|
ok.
|
||||||
|
|
||||||
%% @doc Build the PLT.
|
%% @doc Build the PLT.
|
||||||
%% @spec 'build-plt'(Config::#config{}, File::string()) -> ok
|
-spec 'build-plt'(Config::rebar_config:config(), File::file:filename()) -> ok.
|
||||||
-spec 'build-plt'(Config::#config{}, File::string()) -> ok.
|
|
||||||
'build-plt'(Config, File) ->
|
'build-plt'(Config, File) ->
|
||||||
Plt = new_plt_path(Config, File),
|
Plt = new_plt_path(Config, File),
|
||||||
|
|
||||||
|
@ -122,8 +120,7 @@ dialyze(Config, File) ->
|
||||||
ok.
|
ok.
|
||||||
|
|
||||||
%% @doc Check whether the PLT is up-to-date (rebuilding it if not).
|
%% @doc Check whether the PLT is up-to-date (rebuilding it if not).
|
||||||
%% @spec 'check-plt'(Config::#config{}, File::string()) -> ok
|
-spec 'check-plt'(Config::rebar_config:config(), File::file:filename()) -> ok.
|
||||||
-spec 'check-plt'(Config::#config{}, File::string()) -> ok.
|
|
||||||
'check-plt'(Config, File) ->
|
'check-plt'(Config, File) ->
|
||||||
Plt = existing_plt_path(Config, File),
|
Plt = existing_plt_path(Config, File),
|
||||||
try dialyzer:run([{analysis_type, plt_check}, {init_plt, Plt}]) of
|
try dialyzer:run([{analysis_type, plt_check}, {init_plt, Plt}]) of
|
||||||
|
@ -143,24 +140,22 @@ dialyze(Config, File) ->
|
||||||
%% ===================================================================
|
%% ===================================================================
|
||||||
|
|
||||||
%% @doc Obtain the library paths for the supplied applications.
|
%% @doc Obtain the library paths for the supplied applications.
|
||||||
%% @spec app_dirs(Apps::[atom()]) -> [string()]
|
-spec app_dirs(Apps::[atom()]) -> [file:filename()].
|
||||||
-spec app_dirs(Apps::[atom()]) -> [string()].
|
|
||||||
app_dirs(Apps) ->
|
app_dirs(Apps) ->
|
||||||
[filename:join(Path, "ebin")
|
[filename:join(Path, "ebin")
|
||||||
|| Path <- [code:lib_dir(App) || App <- Apps], erlang:is_list(Path)].
|
|| Path <- [code:lib_dir(App) || App <- Apps], erlang:is_list(Path)].
|
||||||
|
|
||||||
%% @doc Render the warnings on the console.
|
%% @doc Render the warnings on the console.
|
||||||
%% @spec output_warnings(Warnings::[warning()]) -> 'ok'
|
|
||||||
-spec output_warnings(Warnings::[warning()]) -> 'ok'.
|
-spec output_warnings(Warnings::[warning()]) -> 'ok'.
|
||||||
output_warnings(Warnings) ->
|
output_warnings(Warnings) ->
|
||||||
lists:foreach(fun(Warning) ->
|
lists:foreach(fun(Warning) ->
|
||||||
?CONSOLE("~s", [dialyzer:format_warning(Warning)])
|
?CONSOLE("~s", [dialyzer:format_warning(Warning)])
|
||||||
end, Warnings).
|
end, Warnings).
|
||||||
|
|
||||||
%% @doc If the plt option is present in rebar.config return its value, otherwise
|
%% @doc If the plt option is present in rebar.config return its value,
|
||||||
%% return $HOME/.dialyzer_plt.
|
%% otherwise return $HOME/.dialyzer_plt.
|
||||||
%% @spec new_plt_path(Config::#config{}, File::string()) -> string()
|
-spec new_plt_path(Config::rebar_config:config(),
|
||||||
-spec new_plt_path(Config::#config{}, File::string()) -> string().
|
File::file:filename()) -> file:filename().
|
||||||
new_plt_path(Config, File) ->
|
new_plt_path(Config, File) ->
|
||||||
AppName = rebar_app_utils:app_name(File),
|
AppName = rebar_app_utils:app_name(File),
|
||||||
DialyzerOpts = rebar_config:get(Config, dialyzer_opts, []),
|
DialyzerOpts = rebar_config:get(Config, dialyzer_opts, []),
|
||||||
|
@ -175,8 +170,8 @@ new_plt_path(Config, File) ->
|
||||||
%% @doc If the plt option is present in rebar.config and the file exists
|
%% @doc If the plt option is present in rebar.config and the file exists
|
||||||
%% return its value or if ~/.AppName_dialyzer_plt exists return that.
|
%% return its value or if ~/.AppName_dialyzer_plt exists return that.
|
||||||
%% Otherwise return ~/.dialyzer_plt if it exists or abort.
|
%% Otherwise return ~/.dialyzer_plt if it exists or abort.
|
||||||
%% @spec existing_plt_path(Config::#config{}, File::string()) -> string()
|
-spec existing_plt_path(Config::rebar_config:config(),
|
||||||
-spec existing_plt_path(Config::#config{}, File::string()) -> string().
|
File::file:filename()) -> file:filename().
|
||||||
existing_plt_path(Config, File) ->
|
existing_plt_path(Config, File) ->
|
||||||
AppName = rebar_app_utils:app_name(File),
|
AppName = rebar_app_utils:app_name(File),
|
||||||
DialyzerOpts = rebar_config:get(Config, dialyzer_opts, []),
|
DialyzerOpts = rebar_config:get(Config, dialyzer_opts, []),
|
||||||
|
@ -205,8 +200,7 @@ existing_plt_path(Config, File) ->
|
||||||
|
|
||||||
%% @doc If the warnings option is present in rebar.config return its value,
|
%% @doc If the warnings option is present in rebar.config return its value,
|
||||||
%% otherwise return [].
|
%% otherwise return [].
|
||||||
%% @spec warnings(Config::#config{}) -> list()
|
-spec warnings(Config::rebar_config:config()) -> list().
|
||||||
-spec warnings(Config::#config{}) -> list().
|
|
||||||
warnings(Config) ->
|
warnings(Config) ->
|
||||||
DialyzerOpts = rebar_config:get(Config, dialyzer_opts, []),
|
DialyzerOpts = rebar_config:get(Config, dialyzer_opts, []),
|
||||||
proplists:get_value(warnings, DialyzerOpts, []).
|
proplists:get_value(warnings, DialyzerOpts, []).
|
||||||
|
|
|
@ -46,8 +46,7 @@
|
||||||
%% ===================================================================
|
%% ===================================================================
|
||||||
|
|
||||||
%% @doc Generate Erlang program documentation.
|
%% @doc Generate Erlang program documentation.
|
||||||
%% @spec doc(#config{}, string()) -> ok
|
-spec doc(Config::rebar_config:config(), File::file:filename()) -> ok.
|
||||||
-spec(doc(Config::#config{}, File::string()) -> ok).
|
|
||||||
doc(Config, File) ->
|
doc(Config, File) ->
|
||||||
{ok, AppName, _AppData} = rebar_app_utils:load_app_file(File),
|
{ok, AppName, _AppData} = rebar_app_utils:load_app_file(File),
|
||||||
EDocOpts = rebar_config:get(Config, edoc_opts, []),
|
EDocOpts = rebar_config:get(Config, edoc_opts, []),
|
||||||
|
|
|
@ -67,7 +67,7 @@
|
||||||
%% 'old_inets'}]}.
|
%% 'old_inets'}]}.
|
||||||
%%
|
%%
|
||||||
|
|
||||||
-spec compile(Config::#config{}, AppFile::string()) -> 'ok'.
|
-spec compile(Config::rebar_config:config(), AppFile::file:filename()) -> 'ok'.
|
||||||
compile(Config, _AppFile) ->
|
compile(Config, _AppFile) ->
|
||||||
rebar_base_compiler:run(Config,
|
rebar_base_compiler:run(Config,
|
||||||
check_files(rebar_config:get_local(
|
check_files(rebar_config:get_local(
|
||||||
|
@ -86,7 +86,7 @@ compile(Config, _AppFile) ->
|
||||||
"mibs", ".mib", "priv/mibs", ".bin",
|
"mibs", ".mib", "priv/mibs", ".bin",
|
||||||
fun compile_mib/3).
|
fun compile_mib/3).
|
||||||
|
|
||||||
-spec clean(Config::#config{}, AppFile::string()) -> 'ok'.
|
-spec clean(Config::rebar_config:config(), AppFile::file:filename()) -> 'ok'.
|
||||||
clean(_Config, _AppFile) ->
|
clean(_Config, _AppFile) ->
|
||||||
lists:foreach(fun(F) -> ok = rebar_file_utils:rm_rf(F) end,
|
lists:foreach(fun(F) -> ok = rebar_file_utils:rm_rf(F) end,
|
||||||
["ebin/*.beam", "priv/mibs/*.bin"]),
|
["ebin/*.beam", "priv/mibs/*.bin"]),
|
||||||
|
@ -110,7 +110,8 @@ clean(_Config, _AppFile) ->
|
||||||
%% .erl Compilation API (externally used by only eunit)
|
%% .erl Compilation API (externally used by only eunit)
|
||||||
%% ===================================================================
|
%% ===================================================================
|
||||||
|
|
||||||
-spec doterl_compile(Config::#config{}, OutDir::string()) -> 'ok'.
|
-spec doterl_compile(Config::rebar_config:config(),
|
||||||
|
OutDir::file:filename()) -> 'ok'.
|
||||||
doterl_compile(Config, OutDir) ->
|
doterl_compile(Config, OutDir) ->
|
||||||
doterl_compile(Config, OutDir, []).
|
doterl_compile(Config, OutDir, []).
|
||||||
|
|
||||||
|
@ -165,14 +166,15 @@ doterl_compile(Config, OutDir, MoreSources) ->
|
||||||
%% Internal functions
|
%% Internal functions
|
||||||
%% ===================================================================
|
%% ===================================================================
|
||||||
|
|
||||||
-spec include_path(Source::string(), Config::#config{}) -> [string(), ...].
|
-spec include_path(Source::file:filename(),
|
||||||
|
Config::rebar_config:config()) -> [file:filename(), ...].
|
||||||
include_path(Source, Config) ->
|
include_path(Source, Config) ->
|
||||||
ErlOpts = rebar_config:get(Config, erl_opts, []),
|
ErlOpts = rebar_config:get(Config, erl_opts, []),
|
||||||
["include", filename:dirname(Source)]
|
["include", filename:dirname(Source)]
|
||||||
++ proplists:get_all_values(i, ErlOpts).
|
++ proplists:get_all_values(i, ErlOpts).
|
||||||
|
|
||||||
-spec inspect(Source::string(),
|
-spec inspect(Source::file:filename(),
|
||||||
IncludePath::[string(),...]) -> {string(), [string()]}.
|
IncludePath::[file:filename(), ...]) -> {string(), [string()]}.
|
||||||
inspect(Source, IncludePath) ->
|
inspect(Source, IncludePath) ->
|
||||||
ModuleDefault = filename:basename(Source, ".erl"),
|
ModuleDefault = filename:basename(Source, ".erl"),
|
||||||
case epp:open(Source, IncludePath) of
|
case epp:open(Source, IncludePath) of
|
||||||
|
@ -183,7 +185,7 @@ inspect(Source, IncludePath) ->
|
||||||
{ModuleDefault, []}
|
{ModuleDefault, []}
|
||||||
end.
|
end.
|
||||||
|
|
||||||
-spec inspect_epp(Epp::pid(), Source::string(), Module::string(),
|
-spec inspect_epp(Epp::pid(), Source::file:filename(), Module::file:filename(),
|
||||||
Includes::[string()]) -> {string(), [string()]}.
|
Includes::[string()]) -> {string(), [string()]}.
|
||||||
inspect_epp(Epp, Source, Module, Includes) ->
|
inspect_epp(Epp, Source, Module, Includes) ->
|
||||||
case epp:parse_erl_form(Epp) of
|
case epp:parse_erl_form(Epp) of
|
||||||
|
@ -218,15 +220,16 @@ inspect_epp(Epp, Source, Module, Includes) ->
|
||||||
inspect_epp(Epp, Source, Module, Includes)
|
inspect_epp(Epp, Source, Module, Includes)
|
||||||
end.
|
end.
|
||||||
|
|
||||||
-spec needs_compile(Source::string(), Target::string(),
|
-spec needs_compile(Source::file:filename(), Target::file:filename(),
|
||||||
Hrls::[string()]) -> boolean().
|
Hrls::[string()]) -> boolean().
|
||||||
needs_compile(Source, Target, Hrls) ->
|
needs_compile(Source, Target, Hrls) ->
|
||||||
TargetLastMod = filelib:last_modified(Target),
|
TargetLastMod = filelib:last_modified(Target),
|
||||||
lists:any(fun(I) -> TargetLastMod < filelib:last_modified(I) end,
|
lists:any(fun(I) -> TargetLastMod < filelib:last_modified(I) end,
|
||||||
[Source] ++ Hrls).
|
[Source] ++ Hrls).
|
||||||
|
|
||||||
-spec internal_erl_compile(Source::string(), Config::#config{},
|
-spec internal_erl_compile(Source::file:filename(),
|
||||||
Outdir::string(),
|
Config::rebar_config:config(),
|
||||||
|
Outdir::file:filename(),
|
||||||
ErlOpts::list()) -> 'ok' | 'skipped'.
|
ErlOpts::list()) -> 'ok' | 'skipped'.
|
||||||
internal_erl_compile(Source, Config, Outdir, ErlOpts) ->
|
internal_erl_compile(Source, Config, Outdir, ErlOpts) ->
|
||||||
%% Determine the target name and includes list by inspecting the source file
|
%% Determine the target name and includes list by inspecting the source file
|
||||||
|
@ -237,7 +240,7 @@ internal_erl_compile(Source, Config, Outdir, ErlOpts) ->
|
||||||
ok = filelib:ensure_dir(Target),
|
ok = filelib:ensure_dir(Target),
|
||||||
|
|
||||||
%% If the file needs compilation, based on last mod date of includes or
|
%% If the file needs compilation, based on last mod date of includes or
|
||||||
%% the target,
|
%% the target
|
||||||
case needs_compile(Source, Target, Hrls) of
|
case needs_compile(Source, Target, Hrls) of
|
||||||
true ->
|
true ->
|
||||||
Opts = [{outdir, filename:dirname(Target)}] ++
|
Opts = [{outdir, filename:dirname(Target)}] ++
|
||||||
|
@ -263,8 +266,8 @@ internal_erl_compile(Source, Config, Outdir, ErlOpts) ->
|
||||||
skipped
|
skipped
|
||||||
end.
|
end.
|
||||||
|
|
||||||
-spec compile_mib(Source::string(), Target::string(),
|
-spec compile_mib(Source::file:filename(), Target::file:filename(),
|
||||||
Config::#config{}) -> 'ok'.
|
Config::rebar_config:config()) -> 'ok'.
|
||||||
compile_mib(Source, Target, Config) ->
|
compile_mib(Source, Target, Config) ->
|
||||||
ok = rebar_utils:ensure_dir(Target),
|
ok = rebar_utils:ensure_dir(Target),
|
||||||
Opts = [{outdir, "priv/mibs"}, {i, ["priv/mibs"]}] ++
|
Opts = [{outdir, "priv/mibs"}, {i, ["priv/mibs"]}] ++
|
||||||
|
@ -276,22 +279,22 @@ compile_mib(Source, Target, Config) ->
|
||||||
?FAIL
|
?FAIL
|
||||||
end.
|
end.
|
||||||
|
|
||||||
-spec compile_xrl(Source::string(), Target::string(),
|
-spec compile_xrl(Source::file:filename(), Target::file:filename(),
|
||||||
Config::#config{}) -> 'ok'.
|
Config::rebar_config:config()) -> 'ok'.
|
||||||
compile_xrl(Source, Target, Config) ->
|
compile_xrl(Source, Target, Config) ->
|
||||||
Opts = [{scannerfile, Target}, {return, true}
|
Opts = [{scannerfile, Target}, {return, true}
|
||||||
|rebar_config:get(Config, xrl_opts, [])],
|
|rebar_config:get(Config, xrl_opts, [])],
|
||||||
compile_xrl_yrl(Source, Target, Opts, leex).
|
compile_xrl_yrl(Source, Target, Opts, leex).
|
||||||
|
|
||||||
-spec compile_yrl(Source::string(), Target::string(),
|
-spec compile_yrl(Source::file:filename(), Target::file:filename(),
|
||||||
Config::#config{}) -> 'ok'.
|
Config::rebar_config:config()) -> 'ok'.
|
||||||
compile_yrl(Source, Target, Config) ->
|
compile_yrl(Source, Target, Config) ->
|
||||||
Opts = [{parserfile, Target}, {return, true}
|
Opts = [{parserfile, Target}, {return, true}
|
||||||
|rebar_config:get(Config, yrl_opts, [])],
|
|rebar_config:get(Config, yrl_opts, [])],
|
||||||
compile_xrl_yrl(Source, Target, Opts, yecc).
|
compile_xrl_yrl(Source, Target, Opts, yecc).
|
||||||
|
|
||||||
-spec compile_xrl_yrl(Source::string(), Target::string(), Opts::list(),
|
-spec compile_xrl_yrl(Source::file:filename(), Target::file:filename(),
|
||||||
Mod::atom()) -> 'ok'.
|
Opts::list(), Mod::atom()) -> 'ok'.
|
||||||
compile_xrl_yrl(Source, Target, Opts, Mod) ->
|
compile_xrl_yrl(Source, Target, Opts, Mod) ->
|
||||||
case needs_compile(Source, Target, []) of
|
case needs_compile(Source, Target, []) of
|
||||||
true ->
|
true ->
|
||||||
|
@ -317,17 +320,17 @@ gather_src([], Srcs) ->
|
||||||
gather_src([Dir|Rest], Srcs) ->
|
gather_src([Dir|Rest], Srcs) ->
|
||||||
gather_src(Rest, Srcs ++ rebar_utils:find_files(Dir, ".*\\.erl\$")).
|
gather_src(Rest, Srcs ++ rebar_utils:find_files(Dir, ".*\\.erl\$")).
|
||||||
|
|
||||||
-spec src_dirs(SrcDirs::[string()]) -> [string(),...].
|
-spec src_dirs(SrcDirs::[string()]) -> [file:filename(), ...].
|
||||||
src_dirs([]) ->
|
src_dirs([]) ->
|
||||||
["src"];
|
["src"];
|
||||||
src_dirs(SrcDirs) ->
|
src_dirs(SrcDirs) ->
|
||||||
SrcDirs ++ src_dirs([]).
|
SrcDirs ++ src_dirs([]).
|
||||||
|
|
||||||
-spec dirs(Dir::string()) -> [string()].
|
-spec dirs(Dir::file:filename()) -> [file:filename()].
|
||||||
dirs(Dir) ->
|
dirs(Dir) ->
|
||||||
[F || F <- filelib:wildcard(filename:join([Dir, "*"])), filelib:is_dir(F)].
|
[F || F <- filelib:wildcard(filename:join([Dir, "*"])), filelib:is_dir(F)].
|
||||||
|
|
||||||
-spec delete_dir(Dir::string(),
|
-spec delete_dir(Dir::file:filename(),
|
||||||
Subdirs::[string()]) -> 'ok' | {'error', atom()}.
|
Subdirs::[string()]) -> 'ok' | {'error', atom()}.
|
||||||
delete_dir(Dir, []) ->
|
delete_dir(Dir, []) ->
|
||||||
file:del_dir(Dir);
|
file:del_dir(Dir);
|
||||||
|
@ -335,7 +338,7 @@ delete_dir(Dir, Subdirs) ->
|
||||||
lists:foreach(fun(D) -> delete_dir(D, dirs(D)) end, Subdirs),
|
lists:foreach(fun(D) -> delete_dir(D, dirs(D)) end, Subdirs),
|
||||||
file:del_dir(Dir).
|
file:del_dir(Dir).
|
||||||
|
|
||||||
-spec compile_priority(File::string()) -> 'normal' | 'behaviour' |
|
-spec compile_priority(File::file:filename()) -> 'normal' | 'behaviour' |
|
||||||
'parse_transform'.
|
'parse_transform'.
|
||||||
compile_priority(File) ->
|
compile_priority(File) ->
|
||||||
case epp_dodger:parse_file(File) of
|
case epp_dodger:parse_file(File) of
|
||||||
|
@ -369,7 +372,7 @@ compile_priority(File) ->
|
||||||
%% Filter a list of erl_opts platform_define options such that only
|
%% Filter a list of erl_opts platform_define options such that only
|
||||||
%% those which match the provided architecture regex are returned.
|
%% those which match the provided architecture regex are returned.
|
||||||
%%
|
%%
|
||||||
-spec filter_defines(ErlOpts::list(),Acc::list()) -> list().
|
-spec filter_defines(ErlOpts::list(), Acc::list()) -> list().
|
||||||
filter_defines([], Acc) ->
|
filter_defines([], Acc) ->
|
||||||
lists:reverse(Acc);
|
lists:reverse(Acc);
|
||||||
filter_defines([{platform_define, ArchRegex, Key} | Rest], Acc) ->
|
filter_defines([{platform_define, ArchRegex, Key} | Rest], Acc) ->
|
||||||
|
@ -392,7 +395,7 @@ filter_defines([Opt | Rest], Acc) ->
|
||||||
%%
|
%%
|
||||||
%% Ensure all files in a list are present and abort if one is missing
|
%% Ensure all files in a list are present and abort if one is missing
|
||||||
%%
|
%%
|
||||||
-spec check_files(FileList::[string()]) -> [string()].
|
-spec check_files(FileList::[file:filename()]) -> [file:filename()].
|
||||||
check_files(FileList) ->
|
check_files(FileList) ->
|
||||||
[check_file(F) || F <- FileList].
|
[check_file(F) || F <- FileList].
|
||||||
|
|
||||||
|
|
|
@ -39,8 +39,7 @@
|
||||||
|
|
||||||
%% @doc Remove files and directories.
|
%% @doc Remove files and directories.
|
||||||
%% Target is a single filename, directoryname or wildcard expression.
|
%% Target is a single filename, directoryname or wildcard expression.
|
||||||
%% @spec rm_rf(string()) -> ok
|
-spec rm_rf(Target::file:filename()) -> ok.
|
||||||
-spec rm_rf(Target::string()) -> ok.
|
|
||||||
rm_rf(Target) ->
|
rm_rf(Target) ->
|
||||||
case os:type() of
|
case os:type() of
|
||||||
{unix, _} ->
|
{unix, _} ->
|
||||||
|
@ -56,7 +55,7 @@ rm_rf(Target) ->
|
||||||
ok
|
ok
|
||||||
end.
|
end.
|
||||||
|
|
||||||
-spec cp_r(Sources::list(string()), Dest::string()) -> ok.
|
-spec cp_r(Sources::list(string()), Dest::file:filename()) -> ok.
|
||||||
cp_r(Sources, Dest) ->
|
cp_r(Sources, Dest) ->
|
||||||
case os:type() of
|
case os:type() of
|
||||||
{unix, _} ->
|
{unix, _} ->
|
||||||
|
@ -69,7 +68,7 @@ cp_r(Sources, Dest) ->
|
||||||
ok
|
ok
|
||||||
end.
|
end.
|
||||||
|
|
||||||
-spec mv(Source::string(), Dest::string()) -> ok.
|
-spec mv(Source::string(), Dest::file:filename()) -> ok.
|
||||||
mv(Source, Dest) ->
|
mv(Source, Dest) ->
|
||||||
case os:type() of
|
case os:type() of
|
||||||
{unix, _} ->
|
{unix, _} ->
|
||||||
|
|
Loading…
Reference in a new issue