diff options
author | Viacheslav V. Kovalev <kovyl2404@gmail.com> | 2015-05-01 00:23:51 +0300 |
---|---|---|
committer | Viacheslav V. Kovalev <kovyl2404@gmail.com> | 2015-05-01 00:23:51 +0300 |
commit | 33736f32a9a8bfd30711270e8f1376280915d697 (patch) | |
tree | 11924915352287650253a73ae7254af241c07625 /src/rebar_prv_xref.erl | |
parent | 29a855d31c7fe7fd7504f5d0ec95c9a55e27276f (diff) | |
parent | 7645a1118f0e5cdc27e010905f5072021559ddfd (diff) |
Merge branch 'master' into app-discover-profile-duplication
Conflicts:
test/rebar_profiles_SUITE.erl
Diffstat (limited to 'src/rebar_prv_xref.erl')
-rw-r--r-- | src/rebar_prv_xref.erl | 22 |
1 files changed, 5 insertions, 17 deletions
diff --git a/src/rebar_prv_xref.erl b/src/rebar_prv_xref.erl index 67cd554..1d1afa0 100644 --- a/src/rebar_prv_xref.erl +++ b/src/rebar_prv_xref.erl @@ -36,7 +36,8 @@ init(State) -> -spec do(rebar_state:t()) -> {ok, rebar_state:t()} | {error, string()}. do(State) -> - {OriginalPath, XrefChecks} = prepare(State), + code:add_pathsa(rebar_state:code_paths(State, all_deps)), + XrefChecks = prepare(State), %% Run xref checks ?INFO("Running cross reference analysis...", []), @@ -45,9 +46,8 @@ do(State) -> %% Run custom queries QueryChecks = rebar_state:get(State, xref_queries, []), QueryResults = lists:foldl(fun check_query/2, [], QueryChecks), - - ok = cleanup(OriginalPath), - + stopped = xref:stop(xref), + rebar_utils:cleanup_code_path(rebar_state:code_paths(State, default)), case XrefResults =:= [] andalso QueryResults =:= [] of true -> {ok, State}; @@ -100,10 +100,6 @@ prepare(State) -> [{ok, _} = xref:add_directory(xref, rebar_app_info:ebin_dir(App)) || App <- rebar_state:project_apps(State)], - %% Save the code path prior to doing any further code path - %% manipulation - OriginalPath = code:get_path(), - %% Get list of xref checks we want to run ConfXrefChecks = rebar_state:get(State, xref_checks, [exports_not_used, @@ -112,15 +108,7 @@ prepare(State) -> XrefChecks = sets:to_list(sets:intersection( sets:from_list(?SUPPORTED_XREFS), sets:from_list(ConfXrefChecks))), - {OriginalPath, XrefChecks}. - -cleanup(Path) -> - %% Restore the code path using the provided path - true = rebar_utils:cleanup_code_path(Path), - - %% Stop xref - stopped = xref:stop(xref), - ok. + XrefChecks. xref_checks(XrefChecks) -> lists:foldl(fun run_xref_check/2, [], XrefChecks). |