Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Prevent build machine paths being used in published artifacts #190

Open
wants to merge 2 commits into
base: develop
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 28 additions & 5 deletions rebar.config.script
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
%% -*- mode: erlang; indent-tabs-mode: nil -*-

Conf0 = CONFIG, %The original config
Conf0 = CONFIG, % The original config

%% Do a deep set stepping down a list of keys replacing/adding last
%% with value. Named funs would be nicer but not always available.
Expand Down Expand Up @@ -78,19 +78,42 @@ Copts = Copts0 ++ AppendCopts(Version,
%% Ensure they are in erl_opts.

Conf1 = case lists:keyfind(erl_opts, 1, Conf0) of
{erl_opts,Opts} -> %Existing erl_opts
{erl_opts,Opts} -> % Existing erl_opts
NewOpts = {erl_opts,Opts ++ Copts},
lists:keyreplace(erl_opts, 1, Conf0, NewOpts);
false -> %No erl_opts
false -> % No erl_opts
Conf0 ++ [{erl_opts,Copts}]
end,

%% Prevent build directories being used in output files

XrlYrlOpts = if Version > "24" ->
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Whoops

[
{xrl_opts, [{deterministic, true}]},
{yrl_opts, [{deterministic, true}]}
];
true ->
[]
end,

%% Append the new options to the configuration.

Conf2 = lists:foldl(fun({Key, Val}, Acc) ->
case lists:keyfind(Key, 1, Acc) of
{Key, OldVal} ->
NewVal = {Key, OldVal ++ Val},
lists:keyreplace(Key, 1, Acc, NewVal);
false ->
Acc ++ [{Key, Val}]
end
end, Conf1, XrlYrlOpts),

%% TestConfig = [{cover_enabled, true}, {cover_opts, [verbose]}],

%% Aliases = [{alias, [
%% {test, [eunit, {ct, "--cover"}, cover]}
%% ]}],

%% Conf1 ++ TestConfig ++ Aliases.
%% Conf2 ++ TestConfig ++ Aliases.

Conf1.
Conf2.
Loading