使用rebar3打tar包,十分方便。其中rebar3使用relx打包,relx里面有下面的选项,能够在打包的时候,不打包src目录,方便在发布的时候,不发布src里面的源码文件:git
%% relx will include src files of your applications, if present, by default. %% If you don't want to include the src files, set `include_src` to false. {include_src, false}.
参考:relx Configurationgithub
但咱们使用rebar3生成项目的时候,src、include是处于相同等级的目录下面,发布的时候,使用上面的选项能够不发布src目录,但include目录会被发布出去。这个不方便咱们发布。app
那有没有 include_include 选项呢?code
答案是没有。参考:include_src ok but what about include_include ? #99get
但咱们能够经过compile的选项来绕过这个问题。源码
compile有个选项是{i,Dir}, 它会在Dir目录下面查找须要的编译头文件。it
rebar3能够设置这个选项在erl_opts下面,参考:how to set include directory for rebario
{erl_opts, [{i, PathToIncludeFile}]}.
这样,咱们就能够把include目录迁移到src目录,这样就能够在发布的时候,不拷贝include目录了。编译
注意,PathToIncludeFile是在rebar3当前目录对应的目录,要注意相对目录。打包