diff options
author | Fred Hebert <mononcqc@ferd.ca> | 2017-08-10 11:12:05 -0400 |
---|---|---|
committer | Fred Hebert <mononcqc@ferd.ca> | 2017-08-10 11:12:05 -0400 |
commit | fa82f5bee491002fd4c3718697becbdddb7d1161 (patch) | |
tree | fb9b9b4e5df9f91efccc89882c0ca1c6cefba14f | |
parent | 2939110eb85bed0dd494bf0ddeb4c07f5e46bfc7 (diff) |
Remove duplicate ebins from escripts
During the building of escripts, multiple passes are done. Two of them
may end up duplicating content: one that gathers all of the beam files
that will be needed for the app to work, and a second one that goes over
the ebin/ directory of the root application to grab all the stuff in
there, prior to the run.
This allows to grab whatever could be required for runtime without
breaking the rest (or so I think), and sticks them at the front of the
archive, where it needs to sit for things to work fine.
Whenever the ebin/ directory contains a pre-compile .beam file, it gets
fetched both from the first pass described and the latter one. This
results in duplicate entries in the resulting zip files used for the
escript and makes the executable larger than it needs to be.
The patch is a simple 1:1 removal of duplicate values. Since
large pre-populated ebin/ directories are pretty rare, this should not
be too costly for the vast majority of users.
Fixes #1577
-rw-r--r-- | src/rebar_prv_escriptize.erl | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/rebar_prv_escriptize.erl b/src/rebar_prv_escriptize.erl index cffbbdc..1da70f8 100644 --- a/src/rebar_prv_escriptize.erl +++ b/src/rebar_prv_escriptize.erl @@ -114,7 +114,7 @@ escriptize(State0, App) -> EbinFiles = usort(load_files(EbinPrefix, "*", "ebin")), ExtraFiles = usort(InclBeams ++ InclExtra), - Files = get_nonempty(EbinFiles ++ ExtraFiles), + Files = get_nonempty(EbinFiles ++ (ExtraFiles -- EbinFiles)), % drop dupes DefaultEmuArgs = ?FMT("%%! -escript main ~ts -pz ~ts/~ts/ebin\n", [AppNameStr, AppNameStr, AppNameStr]), |