diff options
-rwxr-xr-x | bootstrap | 2 | ||||
-rw-r--r-- | src/rebar_git_resource.erl | 11 | ||||
-rw-r--r-- | src/rebar_prv_cover.erl | 19 | ||||
-rw-r--r-- | src/rebar_prv_path.erl | 8 | ||||
-rw-r--r-- | test/rebar_cover_SUITE.erl | 8 |
5 files changed, 20 insertions, 28 deletions
@@ -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_prv_cover.erl b/src/rebar_prv_cover.erl index c915141..e555a9b 100644 --- a/src/rebar_prv_cover.erl +++ b/src/rebar_prv_cover.erl @@ -296,8 +296,7 @@ strip_coverdir(File) -> cover_compile(State, apps) -> Apps = filter_checkouts(rebar_state:project_apps(State)), AppDirs = app_dirs(Apps), - ExtraDirs = extra_src_dirs(State, Apps), - cover_compile(State, lists:filter(fun(D) -> ec_file:is_dir(D) end, AppDirs ++ ExtraDirs)); + cover_compile(State, lists:filter(fun(D) -> ec_file:is_dir(D) end, AppDirs)); cover_compile(State, Dirs) -> %% start the cover server if necessary {ok, CoverPid} = start_cover(), @@ -322,21 +321,7 @@ app_dirs(Apps) -> lists:foldl(fun app_ebin_dirs/2, [], Apps). app_ebin_dirs(App, Acc) -> - AppDir = rebar_app_info:ebin_dir(App), - ExtraDirs = rebar_dir:extra_src_dirs(rebar_app_info:opts(App), []), - OutDir = rebar_app_info:out_dir(App), - [AppDir] ++ [filename:join([OutDir, D]) || D <- ExtraDirs] ++ Acc. - -extra_src_dirs(State, Apps) -> - BaseDir = rebar_state:dir(State), - F = fun(App) -> rebar_app_info:dir(App) == BaseDir end, - %% check that this app hasn't already been dealt with - Extras = case lists:any(F, Apps) of - false -> rebar_dir:extra_src_dirs(rebar_state:opts(State), []); - true -> [] - end, - OutDir = rebar_dir:base_dir(State), - [filename:join([OutDir, "extras", D]) || D <- Extras]. + [rebar_app_info:ebin_dir(App)|Acc]. filter_checkouts(Apps) -> filter_checkouts(Apps, []). 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/test/rebar_cover_SUITE.erl b/test/rebar_cover_SUITE.erl index a838d7d..841e29f 100644 --- a/test/rebar_cover_SUITE.erl +++ b/test/rebar_cover_SUITE.erl @@ -90,7 +90,7 @@ basic_extra_src_dirs(Config) -> {file, _} = cover:is_compiled(Mod), ExtraMod = list_to_atom(lists:flatten(io_lib:format("~ts_extra", [Name]))), - {file, _} = cover:is_compiled(ExtraMod). + false = cover:is_compiled(ExtraMod). release_extra_src_dirs(Config) -> AppDir = ?config(apps, Config), @@ -129,9 +129,9 @@ release_extra_src_dirs(Config) -> {file, _} = cover:is_compiled(Mod2), ExtraMod1 = list_to_atom(lists:flatten(io_lib:format("~ts_extra", [Name1]))), - {file, _} = cover:is_compiled(ExtraMod1), + false = cover:is_compiled(ExtraMod1), ExtraMod2 = list_to_atom(lists:flatten(io_lib:format("~ts_extra", [Name2]))), - {file, _} = cover:is_compiled(ExtraMod2). + false = cover:is_compiled(ExtraMod2). root_extra_src_dirs(Config) -> AppDir = ?config(apps, Config), @@ -160,7 +160,7 @@ root_extra_src_dirs(Config) -> Mod2 = list_to_atom(Name2), {file, _} = cover:is_compiled(Mod2), - {file, _} = cover:is_compiled(extra). + false = cover:is_compiled(extra). index_written(Config) -> AppDir = ?config(apps, Config), |