From fa82f5bee491002fd4c3718697becbdddb7d1161 Mon Sep 17 00:00:00 2001 From: Fred Hebert Date: Thu, 10 Aug 2017 11:12:05 -0400 Subject: 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 --- src/rebar_prv_escriptize.erl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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]), -- cgit v1.1