mirror of
https://github.com/correl/rebar.git
synced 2024-11-23 19:19:54 +00:00
Fix up installation problems that occurred when priv/include dirs don't exist (they are optional)
This commit is contained in:
parent
a01e7dcd30
commit
4f980767f8
1 changed files with 12 additions and 3 deletions
|
@ -46,6 +46,12 @@ install(Config, File) ->
|
||||||
%% Load the app name and version from the .app file and construct
|
%% Load the app name and version from the .app file and construct
|
||||||
%% the app identifier
|
%% the app identifier
|
||||||
{ok, AppName, AppData} = rebar_app_utils:load_app_file(File),
|
{ok, AppName, AppData} = rebar_app_utils:load_app_file(File),
|
||||||
|
|
||||||
|
%% Validate the .app file prior to installation
|
||||||
|
validate_name(AppName, File),
|
||||||
|
validate_modules(AppName, proplists:get_value(modules, AppData)),
|
||||||
|
|
||||||
|
%% Pull out the vsn and construct identifier
|
||||||
Vsn = proplists:get_value(vsn, AppData),
|
Vsn = proplists:get_value(vsn, AppData),
|
||||||
AppId = ?FMT("~s-~s", [AppName, Vsn]),
|
AppId = ?FMT("~s-~s", [AppName, Vsn]),
|
||||||
?CONSOLE("Installing: ~s\n", [AppId]),
|
?CONSOLE("Installing: ~s\n", [AppId]),
|
||||||
|
@ -74,9 +80,10 @@ install(Config, File) ->
|
||||||
%% Re-create target
|
%% Re-create target
|
||||||
ok = rebar_file_utils:mkdir_p(AppDir),
|
ok = rebar_file_utils:mkdir_p(AppDir),
|
||||||
|
|
||||||
%% By default we copy the ebin, include, src and priv directories
|
%% By default we copy the ebin, include, src and priv directories (if they exist)
|
||||||
ok = rebar_file_utils:cp_r(["ebin", "src", "priv", "include"],
|
Files = [F || F <- ["ebin", "src", "priv", "include"],
|
||||||
AppDir),
|
filelib:last_modified(F) /= 0],
|
||||||
|
ok = rebar_file_utils:cp_r(Files, AppDir),
|
||||||
|
|
||||||
%% Check the config to see if we have any binaries that need to be
|
%% Check the config to see if we have any binaries that need to be
|
||||||
%% linked into the erlang path
|
%% linked into the erlang path
|
||||||
|
@ -102,6 +109,7 @@ install_binaries([Bin | Rest], AppDir, BinDir) ->
|
||||||
rebar_file_utils:ln_sf(FqBin, BinDir),
|
rebar_file_utils:ln_sf(FqBin, BinDir),
|
||||||
install_binaries(Rest, AppDir, BinDir).
|
install_binaries(Rest, AppDir, BinDir).
|
||||||
|
|
||||||
|
|
||||||
validate_name(AppName, File) ->
|
validate_name(AppName, File) ->
|
||||||
%% Convert the .app file name to an atom -- check it against the identifier within the file
|
%% Convert the .app file name to an atom -- check it against the identifier within the file
|
||||||
ExpApp = list_to_atom(filename:basename(File, ".app")),
|
ExpApp = list_to_atom(filename:basename(File, ".app")),
|
||||||
|
@ -147,3 +155,4 @@ validate_modules(AppName, Mods) ->
|
||||||
|
|
||||||
beam_to_mod(Filename) ->
|
beam_to_mod(Filename) ->
|
||||||
list_to_atom(filename:basename(Filename, ".beam")).
|
list_to_atom(filename:basename(Filename, ".beam")).
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue