summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--rebar.config2
-rw-r--r--rebar.lock4
-rw-r--r--src/rebar.app.src1
-rw-r--r--src/rebar_packages.erl7
-rw-r--r--src/rebar_prv_local_install.erl11
-rw-r--r--src/rebar_string.erl2
-rw-r--r--test/rebar_dir_SUITE.erl12
7 files changed, 32 insertions, 7 deletions
diff --git a/rebar.config b/rebar.config
index 9337565..d136334 100644
--- a/rebar.config
+++ b/rebar.config
@@ -9,7 +9,7 @@
{bbmustache, "1.3.0"},
{relx, "3.24.4"},
{cf, "0.2.2"},
- {cth_readable, "1.3.3"},
+ {cth_readable, "1.3.4"},
{eunit_formatters, "0.5.0"}]}.
{post_hooks, [{"(linux|darwin|solaris|freebsd|netbsd|openbsd)",
diff --git a/rebar.lock b/rebar.lock
index 86b4d77..3fdd361 100644
--- a/rebar.lock
+++ b/rebar.lock
@@ -2,7 +2,7 @@
[{<<"bbmustache">>,{pkg,<<"bbmustache">>,<<"1.3.0">>},0},
{<<"certifi">>,{pkg,<<"certifi">>,<<"2.0.0">>},0},
{<<"cf">>,{pkg,<<"cf">>,<<"0.2.2">>},0},
- {<<"cth_readable">>,{pkg,<<"cth_readable">>,<<"1.3.3">>},0},
+ {<<"cth_readable">>,{pkg,<<"cth_readable">>,<<"1.3.4">>},0},
{<<"erlware_commons">>,{pkg,<<"erlware_commons">>,<<"1.0.5">>},0},
{<<"eunit_formatters">>,{pkg,<<"eunit_formatters">>,<<"0.5.0">>},0},
{<<"getopt">>,{pkg,<<"getopt">>,<<"1.0.1">>},0},
@@ -14,7 +14,7 @@
{<<"bbmustache">>, <<"2010ADAE78830992A4C69680115ECD7D475DD03A72C076BBADDCCBF2D4B32035">>},
{<<"certifi">>, <<"A0C0E475107135F76B8C1D5BC7EFB33CD3815CB3CF3DEA7AEFDD174DABEAD064">>},
{<<"cf">>, <<"7F2913FFF90ABCABD0F489896CFEB0B0674F6C8DF6C10B17A83175448029896C">>},
- {<<"cth_readable">>, <<"4A0DE498F88A16FCAD69555EF1E03FB3563EF422DAC80FCC7627EB9C0E15DC44">>},
+ {<<"cth_readable">>, <<"CB85DF77CEB7F05854AE241300DB36A72C371740EDD883D8BF75B5F652B7067D">>},
{<<"erlware_commons">>, <<"FC23D8E304140B65A811F653A76B2FB10B0CE744608CAF86E9125CEB349C9442">>},
{<<"eunit_formatters">>, <<"6A9133943D36A465D804C1C5B6E6839030434B8879C5600D7DDB5B3BAD4CCB59">>},
{<<"getopt">>, <<"C73A9FA687B217F2FF79F68A3B637711BB1936E712B521D8CE466B29CBF7808A">>},
diff --git a/src/rebar.app.src b/src/rebar.app.src
index 43ad620..c96f65c 100644
--- a/src/rebar.app.src
+++ b/src/rebar.app.src
@@ -8,6 +8,7 @@
{registered, []},
{applications, [kernel,
stdlib,
+ hipe,
sasl,
compiler,
crypto,
diff --git a/src/rebar_packages.erl b/src/rebar_packages.erl
index 50d4025..8cebeca 100644
--- a/src/rebar_packages.erl
+++ b/src/rebar_packages.erl
@@ -97,7 +97,12 @@ registry_dir(State) ->
case rebar_state:get(State, rebar_packages_cdn, ?DEFAULT_CDN) of
?DEFAULT_CDN ->
RegistryDir = filename:join([CacheDir, "hex", "default"]),
- ok = filelib:ensure_dir(filename:join(RegistryDir, "placeholder")),
+ case filelib:ensure_dir(filename:join(RegistryDir, "placeholder")) of
+ ok -> ok;
+ {error, Posix} when Posix == eaccess; Posix == enoent ->
+ ?ABORT("Could not write to ~p. Please ensure the path is writeable.",
+ [RegistryDir])
+ end,
{ok, RegistryDir};
CDN ->
case rebar_utils:url_append_path(CDN, ?REMOTE_PACKAGE_DIR) of
diff --git a/src/rebar_prv_local_install.erl b/src/rebar_prv_local_install.erl
index 282c548..bb019c4 100644
--- a/src/rebar_prv_local_install.erl
+++ b/src/rebar_prv_local_install.erl
@@ -12,6 +12,7 @@
-export([extract_escript/2]).
-include("rebar.hrl").
+-include_lib("providers/include/providers.hrl").
-include_lib("kernel/include/file.hrl").
-define(PROVIDER, install).
@@ -54,6 +55,9 @@ do(State) ->
end.
-spec format_error(any()) -> iolist().
+format_error({non_writeable, Dir}) ->
+ io_lib:format("Could not write to ~p. Please ensure the path is writeable.",
+ [Dir]);
format_error(Reason) ->
io_lib:format("~p", [Reason]).
@@ -71,7 +75,12 @@ extract_escript(State, ScriptPath) ->
%% And add a rebar3 bin script to ~/.cache/rebar3/bin
Opts = rebar_state:opts(State),
OutputDir = filename:join(rebar_dir:global_cache_dir(Opts), "lib"),
- filelib:ensure_dir(filename:join(OutputDir, "empty")),
+ case filelib:ensure_dir(filename:join(OutputDir, "empty")) of
+ ok ->
+ ok;
+ {error, Posix} when Posix == eaccess; Posix == enoent ->
+ throw(?PRV_ERROR({non_writeable, OutputDir}))
+ end,
?INFO("Extracting rebar3 libs to ~ts...", [OutputDir]),
zip:extract(Archive, [{cwd, OutputDir}]),
diff --git a/src/rebar_string.erl b/src/rebar_string.erl
index c1858f9..47cb15c 100644
--- a/src/rebar_string.erl
+++ b/src/rebar_string.erl
@@ -11,7 +11,7 @@
%% used. Instead we just adopt join/2 locally and hope it works
%% for most unicode use cases anyway.
join([], Sep) when is_list(Sep) ->
- [];
+ [];
join([H|T], Sep) ->
H ++ lists:append([Sep ++ X || X <- T]).
diff --git a/test/rebar_dir_SUITE.erl b/test/rebar_dir_SUITE.erl
index e544410..f5ac0fc 100644
--- a/test/rebar_dir_SUITE.erl
+++ b/test/rebar_dir_SUITE.erl
@@ -5,6 +5,7 @@
-export([default_src_dirs/1, default_extra_src_dirs/1, default_all_src_dirs/1]).
-export([src_dirs/1, alt_src_dir_nested/1, src_dirs_with_opts/1, extra_src_dirs/1, all_src_dirs/1]).
-export([src_dir_opts/1, recursive/1]).
+-export([top_src_dirs/1]).
-export([profile_src_dirs/1, profile_extra_src_dirs/1, profile_all_src_dirs/1]).
-export([profile_src_dir_opts/1]).
-export([retarget_path/1, alt_base_dir_abs/1, alt_base_dir_rel/1]).
@@ -18,7 +19,7 @@
all() -> [default_src_dirs, default_extra_src_dirs, default_all_src_dirs,
src_dirs, alt_src_dir_nested, extra_src_dirs, all_src_dirs, src_dir_opts, recursive,
profile_src_dirs, profile_extra_src_dirs, profile_all_src_dirs,
- profile_src_dir_opts,
+ profile_src_dir_opts, top_src_dirs,
retarget_path, alt_base_dir_abs, alt_base_dir_rel, global_cache_dir,
default_global_cache_dir, overwrite_default_global_cache_dir].
@@ -143,6 +144,15 @@ recursive(Config) ->
ok.
+top_src_dirs(Config) ->
+ %% We can get the same result out of specifying src_dirs from the config root,
+ %% not just the erl_opts
+ RebarConfig = [{src_dirs, ["foo", "./bar", "bar", "bar/", "./bar/", "baz",
+ "./", ".", "../", "..", "./../", "../.", ".././../"]}],
+ {ok, State} = rebar_test_utils:run_and_check(Config, RebarConfig, ["compile"], return),
+
+ [".", "..", "../..", "bar", "baz", "foo"] = rebar_dir:src_dirs(rebar_state:opts(State)).
+
profile_src_dirs(Config) ->
RebarConfig = [
{erl_opts, [{src_dirs, ["foo", "bar"]}]},