浏览代码

do not install profile deps of deps

pull/622/head
Tristan Sloughter 10 年前
父节点
当前提交
c3c9db7ca6
共有 3 个文件被更改,包括 36 次插入3 次删除
  1. +1
    -1
      src/rebar_prv_install_deps.erl
  2. +27
    -2
      test/rebar_compile_SUITE.erl
  3. +8
    -0
      test/rebar_test_utils.erl

+ 1
- 1
src/rebar_prv_install_deps.erl 查看文件

@ -391,7 +391,7 @@ handle_dep(State, Profile, DepsDir, AppInfo, Locks, Level) ->
AppInfo2 = rebar_app_info:state(AppInfo1, S5),
%% Upgrade lock level to be the level the dep will have in this dep tree
Deps = rebar_state:get(S5, deps, []),
Deps = rebar_state:get(S5, {deps, default}, []),
NewLocks = [{DepName, Source, LockLevel+Level} ||
{DepName, Source, LockLevel} <- rebar_state:get(S5, {locks, default}, [])],
AppInfo3 = rebar_app_info:deps(AppInfo2, rebar_state:deps_names(Deps)),

+ 27
- 2
test/rebar_compile_SUITE.erl 查看文件

@ -21,7 +21,8 @@
highest_version_of_pkg_dep/1,
parse_transform_test/1,
erl_first_files_test/1,
mib_test/1]).
mib_test/1,
only_default_transitive_deps/1]).
-include_lib("common_test/include/ct.hrl").
-include_lib("eunit/include/eunit.hrl").
@ -49,7 +50,7 @@ all() ->
recompile_when_opts_change, dont_recompile_when_opts_dont_change,
dont_recompile_yrl_or_xrl, delete_beam_if_source_deleted,
deps_in_path, checkout_priority, highest_version_of_pkg_dep,
parse_transform_test, erl_first_files_test, mib_test].
parse_transform_test, erl_first_files_test, mib_test, only_default_transitive_deps].
build_basic_app(Config) ->
AppDir = ?config(apps, Config),
@ -531,3 +532,27 @@ mib_test(Config) ->
%% check the extra src_dir was linked into the _build dir
true = filelib:is_dir(filename:join([AppDir, "_build", "default", "lib", Name, "mibs"])).
only_default_transitive_deps(Config) ->
AppDir = ?config(apps, Config),
Name = rebar_test_utils:create_random_name("app1_"),
Vsn = rebar_test_utils:create_random_vsn(),
rebar_test_utils:create_app(AppDir, Name, Vsn, [kernel, stdlib]),
GitDeps = rebar_test_utils:expand_deps(git, [{"a", "1.0.0", []}]),
PkgName = rebar_test_utils:create_random_name("pkg1_"),
mock_git_resource:mock([{deps, rebar_test_utils:flat_deps(GitDeps)},
{config, [{profiles, [{test, [{deps, [list_to_atom(PkgName)]}]}]}]}]),
mock_pkg_resource:mock([{pkgdeps, [{{iolist_to_binary(PkgName), <<"0.1.0">>}, []}]}]),
Deps = rebar_test_utils:top_level_deps(GitDeps),
RConfFile = rebar_test_utils:create_config(AppDir, [{deps, Deps}]),
{ok, RConf} = file:consult(RConfFile),
%% Build with deps.
rebar_test_utils:run_and_check(
Config, RConf, ["as", "test", "compile"],
{ok, [{app, Name}, {dep, "a", <<"1.0.0">>}, {dep_not_exist, PkgName}]}
).

+ 8
- 0
test/rebar_test_utils.erl 查看文件

@ -216,6 +216,14 @@ check_results(AppDir, Expected, ProfileRun) ->
{Name, _App} ->
ok
end
; ({dep_not_exist, Name}) ->
ct:pal("App Not Exist Name: ~p", [Name]),
case lists:keyfind(Name, 1, DepsNames) of
false ->
ok;
{Name, _App} ->
error({app_found, Name})
end
; ({checkout, Name}) ->
ct:pal("Checkout Name: ~p", [Name]),
?assertNotEqual(false, lists:keyfind(Name, 1, CheckoutsNames))

正在加载...
取消
保存