rebar/rebar — pull request #52 by shino (2013-01-13 13:51:12+00:00)
Title: Slim release support

PR for #7 .

By adding `{excl_lib, otp_root}` to reltool.config,
generate a slim release which does not include erts and otp libraries.
Also the runner script uses appropriate options for slim release.

Example:

```
$ mkdir slim_sample
$ cd slim_sample
$ cp /path/to/rebar/rebar .
$ ./rebar create-app appid=slim_sample
$ ./rebar compile

$ rm -rf rel
$ mkdir rel
$ cd rel
$ ../rebar create-node nodeid=slim_sample
$ cp reltool.config reltool.config.original

$ vi reltool.config # edit
$ diff -u reltool.config.original reltool.config
--- reltool.config.original 2013-01-13 22:23:31.597614577 +0900
+++ reltool.config 2013-01-13 22:23:31.601613550 +0900
@@ -1,5 +1,6 @@
{sys, [
{lib_dirs, []},
+ {excl_lib, otp_root},
{erts, [{mod_cond, derived}, {app_file, strip}]},
{app_file, strip},
{rel, "slim_sample", "1",
@@ -22,14 +23,14 @@
{excl_sys_filters, ["^bin/.*", "^erts.*/bin/(dialyzer|typer)",
"^erts.*/(doc|info|include|lib|man|src)"]},
{excl_app_filters, ["\.gitignore"]},
- {app, slim_sample, [{mod_cond, app}, {incl_cond, include}]}
+ {app, hipe, [{incl_cond, exclude}]},
+ {app, slim_sample, [{mod_cond, app}, {incl_cond, include}, {lib_dir, ".."}]}
]}.

{target_dir, "slim_sample"}.

{overlay, [
{mkdir, "log/sasl"},
- {copy, "files/erl", "\{\{erts_vsn\}\}/bin/erl"},
{copy, "files/nodetool", "releases/\{\{rel_vsn\}\}/nodetool"},
{copy, "files/slim_sample", "bin/slim_sample"},
{copy, "files/slim_sample.cmd", "bin/slim_sample.cmd"},

$ ../rebar generate
```

- The `erts_vsn` directory is not created in slim release as it should be.
Therefore `nodetool` script is moved to under `releases/$APP_VSN/` (as template)
and `erl` script should be removed from overlay (by editing).
- In slim release, `rebar generate` creates a marker file
`$RUNNER_BASE_DIR/releases/$APP_VSN/runner_script.data`.
runner scripts know whether slim release or not(=normal) by its content.
- Exclusion of hipe application is not related to slim release support,
just because my Erlang/OTP is built without hipe.