From 0d339db49ad1a3b8410f2619e0796ee8845c30fb Mon Sep 17 00:00:00 2001 From: Fred Hebert Date: Wed, 4 Oct 2017 16:16:23 -0400 Subject: Fix messed up rollback to git versioning was still hardcoded to 3.4.4 --- src/rebar.app.src | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/rebar.app.src b/src/rebar.app.src index 4be8b76..74efe97 100644 --- a/src/rebar.app.src +++ b/src/rebar.app.src @@ -3,7 +3,7 @@ {application, rebar, [{description, "Rebar: Erlang Build Tool"}, - {vsn, "3.4.4"}, + {vsn, "git"}, {modules, []}, {registered, []}, {applications, [kernel, -- cgit v1.1 From 1ef0ed5b2d1fa289575152bb001e6dd3beb963ee Mon Sep 17 00:00:00 2001 From: Fred Hebert Date: Wed, 4 Oct 2017 16:17:02 -0400 Subject: Normalize return values of app_info data The parsing functions were used inconsistently, and the returned values were bad in some clauses; things only worked because they are never used within rebar3. This ensures the return types are consistent on all clauses. --- src/rebar_app_info.erl | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/rebar_app_info.erl b/src/rebar_app_info.erl index 050ccc1..de497d5 100644 --- a/src/rebar_app_info.erl +++ b/src/rebar_app_info.erl @@ -311,15 +311,22 @@ app_file(AppInfo=#app_info_t{}, AppFile) -> app_details(AppInfo=#app_info_t{app_details=[]}) -> case app_file(AppInfo) of undefined -> - rebar_file_utils:try_consult(app_file_src(AppInfo)); + case rebar_config:consult_app_file(app_file_src(AppInfo)) of + [] -> []; + [{application, _Name, AppDetails}] -> AppDetails + end; AppFile -> - try - rebar_file_utils:try_consult(AppFile) + try rebar_file_utils:try_consult(AppFile) of + [] -> []; + [{application, _Name, AppDetails}] -> AppDetails catch throw:{error, {Module, Reason}} -> ?DEBUG("Warning, falling back to .app.src because of: ~ts", [Module:format_error(Reason)]), - rebar_file_utils:try_consult(app_file_src(AppInfo)) + case rebar_config:consult_app_file(app_file_src(AppInfo)) of + [] -> []; + [{application, _Name, AppDetails}] -> AppDetails + end end end; app_details(#app_info_t{app_details=AppDetails}) -> -- cgit v1.1 From 13260ed62126970421d42a2874b100dbf8763ec3 Mon Sep 17 00:00:00 2001 From: Fred Hebert Date: Wed, 4 Oct 2017 16:21:04 -0400 Subject: Add a description in compiled app file if undef Same default value as used in relx and other environments, but as reported in #979 some tools don't like having no description available. --- src/rebar_otp_app.erl | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/rebar_otp_app.erl b/src/rebar_otp_app.erl index ed573f2..1bc33b9 100644 --- a/src/rebar_otp_app.erl +++ b/src/rebar_otp_app.erl @@ -117,8 +117,11 @@ preprocess(State, AppInfo, AppSrcFile) -> %% without a 'registered' value. A3 = ensure_registered(A2), + %% some tools complain if a description is not present. + A4 = ensure_description(A3), + %% Build the final spec as a string - Spec = io_lib:format("~p.\n", [{application, AppName, A3}]), + Spec = io_lib:format("~p.\n", [{application, AppName, A4}]), %% Setup file .app filename and write new contents EbinDir = rebar_app_info:ebin_dir(AppInfo), @@ -195,6 +198,15 @@ ensure_registered(AppData) -> AppData end. +ensure_description(AppData) -> + case lists:keyfind(description, 1, AppData) of + false -> + %% Required for releases to work. + [{description, ""} | AppData]; + {description, _} -> + AppData + end. + %% In the case of *.app.src we want to give the user the ability to %% dynamically script the application resource file (think dynamic version %% string, etc.), in a way similar to what can be done with the rebar -- cgit v1.1