From 5866742dd88b89aa0d9bf9618b22e28268500703 Mon Sep 17 00:00:00 2001 From: Tristan Sloughter Date: Sun, 21 Jun 2015 12:15:52 -0500 Subject: use bbmustache package --- bootstrap | 1 + 1 file changed, 1 insertion(+) (limited to 'bootstrap') diff --git a/bootstrap b/bootstrap index 1a3999b..e8d1d2e 100755 --- a/bootstrap +++ b/bootstrap @@ -86,6 +86,7 @@ compile(App, FirstFiles) -> FirstFilesPaths = [filename:join([Dir, "src", Module]) || Module <- FirstFiles], Sources = FirstFilesPaths ++ filelib:wildcard(filename:join([Dir, "src", "*.erl"])), [compile_file(X, [{i, filename:join(Dir, "include")} + ,debug_info ,{outdir, filename:join(Dir, "ebin")} ,return | additional_defines()]) || X <- Sources]. -- cgit v1.1 From 9df51005e636bf9c0c63fe5687a221eabedeefe4 Mon Sep 17 00:00:00 2001 From: Tristan Sloughter Date: Sun, 21 Jun 2015 16:05:47 -0500 Subject: use packages for deps and add dialyze profile --- bootstrap | 53 ++++++++++++++++++++++++++++++++++------------------- 1 file changed, 34 insertions(+), 19 deletions(-) (limited to 'bootstrap') diff --git a/bootstrap b/bootstrap index e8d1d2e..ca5f456 100755 --- a/bootstrap +++ b/bootstrap @@ -4,6 +4,15 @@ main(_Args) -> + case crypto:start() of + ok -> ok; + {error,{already_started,crypto}} -> ok + end, + application:start(asn1), + application:start(public_key), + application:start(ssl), + inets:start(), + %% Fetch and build deps required to build rebar3 BaseDeps = [{providers, []} ,{getopt, []} @@ -24,6 +33,7 @@ main(_Args) -> setup_env(), os:putenv("REBAR_PROFILE", "bootstrap"), + rebar3:run(["update"]), {ok, State} = rebar3:run(["compile"]), reset_env(), os:putenv("REBAR_PROFILE", ""), @@ -56,28 +66,33 @@ fetch_and_compile({Name, ErlFirstFiles}, Deps) -> ok = fetch(Repo, Name), compile(Name, ErlFirstFiles). -fetch({git, Url, Source}, App) -> +fetch({pkg, Name, Vsn}, App) -> Dir = filename:join([filename:absname("_build/default/lib/"), App]), - case filelib:is_dir(Dir) of - true -> - true = code:add_path(filename:join(Dir, "ebin")), - ok; - false -> - fetch_source(Dir, Url, Source), - ok + CDN = "https://s3.amazonaws.com/s3.hex.pm/tarballs", + Package = binary_to_list(<>), + Url = string:join([CDN, Package], "/"), + case request(Url) of + {ok, Binary} -> + {ok, Contents} = extract(Binary), + ok = erl_tar:extract({binary, Contents}, [{cwd, Dir}, compressed]); + _ -> + io:format("Error: Unable to fetch package ~p ~p~n", [Name, Vsn]) end. -fetch_source(Dir, Url, {ref, Ref}) -> - ok = filelib:ensure_dir(Dir), - os:cmd(io_lib:format("git clone ~s ~s", [Url, Dir])), - {ok, Cwd} = file:get_cwd(), - file:set_cwd(Dir), - os:cmd(io_lib:format("git checkout -q ~s", [Ref])), - file:set_cwd(Cwd); -fetch_source(Dir, Url, {_, Branch}) -> - ok = filelib:ensure_dir(Dir), - os:cmd(io_lib:format("git clone ~s ~s -b ~s --single-branch", - [Url, Dir, Branch])). +extract(Binary) -> + {ok, Files} = erl_tar:extract({binary, Binary}, [memory]), + {"contents.tar.gz", Contents} = lists:keyfind("contents.tar.gz", 1, Files), + {ok, Contents}. + +request(Url) -> + case httpc:request(get, {Url, []}, + [{relaxed, true}], + [{body_format, binary}]) of + {ok, {{_Version, 200, _Reason}, _Headers, Body}} -> + {ok, Body}; + Error -> + Error + end. compile(App, FirstFiles) -> Dir = filename:join(filename:absname("_build/default/lib/"), App), -- cgit v1.1 From 6d3a107056833e4360baf0354774506a4ff2bec0 Mon Sep 17 00:00:00 2001 From: Tristan Sloughter Date: Sun, 21 Jun 2015 19:39:52 -0500 Subject: use application:start(crypto) instead of crypto:start() --- bootstrap | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) (limited to 'bootstrap') diff --git a/bootstrap b/bootstrap index ca5f456..62e7fa5 100755 --- a/bootstrap +++ b/bootstrap @@ -4,10 +4,7 @@ main(_Args) -> - case crypto:start() of - ok -> ok; - {error,{already_started,crypto}} -> ok - end, + application:start(crypto), application:start(asn1), application:start(public_key), application:start(ssl), -- cgit v1.1