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

Re-vendor hex_core in at 0.7.0 #2421

Merged
merged 5 commits into from
Nov 17, 2020
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
25 changes: 21 additions & 4 deletions bootstrap
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,10 @@ main(_) ->
rm_rf("_build/default/lib/rebar"),
rm_rf("_build/test/lib/rebar"),

%% We fetch a few deps from hex for boostraping,
%% so we must compile r3_safe_erl_term.xrl which
%% is part of hex_core.
compile_xrl_file("src/r3_safe_erl_term.xrl"),
mkdir_p("_build/bootstrap/lib/rebar/ebin"),

os:putenv("REBAR_PROFILE", "bootstrap"),
compile_vendored(),

%% Fetch and build deps required to build rebar3
BaseDeps = [{providers, []}
Expand Down Expand Up @@ -176,6 +176,15 @@ maybe_set_ipfamily({ok, _}, Family) ->
maybe_set_ipfamily(_, _Family) ->
ok.

compile_vendored() ->
compile_xrl_file("src/vendored/r3_safe_erl_term.xrl"),
Sources = filelib:wildcard(filename:join(["src/vendored", "*.erl"])),
Dir = filename:absname("_build/bootstrap/lib/rebar/ebin"),
code:add_patha(Dir),
Ebin = "_build/bootstrap/lib/rebar/ebin",
Opts = [debug_info,{outdir, filename:absname(Ebin)}, return | additional_defines()],
[compile_erl_file(X, Opts) || X <- Sources].

compile(App, FirstFiles) ->
Dir = filename:join(filename:absname("_build/default/lib/"), App),
filelib:ensure_dir(filename:join([Dir, "ebin", "dummy.beam"])),
Expand Down Expand Up @@ -278,6 +287,14 @@ rm_rf(Target) ->
ok
end.

mkdir_p(Target) ->
Pred = fun (Dir, Acc) ->
NewAcc = filename:join(filename:absname(Acc), Dir),
file:make_dir(NewAcc),
NewAcc
end,
lists:foldl(Pred, "", filename:split(Target)).
Copy link
Collaborator

Choose a reason for hiding this comment

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

filelib:ensure_dir(Target) will do that.


-spec cp_r(list(string()), file:filename()) -> 'ok'.
cp_r([], _Dest) ->
ok;
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion vendor_hex_core.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ if [[ -z "$1" ]]; then
fi

source_dir=$1/src
target_dir=src
target_dir=src/vendored
prefix=r3_
hex_core_version=`cat $source_dir/hex_core.hrl | grep HEX_CORE_VERSION | cut -d'"' -f2`

Expand Down