summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.travis.yml27
-rwxr-xr-xbootstrap2
-rw-r--r--src/rebar_git_resource.erl11
-rw-r--r--src/rebar_hooks.erl28
-rw-r--r--src/rebar_prv_path.erl8
-rw-r--r--src/rebar_prv_update.erl12
6 files changed, 48 insertions, 40 deletions
diff --git a/.travis.yml b/.travis.yml
index ab2d28d..a45cb05 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -1,27 +1,24 @@
sudo: false
language: erlang
-install: "true"
+install: 'true'
otp_release:
- - 18.0
- - 17.5
- - R16B03-1
- - R15B03
+- 18.0
+- 17.5
+- R16B03-1
+- R15B03
before_script: "./bootstrap"
script: "./rebar3 ct"
branches:
only:
- - master
+ - master
cache:
directories:
- - $HOME/.cache/rebar3/hex/default
-before_deploy: "rm -rf !(rebar3)"
+ - "$HOME/.cache/rebar3/hex/default"
deploy:
+ provider: releases
+ api_key:
+ secure: MjloYuaQF3cd3Oab57zqwPDLPqt5MDgBIrRLpXOQwNovr2tnkKd4aJK3QJ3pTxvZievjgl+qIYI1IZyjuRV37nkjAfMw14iig959wi0k8XTJoMdylVxE5X7hk4SiWhX/ycnJx3C28PPw1OitGTF76HAJDMgEelNdoNt+hvjvDEo=
+ file: rebar3
on:
+ repo: erlang/rebar3
tags: true
- condition: $TRAVIS_OTP_RELEASE = R16B03-1
- provider: s3
- access_key_id: AKIAJAPYAQEFYCYSNL7Q
- secret_access_key:
- secure: "BUv2KQABv0Q4e8DAVNBRTc/lXHWt27yCN46Fdgo1IrcSSIiP+hq2yXzQcXLbPwkEu6pxUZQtL3mvKbt6l7uw3wFrcRfFAi1PGTITAW8MTmxtwcZIBcHSk3XOzDbkK+fYYcaddszmt7hDzzEFPtmYXiNgnaMIVeynhQLgcCcIRRQ="
- bucket: "rebar3"
- skip_cleanup: true
diff --git a/bootstrap b/bootstrap
index 7a7f735..f52779e 100755
--- a/bootstrap
+++ b/bootstrap
@@ -24,7 +24,7 @@ main(_) ->
bootstrap_rebar3(),
%% Build rebar.app from rebar.app.src
- {ok, App} = rebar_app_info:new(rebar, "3.1.0", filename:absname("_build/default/lib/rebar/")),
+ {ok, App} = rebar_app_info:new(rebar, "3.1.1", filename:absname("_build/default/lib/rebar/")),
rebar_otp_app:compile(rebar_state:new(), App),
%% Because we are compiling files that are loaded already we want to silence
diff --git a/src/rebar_git_resource.erl b/src/rebar_git_resource.erl
index 5a6a5ef..ff43f76 100644
--- a/src/rebar_git_resource.erl
+++ b/src/rebar_git_resource.erl
@@ -18,9 +18,16 @@ lock(AppDir, {git, Url, _}) ->
lock(AppDir, {git, Url});
lock(AppDir, {git, Url}) ->
AbortMsg = io_lib:format("Locking of git dependency failed in ~s", [AppDir]),
+ Dir = rebar_utils:escape_double_quotes(AppDir),
{ok, VsnString} =
- rebar_utils:sh("git --git-dir=\"" ++ rebar_utils:escape_double_quotes(AppDir) ++ "/.git\" rev-parse --verify HEAD",
- [{use_stdout, false}, {debug_abort_on_error, AbortMsg}]),
+ case os:type() of
+ {win32, _} ->
+ rebar_utils:sh("git rev-parse --git-dir=\"" ++ Dir ++ "/.git\" --work-tree=\"" ++ Dir ++ "\" --verify HEAD",
+ [{use_stdout, false}, {debug_abort_on_error, AbortMsg}]);
+ _ ->
+ rebar_utils:sh("git --git-dir=\"" ++ Dir ++ "/.git\" rev-parse --verify HEAD",
+ [{use_stdout, false}, {debug_abort_on_error, AbortMsg}])
+ end,
Ref = string:strip(VsnString, both, $\n),
{git, Url, {ref, Ref}}.
diff --git a/src/rebar_hooks.erl b/src/rebar_hooks.erl
index 3af17ca..d6a0e2b 100644
--- a/src/rebar_hooks.erl
+++ b/src/rebar_hooks.erl
@@ -38,18 +38,22 @@ run_provider_hooks(Dir, Type, Command, Providers, Opts, State) ->
run_provider_hooks_(_Dir, _Type, _Command, _Providers, [], State) ->
State;
run_provider_hooks_(Dir, Type, Command, Providers, TypeHooks, State) ->
- PluginDepsPaths = rebar_state:code_paths(State, all_plugin_deps),
- code:add_pathsa(PluginDepsPaths),
- Providers1 = rebar_state:providers(State),
- State1 = rebar_state:providers(rebar_state:dir(State, Dir), Providers++Providers1),
- HookProviders = proplists:get_all_values(Command, TypeHooks),
- case rebar_core:do(HookProviders, State1) of
- {error, ProviderName} ->
- ?DEBUG(format_error({bad_provider, Type, Command, ProviderName}), []),
- throw(?PRV_ERROR({bad_provider, Type, Command, ProviderName}));
- {ok, State2} ->
- rebar_utils:remove_from_code_path(PluginDepsPaths),
- State2
+ case proplists:get_all_values(Command, TypeHooks) of
+ [] ->
+ State;
+ HookProviders ->
+ PluginDepsPaths = lists:usort(rebar_state:code_paths(State, all_plugin_deps)),
+ code:add_pathsa(PluginDepsPaths),
+ Providers1 = rebar_state:providers(State),
+ State1 = rebar_state:providers(rebar_state:dir(State, Dir), Providers++Providers1),
+ case rebar_core:do(HookProviders, State1) of
+ {error, ProviderName} ->
+ ?DEBUG(format_error({bad_provider, Type, Command, ProviderName}), []),
+ throw(?PRV_ERROR({bad_provider, Type, Command, ProviderName}));
+ {ok, State2} ->
+ rebar_utils:remove_from_code_path(PluginDepsPaths),
+ State2
+ end
end.
format_error({bad_provider, Type, Command, {Name, Namespace}}) ->
diff --git a/src/rebar_prv_path.erl b/src/rebar_prv_path.erl
index 4e88496..4259eec 100644
--- a/src/rebar_prv_path.erl
+++ b/src/rebar_prv_path.erl
@@ -77,15 +77,15 @@ paths([{rel, true}|Rest], Apps, State, Acc) ->
base_dir(State) -> io_lib:format("~s", [rebar_dir:base_dir(State)]).
bin_dir(State) -> io_lib:format("~s/bin", [rebar_dir:base_dir(State)]).
-lib_dir(State) -> io_lib:format("~s/lib", [rebar_dir:base_dir(State)]).
+lib_dir(State) -> io_lib:format("~s", [rebar_dir:deps_dir(State)]).
rel_dir(State) -> io_lib:format("~s/rel", [rebar_dir:base_dir(State)]).
ebin_dirs(Apps, State) ->
- lists:map(fun(App) -> io_lib:format("~s/lib/~s/ebin", [rebar_dir:base_dir(State), App]) end, Apps).
+ lists:map(fun(App) -> io_lib:format("~s/~s/ebin", [rebar_dir:deps_dir(State), App]) end, Apps).
priv_dirs(Apps, State) ->
- lists:map(fun(App) -> io_lib:format("~s/lib/~s/priv", [rebar_dir:base_dir(State), App]) end, Apps).
+ lists:map(fun(App) -> io_lib:format("~s/~s/priv", [rebar_dir:deps_dir(State), App]) end, Apps).
src_dirs(Apps, State) ->
- lists:map(fun(App) -> io_lib:format("~s/lib/~s/src", [rebar_dir:base_dir(State), App]) end, Apps).
+ lists:map(fun(App) -> io_lib:format("~s/~s/src", [rebar_dir:deps_dir(State), App]) end, Apps).
print_paths_if_exist(Paths, State) ->
{RawOpts, _} = rebar_state:command_parsed_args(State),
diff --git a/src/rebar_prv_update.erl b/src/rebar_prv_update.erl
index 5e1e253..54b135e 100644
--- a/src/rebar_prv_update.erl
+++ b/src/rebar_prv_update.erl
@@ -114,14 +114,14 @@ hex_to_index(State) ->
ets:foldl(fun({Pkg, [[]]}, _) when is_binary(Pkg) ->
true;
- ({Pkg, [Vsns=[Vsn | _Rest]]}, _) when is_binary(Pkg) ->
+ ({Pkg, [Vsns=[_Vsn | _Rest]]}, _) when is_binary(Pkg) ->
%% Verify the package is of the right build tool by checking if the first
%% version exists in the table from the foldl above
- case ets:member(?PACKAGE_TABLE, {Pkg, Vsn}) of
- true ->
- ets:insert(?PACKAGE_TABLE, {Pkg, Vsns});
- false ->
- true
+ case [V || V <- Vsns, ets:member(?PACKAGE_TABLE, {Pkg, V})] of
+ [] ->
+ true;
+ Vsns1 ->
+ ets:insert(?PACKAGE_TABLE, {Pkg, Vsns1})
end;
(_, _) ->
true