diff options
author | Fred Hebert <mononcqc@ferd.ca> | 2015-07-19 16:09:50 -0400 |
---|---|---|
committer | Fred Hebert <mononcqc@ferd.ca> | 2015-07-19 16:09:50 -0400 |
commit | 9929eadc3495ab36338a64ffec9f2ddc01ac56f8 (patch) | |
tree | 90f9770f5cdf8f895b96ba1a4877625cafcfffef | |
parent | 93c000d02a4b79a2f17202016b119800d061ee57 (diff) | |
parent | c3c9db7ca6a2779f9a7221e93b47092c512361a2 (diff) |
Merge pull request #622 from tsloughter/profile_deps_deps
do not install profile deps of deps
-rw-r--r-- | src/rebar_prv_install_deps.erl | 2 | ||||
-rw-r--r-- | test/rebar_compile_SUITE.erl | 29 | ||||
-rw-r--r-- | test/rebar_test_utils.erl | 8 |
3 files changed, 36 insertions, 3 deletions
diff --git a/src/rebar_prv_install_deps.erl b/src/rebar_prv_install_deps.erl index 105bbb1..2a6048b 100644 --- a/src/rebar_prv_install_deps.erl +++ b/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)), diff --git a/test/rebar_compile_SUITE.erl b/test/rebar_compile_SUITE.erl index 2c42549..6884a22 100644 --- a/test/rebar_compile_SUITE.erl +++ b/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}]} + ). diff --git a/test/rebar_test_utils.erl b/test/rebar_test_utils.erl index 3fdb547..be52e81 100644 --- a/test/rebar_test_utils.erl +++ b/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)) |