From dac94945228322ffb9f8dd8495789c0cd64442a3 Mon Sep 17 00:00:00 2001 From: Siri Hansen Date: Mon, 12 Mar 2012 17:34:15 +0100 Subject: [reltool] Just warn if same module occurs twice in .app file OTP-9792 Earlier this would cause an error with reason "Module xxx potentially included by two different applications: yyy and yyy." This is now changed so it will only be a warning saying that the module is duplicated in the .app file. --- lib/reltool/src/reltool_server.erl | 40 +++++++++++++++++++++++++------------- 1 file changed, 27 insertions(+), 13 deletions(-) (limited to 'lib/reltool/src') diff --git a/lib/reltool/src/reltool_server.erl b/lib/reltool/src/reltool_server.erl index d43be82cbd..29df619955 100644 --- a/lib/reltool/src/reltool_server.erl +++ b/lib/reltool/src/reltool_server.erl @@ -977,18 +977,32 @@ refresh_app(#app{name = AppName, %% Add non-existing modules - i.e. create default #mod %% records for all modules that are listed in .app file %% but do not exist in ebin. - AppInfoMods = AppInfo#app_info.modules, - AppModNames = - case AppInfo#app_info.mod of - {StartModName, _} -> - case lists:member(StartModName, AppInfoMods) of - true -> AppInfoMods; - false -> [StartModName | AppInfoMods] - end; - undefined -> - AppInfoMods - end, - MissingMods = add_missing_mods(AppName, EbinMods, AppModNames), + AppInfoMods = lists:usort(AppInfo#app_info.modules), + Status4 = + case AppInfo#app_info.modules -- AppInfoMods of + [] -> + Status3; + DuplicatedMods -> + lists:foldl( + fun(M,S) -> + reltool_utils:add_warning( + "Module ~p duplicated in app file for " + "application ~p.", [M, AppName], S) + end, + Status3, + DuplicatedMods) + end, + AppModNames = + case AppInfo#app_info.mod of + {StartModName, _} -> + case lists:member(StartModName, AppInfoMods) of + true -> AppInfoMods; + false -> [StartModName | AppInfoMods] + end; + undefined -> + AppInfoMods + end, + MissingMods = add_missing_mods(AppName, EbinMods, AppModNames), %% Add optional user config for each module. %% The #mod records that are already in the #app record at @@ -1013,7 +1027,7 @@ refresh_app(#app{name = AppName, label = AppLabel, info = AppInfo, mods = lists:keysort(#mod.name, Mods3)}, - {App2, Status3}; + {App2, Status4}; true -> {App, Status} end. -- cgit v1.2.3