From cb5056b2e362aa0b1eb0ccfc6009613426682ed5 Mon Sep 17 00:00:00 2001 From: joewilliams Date: Tue, 20 Sep 2011 09:44:41 -0700 Subject: Get rid of app.config app.config has been a long standing erroneous file in rebar. Erlang/OTP documentation suggests a sys.config file instead. This file is stored in the releases/VSN directory. This does a few things but most importantly it ensures your config (contained in the application environment) survives a hot upgrade. It also has the advantage of allowing the configuration of the application to be versioned along side the application code. This patch flips rebar to use sys.config rather than app.config. Additionally it makes this flip to vm.args as well, making them versioned just like sys.config. This patch also includes runner script changes to support the old etc/app.config config file location and support for Windows. Thanks to mokele for the initial work and kick in the pants to make this finially happen. --- src/rebar_reltool.erl | 23 +++++++++++++++++++++-- 1 file changed, 21 insertions(+), 2 deletions(-) (limited to 'src/rebar_reltool.erl') diff --git a/src/rebar_reltool.erl b/src/rebar_reltool.erl index b1b4a4c..363b384 100644 --- a/src/rebar_reltool.erl +++ b/src/rebar_reltool.erl @@ -173,10 +173,17 @@ run_reltool(Server, _Config, ReltoolConfig) -> [Reason]) end, + {BootRelName, BootRelVsn} = + rebar_rel_utils:get_reltool_release_info(ReltoolConfig), + + ok = create_RELEASES(TargetDir, BootRelName, BootRelVsn), + %% Initialize overlay vars with some basics %% (that can get overwritten) - OverlayVars0 = dict:from_list([{erts_vsn, "erts-" ++ erlang:system_info(version)}, - {target_dir, TargetDir}]), + OverlayVars0 = + dict:from_list([{erts_vsn, "erts-" ++ erlang:system_info(version)}, + {rel_vsn, BootRelVsn}, + {target_dir, TargetDir}]), %% Load up any variables specified by overlay_vars OverlayVars1 = overlay_vars(OverlayVars0, ReltoolConfig), @@ -312,3 +319,15 @@ execute_overlay([Other | _Rest], _Vars, _BaseDir, _TargetDir) -> apply_file_info(InFile, OutFile) -> {ok, FileInfo} = file:read_file_info(InFile), ok = file:write_file_info(OutFile, FileInfo). + +create_RELEASES(TargetDir, RelName, RelVsn) -> + ReleasesDir = filename:join(TargetDir, "releases"), + case release_handler:create_RELEASES(TargetDir, ReleasesDir, + filename:join([ReleasesDir, RelVsn, RelName ++ ".rel"]), + filename:join(TargetDir, "lib")) of + ok -> + ok; + {error, Reason} -> + ?ABORT("Failed to create RELEASES file: ~p\n", + [Reason]) + end. \ No newline at end of file -- cgit v1.1